
1. Authenticate
For server-side automations, open your account settings and generate an API key. Store it asRAINBRAND_API_KEY in your environment or secret manager before running the examples below. Treat it as a secret — never commit it or expose it client-side.
App integrations can use Rainbrand OAuth instead and call the API with Authorization: Bearer <access_token>. See API authentication for the OAuth endpoints and PKCE requirements.
2. Get a Brand ID
Pick an existing brand with an active Brand Skill, or create one from your sources. The Brief in step 4 needs that Skill. Its Brand ID is thebrandSessionId used in the requests below.
- Existing brand
- Create a brand
List your brands and copy any Pick a brand whose
id:status is ready and whose activeSkill is not null. The list doesn’t include activeSkill, so read it with GET /brands/{id}. If none of your brands has one, create a brand instead. Its id is the brandSessionId you’ll use next. If the brand is still analyzing, continue to step 3.3. Wait for the brand
Passwait=true to wait for the current brand analysis:
status: "analyzing", call the same endpoint again with the same Brand ID. Continue only when the brand is ready.
If the brand is failed, show failure.message and follow Handle failures for retries.
4. Request a Brief
Describe what you want to make:data.id to retrieve the Brief:
briefId in the
generation request. The Brief must belong to you and the same Brand as
brandSessionId.
See Request a Brief for details and failure handling.
5. Make your first generation
Find an image model, then read its input schema. This example usesopenai/gpt-image-2.5-flare:
input according to the returned inputSchema. Write your concrete task
in input.prompt and set the model’s controls. Rainbrand places the complete Brief
guidance before your prompt and attaches compatible visual assets after your
references; your prompt and controls remain authoritative. Without briefId,
include the relevant brand guidance and references in the model input yourself.
Generations run asynchronously and can return multiple outputs. The initial response contains a generation ID.
data.id to retrieve the result:
Idempotency-Key header. Resending the same body with the same key returns the original generation instead of starting another; use a new key for a new generation.
6. Retrieve the result
CallGET /generations/{id} with wait=true to wait for the result:
data.status is completed, each entry in data.outputs contains a file’s url and mimeType. If the status is still pending or generating, repeat the same read. If it is failed, read data.failure: message summarizes the failure, and providerMessage, when present, gives the provider’s own reason, such as an input value it rejected. Start a new attempt with the same request only when retryable is true, using a new Idempotency-Key if you sent one.
The API reference defines the complete request and response contracts.