Skip to content
roasOS API
Esc
navigateopen⌘Jpreview
On this page

Quickstart

Generate your first image in a few minutes.

This guide walks you through generating an image end to end. The pattern — quote, then confirm — is the same for every paid action.

1. Get your API key

Create a key in your workspace settings. Keys look like roasos_sk_.... Keep it secret — treat it like a password.

Send it as a bearer token on every request:

Authorization: Bearer roasos_sk_...

2. Check your account

A quick call to confirm your key works and see your credit balance:

curl https://api.roasos.com/v1/account \
  -H "Authorization: Bearer roasos_sk_..."

You’ll get back your workspace, plan, and available credits.

3. Get a price (quote)

Set quote_only: true to see the price without being charged. Every paid request also needs an Idempotency-Key header — a unique string that makes retries safe.

curl -X POST https://api.roasos.com/v1/generations \
  -H "Authorization: Bearer roasos_sk_..." \
  -H "Idempotency-Key: my-first-image-001" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "image",
    "prompt": "a red sneaker on a white background, product photo",
    "model": "nano-banana-pro",
    "quote_only": true
  }'

The response includes a quote_id and the price in reserved_credits. Nothing has been charged yet.

4. Run it (confirm)

Send the same request again, but swap quote_only for the quote_id you just got. This is the step that spends credits. Use the same Idempotency-Key.

curl -X POST https://api.roasos.com/v1/generations \
  -H "Authorization: Bearer roasos_sk_..." \
  -H "Idempotency-Key: my-first-image-001" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "image",
    "prompt": "a red sneaker on a white background, product photo",
    "model": "nano-banana-pro",
    "quote_id": "the-quote-id-from-step-3"
  }'

You’ll get a generation id and a status of processing.

5. Get the result

Poll the generation until it’s completed:

curl https://api.roasos.com/v1/generations/GENERATION_ID \
  -H "Authorization: Bearer roasos_sk_..."

When it’s done, output.images contains the image URL.

Next steps

Quotes and credits — How pricing and charging work.

Research ads — Search competitor ads from the Facebook Ad Library.

Was this page helpful?