Skip to main content

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

Step 1: Get your API key

  1. Sign up at pixcraft.es if you haven’t already
  2. Subscribe to an API plan at pixcraft.es/developers
  3. Go to your API Keys dashboard
  4. Click “Create API Key” and copy your key (it starts with px_live_)
Keep your API key secret. Never expose it in client-side code or public repositories.

Step 2: Make your first request

Using curl

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)

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

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

$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:
FieldDescription
dimensionsGrid size (cols × rows) and total units
materialsList of colors with quantities and percentages
assembly_guideStep-by-step assembly instructions (direction depends on niche — see assemblyDirection in capabilities)
usageYour current API usage for the billing period

What’s next?

Authentication

Learn about API key management and security.

Generate endpoint

Full reference for all generation parameters.

Get a PDF

Generate downloadable PDF assembly guides.

Integration guides

Complete integration examples for your stack.