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

# Quickstart

> Get your API key and make your first request in under 5 minutes.

# Quickstart

## Step 1: Get your API key

1. Sign up at [pixcraft.es](https://pixcraft.es) if you haven't already
2. Subscribe to an API plan at [pixcraft.es/developers](https://pixcraft.es/developers)
3. Go to your [API Keys dashboard](https://pixcraft.es/dashboard/api)
4. Click "Create API Key" and copy your key (it starts with `px_live_`)

<Warning>
  Keep your API key secret. Never expose it in client-side code or public repositories.
</Warning>

## Step 2: Make your first request

### Using curl

```bash theme={null}
curl -X POST https://www.pixcraft.es/api/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/320px-Camponotus_flavomarginatus_ant.jpg",
    "niche": "mosaics",
    "width_cm": 100,
    "height_cm": 100,
    "max_colors": 6
  }'
```

### Using JavaScript (Node.js)

```javascript theme={null}
const response = await fetch('https://www.pixcraft.es/api/v1/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    image_url: 'https://example.com/photo.jpg',
    niche: 'mosaics',
    width_cm: 100,
    height_cm: 100,
    max_colors: 6,
  }),
});

const data = await response.json();
console.log(`Generated ${data.dimensions.total_units} tiles in ${data.materials.length} colors`);
```

### Using Python

```python theme={null}
import requests

response = requests.post(
    'https://www.pixcraft.es/api/v1/generate',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    json={
        'image_url': 'https://example.com/photo.jpg',
        'niche': 'mosaics',
        'width_cm': 100,
        'height_cm': 100,
        'max_colors': 6,
    }
)

data = response.json()
print(f"Generated {data['dimensions']['total_units']} tiles")
```

### Using PHP

```php theme={null}
$ch = curl_init('https://www.pixcraft.es/api/v1/generate');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_API_KEY',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'image_url' => 'https://example.com/photo.jpg',
        'niche' => 'mosaics',
        'width_cm' => 100,
        'height_cm' => 100,
        'max_colors' => 6,
    ]),
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
echo "Generated " . $data['dimensions']['total_units'] . " tiles\n";
```

## Step 3: Understand the response

The response contains everything you need to build or display the pattern:

| Field            | Description                                                                                               |
| ---------------- | --------------------------------------------------------------------------------------------------------- |
| `dimensions`     | Grid size (cols × rows) and total units                                                                   |
| `materials`      | List of colors with quantities and percentages                                                            |
| `assembly_guide` | Step-by-step assembly instructions (direction depends on niche — see `assemblyDirection` in capabilities) |
| `usage`          | Your current API usage for the billing period                                                             |

## What's next?

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Learn about API key management and security.
  </Card>

  <Card title="Generate endpoint" icon="wand-magic-sparkles" href="/api-reference/generate">
    Full reference for all generation parameters.
  </Card>

  <Card title="Get a PDF" icon="file-pdf" href="/api-reference/generate-pdf">
    Generate downloadable PDF assembly guides.
  </Card>

  <Card title="Integration guides" icon="puzzle-piece" href="/guides/node">
    Complete integration examples for your stack.
  </Card>
</CardGroup>
