Site API Guide
This section covers everything you need to start building against the Civitai site API: generating a token, making your first request, paginating results, handling errors, and working with AIR identifiers. It is also where the civitai CLI is documented.
The REST API
- Getting started — create a token and make your first call.
- Authentication — how bearer tokens work and when they're required.
- Pagination —
pagevs.cursorand the 1000-offset cap. - Errors — response shape and HTTP status codes.
- AIR identifiers — the canonical URN format for Civitai resources.
For a per-endpoint breakdown (parameters, response fields, examples), see the Reference.
The civitai CLI
The same binary reads these endpoints, downloads model files, and runs generations on your own account.
- CLI — install it, then the read and download commands.
- CLI credentials and scopes — OAuth vs a personal API key, and why a default browser login cannot spend Buzz.
- Generating images from the CLI — 🔴 spends real Buzz. The money contract,
--dry-run,--max-cost, waiting and downloading. - Choosing a model —
--checkpointvs--ecosystem, silent model substitution, and image-to-image. - Raw generation graphs —
--print-input/--input, and the only route to a seed. - Tracking and cancelling generations — finding a job, reading what failed, and what cancelling does to a charge.
- Scripting the CLI with
--json— the output guarantees beyond the read endpoints. - CLI terminal output — the colour precedence, and what the human renderers guarantee about text a stranger uploaded.
- CLI troubleshooting — look the error message up here.
To author and ship a Civitai App with the same binary, see the Apps guide.