# Create a generation

> Create image, video and audio jobs with the Raywake generation endpoint using a valid quote, model input and an idempotency key.

Canonical: https://raywake.si/docs/reference/generate
Last updated: 2026-10-31

`POST /v1/generate`

Holds the quoted funds and starts the generation. Requires `generate`.

**Headers**

| Name | Type | Description |
| --- | --- | --- |
| `Idempotency-Key` | string | A unique value per intended generation, such as a UUID. Required. |

**Body**

| Name | Type | Description |
| --- | --- | --- |
| `model` | string | The quoted model id. Required. |
| `input` | object | The exact input you quoted. Required. |
| `quote_id` | string | A valid, unexpired quote for this model and input. Required. |
| `webhook_url` | string | A public https URL (port 443). When the job ends we POST it a signed event; see Webhooks below. |

**Query parameters**

| Name | Type | Description |
| --- | --- | --- |
| `wait` | boolean | Return when the job is terminal (up to about three minutes) instead of immediately. Default: `false`. |

**Example**

cURL:

```bash
curl -s -X POST https://api.raywake.com/v1/generate \
  -H "Authorization: Bearer $RAYWAKE_API_KEY" \
  -H "Idempotency-Key: YOUR-UUID" \
  -H "Content-Type: application/json" \
  -d '{"model":"nano-banana-pro","input":{"prompt":"A red ceramic cup on a wooden table, soft morning light","aspect_ratio":"1:1"},"quote_id":"QUOTE_ID"}'
```

Python:

```python
import json, os, requests

response = requests.post(
    "https://api.raywake.com/v1/generate",
    headers={"Authorization": f"Bearer {os.environ['RAYWAKE_API_KEY']}", "Idempotency-Key": "YOUR-UUID"},
    json=json.loads(r'''{
        "model": "nano-banana-pro",
        "input": {
            "prompt": "A red ceramic cup on a wooden table, soft morning light",
            "aspect_ratio": "1:1"
        },
        "quote_id": "QUOTE_ID"
    }'''),
)
print(response.json())
```

JavaScript:

```javascript
const response = await fetch("https://api.raywake.com/v1/generate", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.RAYWAKE_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": "YOUR-UUID" },
  body: JSON.stringify({
    "model": "nano-banana-pro",
    "input": {
      "prompt": "A red ceramic cup on a wooden table, soft morning light",
      "aspect_ratio": "1:1"
    },
    "quote_id": "QUOTE_ID"
  }),
});
console.log(await response.json());
```

Returns a job; see [Jobs](https://raywake.si/docs/reference/jobs) for its fields.

## Webhooks

With `webhook_url`, the job's end is sent to you instead of polling. The body is `{"type": "job.succeeded" | "job.failed", "timestamp", "data"}`, where `data` is exactly what `GET /v1/jobs/{job_id}` returns, with output links ready.

Each request carries `webhook-id`, `webhook-timestamp` and `webhook-signature` headers (Standard Webhooks), signed with your account's secret from the [API keys](https://raywake.si/api-keys) page. Answer with any 2xx status within 10 seconds. Otherwise we retry after 1 and 5 minutes, then 30 minutes, 2, 6 and 12 hours. Use `webhook-id` to ignore a repeat.

The URL must be https on port 443 and resolve only to public addresses; redirects are not followed.

Verify (Python):

```
# pip install standardwebhooks
from standardwebhooks.webhooks import Webhook

# The signing secret from the API keys page (whsec_...)
event = Webhook(RAYWAKE_WEBHOOK_SECRET).verify(raw_body, request_headers)
if event["type"] == "job.succeeded":
    outputs = event["data"]["outputs"]
```

## Related

- [API documentation](https://raywake.si/docs)
