How to hit the Civitai API

Civitai's public REST API at https://civitai.com/api/v1 searches the community's image-generation models (checkpoints, LoRAs) and images. Reading needs no key.

Authentication

None for searching. A key from your Civitai account settings, sent as Authorization: Bearer <key>, is needed for some downloads and for NSFW content settings.

Full reference: https://developer.civitai.com/docs/api/public-rest

Search models

curl "https://civitai.com/api/v1/models?query=landscape&limit=2"
Run in PostTaco
Example response (trimmed)
{
  "items": [
    {
      "id": 86963,
      "name": "LandscapeSuperMix",
      "allowNoCredit": false,
      "allowCommercialUse": [],
      "allowDerivatives": false,
      "allowDifferentLicense": true,
      "type": "Checkpoint",
      "minor": false,
      "sfwOnly": false,
      "poi": false,
      "nsfw": false,
      "nsfwLevel": 3,
      "availability": "Public",
      "userId": 1024073,
      "hasActivePaidAccess": false
    },
    {
      "id": 85137,
      "name": "Landscape Realistic Pro",
      "allowNoCredit": true,
      "allowCommercialUse": [
        "Image",
        "RentCivit"
      ],
      "allowDerivatives": true,
      "allowDifferentLicense": true,
      "type": "Checkpoint",
      "minor": false,
      "sfwOnly": false,
      "poi": false,
      "nsfw": false,
      "nsfwLevel": 7,
      "availability": "Public",
      "userId": 1702081,
      "hasActivePaidAccess": false
    }
  ],
  "metadata": {
    "nextCursor": "2",
    "nextPage": "https://civitai.com/api/v1/models?query=landscape&limit=2&cursor=2"
  }
}

List tags

curl "https://civitai.com/api/v1/tags?limit=5"
Run in PostTaco
Example response (trimmed)
{
  "items": [
    {
      "name": "character",
      "link": "https://civitai.com/api/v1/models?tag=character"
    },
    {
      "name": "anime",
      "link": "https://civitai.com/api/v1/models?tag=anime"
    }
  ],
  "metadata": {
    "totalItems": 0,
    "currentPage": 1,
    "pageSize": 5,
    "totalPages": 1
  }
}