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:
The API returns immediately with a generation ID:

2. Poll for the result

Check the generation status every few seconds until it completes:
When the generation completes, you get the output URL:
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:
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.