# SaaS and workflow integration

## Choose your entry point

- Use the [MCP client guides](/docs/mcp) to generate media from a connected AI assistant.
- Use the [CLI](/cli) for shell scripts and local project files.
- Use the [REST quickstart](/docs) when serving your own users. Start from the [runnable examples](https://github.com/i2v-ai/i2v-api-examples) for Node.js, Python, curl, Next.js, and n8n. A coding assistant can use the `i2v-integrate` Skill to adapt these examples to your project.

## Store one record for each operation

Keep the i2v.ai API key on the server. Authorize tenant access before quoting, submitting, cancelling, or querying a task. Record the tenant, stable operation key, approved USD amount, quoted revision, and exact submitted inputs. Save the returned task ID on that same record.

Use the [media workflow](/docs/media-workflow) for signed uploads and submission receipt recovery. Before issuing another generation request for a slow task, query the original task or receipt. When a task completes, validate ownership and copy the output to your own storage if it needs long-term access.

## Receive a signed callback

Verify the exact raw request body before parsing it. Use the signing key selected by `X-I2V-Key-ID` and verify the timestamp and HMAC. Store processed event IDs and keep terminal job state when a duplicate or older event arrives. Use polling if callbacks are delayed. The [callback reference](/docs/webhooks) describes the headers and event format.

## Check cost and availability

Quote the actual inputs before approving the charge. Use a USD ceiling on submission and report the user's task ID after a wait expires. View available and reserved funds through the [API reference](/docs/api). Read settled charges and refunds through `GET /api/v1/account/usage`. The i2v.ai account that owns the API key pays for generated tasks.