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

> ## Agent Instructions
> Usertick runs surveys on websites, by link, by QR code and by email, and collects every response in one inbox with reports, dashboards and workflows. The REST API lives at https://app.usertick.com/api/public/v1 and uses Bearer API keys or OAuth access tokens; the JavaScript SDK is the @usertick/snippet package on npm.

# Survey themes

> Read the survey themes in your organization's library through the REST API, save new ones, and change the ones no live or paused survey uses.

The survey theme endpoints read and write the saved themes of **Your themes** in the survey editor: the fonts, the shapes, the light and dark colors and the survey page. A survey draft wears a saved theme when it names the theme's ID as `theme.themeId`. The analysis themes that Usertick files answers under are a different list, which `GET /themes` returns.

| Endpoint | Scopes | Does |
| - | - | - |
| [`GET /survey-themes`](https://docs.usertick.com/developers/api/reference/list-survey-themes) | `surveys:read` | Lists the saved themes |
| [`GET /survey-themes/{themeId}`](https://docs.usertick.com/developers/api/reference/get-survey-theme) | `surveys:read` | Returns one saved theme |
| [`GET /survey-themes/capabilities`](https://docs.usertick.com/developers/api/reference/get-survey-theme-capabilities) | `themes:write` | Lists what a theme can hold in your organization |
| [`POST /survey-themes`](https://docs.usertick.com/developers/api/reference/create-survey-theme) | `themes:write`, `surveys:read` | Saves a new theme |
| [`PATCH /survey-themes/{themeId}`](https://docs.usertick.com/developers/api/reference/edit-survey-theme) | `themes:write`, `surveys:read` | Changes a theme no live or paused survey uses |

An app or an AI assistant acts as the person who connected it, so writing a theme requires the permission to manage surveys. Each change appears in the activity log as made through the credential. Deleting a theme and choosing the default one stay with a person in Usertick.

## The theme

| Field | Meaning |
| - | - |
| `id`, `name` | The theme in the library |
| `definition` | Its settings, in `general` (the type and the shapes), `light` and `dark` (the colors) and `page` (the survey page) |
| `isDefault` | Whether new blank surveys start in it |
| `usedBy` | How many surveys use it, archived ones not counted |
| `usedByLive` | How many of those are live or paused |
| `editable` | Whether `PATCH` may change it, which is when `usedByLive` is 0 |
| `version` | What an edit names as `expectedVersion` |

## Create a theme

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://app.usertick.com/api/public/v1/survey-themes" \
  -H "Authorization: Bearer utk_live_your_key_here" \
  -H "Idempotency-Key: brand-theme-1" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Spring campaign",
    "basedOn": { "style": "soft" },
    "set": {
      "general": { "borderRadius": 20, "buttonShape": "pill", "headingWeight": "bold" },
      "light": { "primaryColor": "#FF3C00" },
      "dark": { "primaryColor": "#FF5B29" }
    }
  }'
```

Read `GET /survey-themes/capabilities` first. It lists every key with its type, the values or the range it takes and what a theme without it draws, the fonts, the built-in styles, and your plan's limits.

* `basedOn` names what the theme starts from, either a built-in `style` or a saved `themeId`. Without it, the theme starts from the classic style.
* `set` holds only what differs from that base. A key the theme doesn't have returns `400` with `PUB-018-005` and names its path.
* A picture of the survey page is the `url` of a file in your media library. See [Upload a picture](https://docs.usertick.com/developers/api/surveys.md#upload-a-picture).
* Your plan's limits apply. See [What your plan includes](#what-your-plan-includes).

The call returns `201` with the theme and its address in `Location`. No survey uses the theme yet.

## What your plan includes

| | Free | Starter | Pro and Business |
| - | - | - | - |
| Saved themes | 3 (`PLN-001-017`) | Unlimited | Unlimited |
| Background picture and cover image of the survey page | Not included (`PUB-018-006`) | ✓ | ✓ |
| Custom CSS, for the website widget | Not included (`THM-001-007`) | Not included (`THM-001-007`) | ✓ |

API keys start on the Pro plan and AI assistants on Starter. `limits` in `GET /survey-themes/capabilities` says what applies to your organization: `themesUsed` and `themesAllowed` (`null` for unlimited), `customCssAllowed` and `picturesAllowed`. A library at its limit still takes changes to the themes it holds. A theme that kept custom CSS or pictures when the organization moved to a lower plan stays editable, while a change that adds them is refused. The exception is custom CSS on a theme that a website survey uses: the change returns `403` with `THM-002-003` until `set` clears the CSS. A new theme based on one that holds custom CSS or pictures is refused on a plan without them, until `set` sends `null` for them.

## Edit a theme

A saved theme's change reaches every survey that uses it at once. An edit through the API therefore changes drafts and archived surveys only: while a live or paused survey uses the theme, its unpublished changes included, the edit returns `409` with `PUB-018-002` and nothing changes. A person edits that theme in Usertick, or you save a new theme from it with `basedOn`.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "expectedVersion": 3,
  "name": "Spring campaign",
  "set": { "general": { "headingFontFamily": null }, "light": { "primaryColor": "#E03500" } }
}
```

`PATCH /survey-themes/{themeId}` takes the `version` of your last read as `expectedVersion` and a `name`, a `set` or both. A key left out of `set` stays as it is, `null` clears a key that a theme may leave out, and `"page": null` clears the survey page's settings. If the theme changed since you read it, the edit returns `409` with `PUB-018-003`: read it again and redo the edit.


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