Klopaper
All Civitai guides

Civitai API

Civitai API Guide: Models, Images, Downloads and Authentication

The Civitai REST API exposes structured data for creators, images, models, model versions, hashes, and tags. It is useful for catalogs, download tools, metadata lookup, and reproducible AI workflows.

9 min read
Three-stage workflow
  1. 01 Request Endpoint and filters
  2. 02 Response Items and metadata
  3. 03 Next page Follow pagination
01

Civitai API key authentication

Public reads may work without a key, but authenticated requests are more reliable and can access resources tied to your account permissions. Generate a key on the Civitai Account page and send it as a bearer token.

Keep the token on the server. Do not embed it in browser JavaScript, public repositories, shared URLs, analytics events, or logs. Use a separate named key for each integration so you can revoke one without disrupting the others.

Note: Authorization: Bearer YOUR_API_KEY

02

Core Civitai API endpoints

The documented v1 REST surface includes creators, images, models, a single model, model versions, lookup by file hash, and tags. Model responses include creator, tags, statistics, permissions, versions, files, hashes, scan data, and example images when available.

The image endpoint supports filters such as model, version, user, maturity level, sort order, and time period. Returned generation metadata depends on what the uploader shared.

  • GET /api/v1/creators: list and search creators.
  • GET /api/v1/images: browse image records and metadata.
  • GET /api/v1/models and /models/:id: query catalog records.
  • GET /api/v1/model-versions/:id: resolve an exact version.
  • GET /api/v1/model-versions/by-hash/:hash: identify a local file.
  • GET /api/v1/tags: browse model tags.
03

Filter and paginate without overloading the API

Use the smallest useful page size and apply server-supported filters. Read pagination metadata or cursor values from the response instead of guessing page URLs. Cache catalog responses when freshness requirements allow it.

Handle 401, 403, 404, 429, and 5xx responses separately. Retry only transient failures, add jittered backoff, and cap attempts. Do not retry an invalid key or missing resource in a tight loop.

04

Resolve model downloads safely

Model-version records expose files and download URLs. Preserve the model ID, version ID, filename, and a strong hash beside the downloaded file. Verify that the response is the expected file rather than an HTML error page.

Respect creator permissions and Civitai terms. Avoid mirroring resources by default. Link to the source model page so users can review version notes and licenses.

05

How Klopaper uses the Civitai API

Klopaper searches Civitai media and LoRAs, resolves model-version resources, reads prompt metadata, and stages reusable text recipes. A visitor’s Civitai key is encrypted at rest and isolated to that browser session.

Generation is separate. Klopaper sends the prepared recipe to fal.ai or Replicate using the visitor’s provider key. Civitai remains the discovery and metadata source rather than the generation biller for those runs.

Questions

Civitai FAQ

Is the Civitai API free?

Public catalog access and account policies can change. Creating an API key is separate from paid generation or training, and current costs should be checked in Civitai.

How do I download a Civitai model with the API?

Resolve the exact model version, select its file download URL, authenticate when required, and verify the downloaded filename and hash.

Why does my Civitai API key not work?

Check for whitespace, revocation, required permissions, the Bearer header format, and whether the request is being sent from an allowed account context.

Connect Civitai to Klopaper

Add your own API key for reliable discovery, gated LoRAs, and Civitai collections. Your key is encrypted and isolated to this browser session.

Primary sources

Klopaper is independent and is not affiliated with Civitai. Product interfaces, prices, and policies can change.