> ## Documentation Index
> Fetch the complete documentation index at: https://docs.f13.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Base URL, conventions, and cross-cutting behavior

## Base URL

```text theme={null}
https://api.f13.com
```

All paths in this reference are relative to it. The API is served directly -
call it from your server, not from client-side code (your API key would be
exposed).

## Authentication

Every endpoint requires a bearer API key:

```text theme={null}
Authorization: Bearer f13_sk_live_…
```

See [Authentication](https://docs.f13.com/authentication.md) for how keys are issued and managed.

## Content types

Requests are JSON (`Content-Type: application/json`). Generation responses
stream as server-sent events (`text/event-stream`); error responses are JSON.
Unknown request fields are ignored.

## Idempotency

Send an optional `Idempotency-Key` header (1–255 characters, any format -
UUIDs work well) to make a request safely retryable:

```text theme={null}
Idempotency-Key: 4f9d36c0-order-hero-icon
```

* If a request with the same key **completed within the last 24 hours** in
  your workspace, the retry replays the stored outcome without generating or
  billing again: the finished SVG as a single `delta` frame, then the `saved`
  (or `save_error`) and `done` frames. Replayed responses carry an
  `Idempotency-Replayed: true` header. A workspace with
  [zero data retention](https://docs.f13.com/streaming.md#zero-data-retention) stores no result:
  its replay is a single `{"type":"done","retention":"none","note":"not_retained"}`
  event, still unbilled, with no image.
* If the original request is **still in progress**, the retry receives a
  `409` - wait, then retry the same key for the stored result.
* If the original request **failed**, the key is released and can be reused.
* A key is **bound to the body it was first used with**. The same key with a
  different `prompt`, `images` or `parentAssetId` is rejected with `422` and
  `"code": "idempotency_key_reused"`, so a reused key can never hand back the
  wrong image. Use a new key for a new request.
* Keyed requests depend on the idempotency store, but the store never takes
  the API down. If it cannot take a key, the request is generated like one
  without a key and the response carries the header
  `Idempotency-Unavailable: true`: that result is not stored, so retrying it
  is a new, billed generation. Check the header before retrying.

Keys are scoped to the workspace.

## Rate limits

Requests are limited per API key and per workspace over a sliding 60-second
window (the workspace limit spans all keys and dashboard traffic combined).
The default per-key limit is 120 requests/minute and the workspace limit
600 requests/minute; contact us if you need more.

When a limit is exceeded the API responds with
[`429`](https://docs.f13.com/errors) and a `Retry-After` header giving the seconds to wait. A
rejected request does not count against the window, so waiting out
`Retry-After` is always enough. Successful responses carry no rate-limit
headers.

## Billing

Each generation debits your workspace's credit balance at a flat per-image
price. The price is reserved before the stream starts: when the balance
can't cover it (or a payment on the workspace is under dispute) the API
responds with [`402`](https://docs.f13.com/errors) and nothing streams. A generation that ends
in an `error` frame is refunded, so a failed stream never costs credit. A
generation that produced an SVG is billed even if your connection dropped
before you read it; retry with the same `Idempotency-Key` to get it back
without paying again. Manage balances and top-ups from the
[dashboard](https://app.f13.com) billing page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.