# Requests

Requests are HTTPS calls to `https://backend.creatorhero.com`. Send `X-API-Key` on every call. See [Authentication](/authentication).

## Paths and versions

An operation path looks like this:

```text
/dashboard/api/{version}/{resource}
```

`version` is `v1`, `v2`, or `v3`, chosen per resource. A newer version does not retire the older paths. Welcome messages live under `/dashboard/api/v3/settings/welcome-messages`. The creator list lives under `/dashboard/api/v2/creator`. Chat messages still live under `/dashboard/api/v1/of-chat`. Use the path in the reference, including its version.

## JSON

Request bodies are `application/json` unless the operation says otherwise. File uploads to the vault use a form upload (`multipart/form-data`). A profile-picture upload sends the image itself (JPEG or PNG).

Successful responses are usually JSON. Some operations publish the body as `*/*` and still return a JSON object. Downloads are called out on the operation: `application/octet-stream` for files, and `text/csv` for exports.

Set `Content-Type: application/json` when you send a body.

## Creator ids

`creatorId` is an integer. On almost every operation it is an `int64` path parameter. It is the CreatorHero creator id.

List the creators the caller can access:

```bash
curl https://backend.creatorhero.com/dashboard/api/v2/creator/list-creators \
  -H "X-API-Key: $CREATORHERO_API_KEY"
```

Use the `id` field from that array. `onlyfansId` is the OnlyFans account id and is a different field. An unknown `creatorId`, or one you cannot access, is rejected with `403`.

`GET /dashboard/api/v2/creator/all-states` returns the service state of each creator the caller can access, including whether automations are running.

Other ids in paths (`fanId`, `userId`, `messageId`, `listId`, `mediaId`) are also integers. Read the format on the parameter. Some are `int32` and some are `int64`.

## Dates

Query parameters named `from` and `to` bound a range.

| Format | How it is written | Where it shows up |
| --- | --- | --- |
| `date` | `yyyy-mm-dd` | Statistics, tracking, and subscription ranges |
| `date-time` | ISO-8601 timestamp | Message cursors and a few filters |

Where an operation says so, `from` must not be after `to`.

## Success with no body

Deletes, and some updates, return `204` and an empty body. A `201` is used when an operation explicitly creates a resource, such as a bulk message. Most writes return `200` with the updated resource. Trust the status list on the operation.

## Long-running exports

`POST /dashboard/api/v2/tracking/{creatorId}/messages/export` can return `202` when the export is large. The description says a `jobId` is returned and the client polls status. The status operation is `GET /dashboard/api/v2/tracking/{creatorId}/messages/export/{jobId}/status`. If the same export is already running you get `409`; try again later.

## Uploads

Chat media upload is two flows under [OF Chat Medias](/api/of-chat-medias): a single upload, and a multipart sequence of start, upload, and finish. Follow the operation you are calling. The steps are not interchangeable.
