---
agent:
  instructions: "Search the site by keyword or question. The search API returns Markdown."
  endpoint: "https://platform.invideo.io/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Quickstart

> Make an API key and generate your first image with one curl command.

## 1. Make an account

[Sign up](/signup) with your email and enter the code we send. Use your workspace to manage your team, API keys, and usage.

New accounts get access after a short review. If the console asks you to request access, tell us your company and what you plan to build. We’ll reply by email.

## 2. Create an API key

In the console, open [API keys](/api-keys) and select **Create key**. Copy the key while it’s visible. You can only view it once. It looks like this:

```text
iv_2bXk9QeJt0aLm3VfR8sP1c_Tz7...
```

Keep it on your server, never in a browser or an app. Put it in an environment variable:

```bash
export INVIDEO_API_KEY="iv_..."
```

## 3. Run a model

Submit a request. The API answers at once with the request's id:

```bash
curl -X POST https://platform-api.invideo.io/v1/request \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-2-1",
    "mode": "generate",
    "input": { "prompt": "a red fox in fresh snow, golden hour" }
  }'
```

```json
{ "id": "0f8b6c1e-...", "status": "queued" }
```

## 4. Read the result

Set `REQUEST_ID` to the `id` returned above. Read the request until its `status` is `succeeded` or `failed`. An image takes seconds, a video can take minutes:

```bash
curl "https://platform-api.invideo.io/v1/request/${REQUEST_ID:?Set REQUEST_ID to the id from the submit response}" \
  -H "Authorization: Bearer $INVIDEO_API_KEY"
```

```json
{
  "id": "0f8b6c1e-...",
  "model": "nano-banana-2-1",
  "mode": "generate",
  "status": "succeeded",
  "output": {
    "kind": "image",
    "files": [{ "url": "https://...", "content_type": "image/png", "width": 1024, "height": 1024 }]
  },
  "error": null,
  "cost_usd": "0.07"
}
```

Each file `url` works for one hour; read the request again for a fresh link.

## The same in Python and JavaScript

```python
import os, time, requests

BASE = "https://platform-api.invideo.io/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['INVIDEO_API_KEY']}"}

submit = requests.post(f"{BASE}/request", headers=HEADERS, json={
    "model": "nano-banana-2-1",
    "mode": "generate",
    "input": {"prompt": "a red fox in fresh snow, golden hour"},
})
submit.raise_for_status()
job = submit.json()

while True:
    status = requests.get(f"{BASE}/request/{job['id']}", headers=HEADERS)
    status.raise_for_status()
    request = status.json()
    if request["status"] in ("succeeded", "failed"):
        break
    time.sleep(2)

print(request["output"] or request["error"])
```

```ts
const BASE = "https://platform-api.invideo.io/v1";
const headers = { Authorization: `Bearer ${process.env.INVIDEO_API_KEY}`, "Content-Type": "application/json" };

const submit = await fetch(`${BASE}/request`, {
  method: "POST",
  headers,
  body: JSON.stringify({ model: "nano-banana-2-1", mode: "generate", input: { prompt: "a red fox in fresh snow, golden hour" } }),
});
if (!submit.ok) throw new Error(await submit.text());
const job = await submit.json();

let request;
do {
  await new Promise((done) => setTimeout(done, 2000));
  const status = await fetch(`${BASE}/request/${job.id}`, { headers });
  if (!status.ok) throw new Error(await status.text());
  request = await status.json();
} while (!["succeeded", "failed"].includes(request.status));

console.log(request.output ?? request.error);
```

## Next

- Find a model and its inputs on [Models](/models), or with `GET /v1/catalog`.
- Send images, video or audio as input: [Files](/docs/files).
- Handle errors and retries: [Errors](/docs/errors) and [Requests](/docs/requests).
