Skip to main content
This guide walks you through making your first API request. You will generate an image, poll for the result, and get the output URL.

Prerequisites

You need an API key. If you do not have one, create it now — it takes 30 seconds.

1. Create a generation

Send a POST request to /api/run with a tool and prompt:
curl -X POST https://api.artificialstudio.ai/api/run \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_API_KEY" \
  -d '{
    "tool": "create-image",
    "input": {
      "prompt": "A futuristic city at sunset, cyberpunk style, neon lights"
    }
  }'
The API returns immediately with a generation ID:
{
  "id": "507f1f77bcf86cd799439011",
  "status": "processing",
  "tool": "create-image",
  "createdAt": "2024-01-15T10:30:00.000Z"
}

2. Poll for the result

Check the generation status every few seconds until it completes:
curl https://api.artificialstudio.ai/api/generations/507f1f77bcf86cd799439011 \
  -H "Authorization: YOUR_API_KEY"
When the generation completes, you get the output URL:
{
  "id": "507f1f77bcf86cd799439011",
  "status": "success",
  "output": "https://files.artificialstudio.ai/generations/abc123.png",
  "thumbnail": "https://files.artificialstudio.ai/thumbnails/abc123.jpg",
  "tool": "create-image",
  "type": "image",
  "createdAt": "2024-01-15T10:30:00.000Z"
}
Polling works, but webhooks are better for production. Add a webhook URL to your request and the API will POST the result to your server when the generation finishes:
curl -X POST https://api.artificialstudio.ai/api/run \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_API_KEY" \
  -d '{
    "tool": "create-image",
    "input": {
      "prompt": "A futuristic city at sunset"
    },
    "webhook": "https://your-server.com/webhook"
  }'
See Webhooks for setup details and best practices.

Next steps

API reference

Full details on the /api/run endpoint.

Browse models

See all available models and their parameters.

Webhooks

Set up real-time notifications for completed generations.

List tools

Discover all available tools and capabilities.