> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fucksornot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get started with the FoN API in minutes

## Getting Started

This guide will help you make your first API call to FoN.

### Step 1: Create an Account

Before using the API, you need a FoN account. Register at [fucksornot.com](https://fucksornot.com) or use the API:

```bash theme={null}
curl -X POST https://fucksornot.com/api/auth \
  -H "Content-Type: application/json" \
  -d '{
    "action": "register",
    "email": "you@example.com",
    "username": "yourname",
    "password": "SecurePassword123!"
  }'
```

### Step 2: Generate an API Token

For programmatic access, generate an API token. First, log in:

```bash theme={null}
curl -X POST https://fucksornot.com/api/auth \
  -H "Content-Type: application/json" \
  -d '{
    "action": "login",
    "email": "you@example.com",
    "password": "SecurePassword123!"
  }'
```

Save the JWT token from the response, then generate an API token:

```bash theme={null}
curl -X POST https://fucksornot.com/api/auth/tokens/generate \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Script"}'
```

<Warning>
  Save your API token securely. It's only shown once and cannot be retrieved later.
</Warning>

### Step 3: Make Your First Upload

Upload an image using your API token:

```bash theme={null}
curl -X POST https://fucksornot.com/api/v1/upload \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "upload_type=image" \
  -F "description=Check out this cool thing" \
  -F "tags=gadget,tech" \
  -F "file=@/path/to/image.jpg"
```

### Step 4: Browse Content

List recent uploads (no authentication required):

```bash theme={null}
curl https://fucksornot.com/api/uploads?page=1&limit=10
```

### Step 5: Vote on Content

Vote on an upload:

```bash theme={null}
curl -X POST https://fucksornot.com/api/vote \
  -H "Cookie: auth-token=YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "uploadId": "upload-uuid-here",
    "vote": "fucks"
  }'
```

<Note>
  This endpoint, like most session-based endpoints, authenticates using the `auth-token` cookie that's set automatically when you log in via a browser. For non-browser clients, pass the same JWT returned by the login response as a cookie value, as shown above.
</Note>

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const fetch = require('node-fetch');
  const FormData = require('form-data');
  const fs = require('fs');

  const API_TOKEN = 'your_api_token';

  // Upload an image
  async function uploadImage(filePath, description) {
    const form = new FormData();
    form.append('upload_type', 'image');
    form.append('description', description);
    form.append('file', fs.createReadStream(filePath));

    const response = await fetch('https://fucksornot.com/api/v1/upload', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${API_TOKEN}`
      },
      body: form
    });

    return response.json();
  }

  uploadImage('./cool-thing.jpg', 'Check this out!')
    .then(console.log);
  ```

  ```python Python theme={null}
  import requests

  API_TOKEN = 'your_api_token'

  def upload_image(file_path, description):
      with open(file_path, 'rb') as f:
          response = requests.post(
              'https://fucksornot.com/api/v1/upload',
              headers={'Authorization': f'Bearer {API_TOKEN}'},
              files={'file': f},
              data={
                  'upload_type': 'image',
                  'description': description
              }
          )
      return response.json()

  result = upload_image('./cool-thing.jpg', 'Check this out!')
  print(result)
  ```

  ```bash cURL theme={null}
  # Upload an image
  curl -X POST https://fucksornot.com/api/v1/upload \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    -F "upload_type=image" \
    -F "description=Check this out!" \
    -F "file=@./cool-thing.jpg"
  ```
</CodeGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="lock" href="/authentication">
    Learn more about authentication options
  </Card>

  <Card title="Uploads" icon="upload" href="/concepts/uploads">
    Understand upload types and options
  </Card>

  <Card title="Voting" icon="thumbs-up" href="/concepts/voting">
    Learn about the voting system
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore all endpoints
  </Card>
</CardGroup>
