# REST API overview

The REST API is for your own systems: a website backend that reports leads, a script that pushes CRM changes or ad results, a tool that writes drafts. It speaks JSON over HTTPS and works inside one workspace at a time.

It can read content, create drafts and ask for approval, take events about leads and sales, take CRM records and take ad results. It cannot approve, schedule or publish anything: those are decisions a signed-in person takes in the app.

## Base address and version

```text
https://heymysocial.com/api/v1
```

The version is part of the address. Everything documented here lives under `/api/v1`.

Send request bodies as JSON with `Content-Type: application/json`. Every answer is JSON, errors included.

The same API is described as an OpenAPI 3.1 document at `https://heymysocial.com/api/v1/openapi.json`. It needs no key, and the [operation pages](https://heymysocial.com/docs/api/operations) are generated from it.

## Authentication

Every request carries a workspace API key as a bearer token: `Authorization: Bearer hms_live_…`. A key is made under [Settings, API keys](https://heymysocial.com/settings/api-keys), holds one or more scopes, and belongs to exactly one workspace. That workspace is the only one the request can touch; there is no workspace parameter. [Authentication](https://heymysocial.com/docs/api/authentication) has the details.

```bash
curl https://heymysocial.com/api/v1/content \
  -H "Authorization: Bearer $HMS_API_KEY"
```

## Request ids

Every response has an `X-Request-Id` header: up to 64 letters, digits and hyphens. An error repeats the same value as `request_id` in its body. Log it with your own records and quote it when you write to us about a request; it is how one call is found on our side.

The id is given by the server. An `X-Request-Id` you send is not used.

## Idempotency

A network failure can leave you not knowing whether a `POST` went through. Send an `Idempotency-Key` header with every request that changes something, and sending it again is safe.

```bash
curl -X POST https://heymysocial.com/api/v1/content \
  -H "Authorization: Bearer $HMS_API_KEY" \
  -H "Idempotency-Key: draft-roof-check-2026-11-25" \
  -H "Content-Type: application/json" \
  -d '{"body": "Is your roof right for solar? A short visit answers it."}'
```

The rules:

- The key is your own value, 8 to 191 characters. A shorter or longer one is answered `422` `validation_failed`.
- It is read on requests that change something. A `GET` ignores it.
- The same key with the same request (method, path, body byte for byte, and the same API key) returns the first answer again, with its status code and the header `Idempotent-Replay: true`. Nothing is done twice.
- The same key with a different request is answered `409` `duplicate`. That includes the same body sent with another API key of the workspace.
- The same key while the first request is still running is answered `409` `duplicate` with `retryable: true`. Wait a moment and send it again.
- When the first attempt ended in a server error (5xx), the key is released and the retry runs as a new request.
- Every other answer is kept, a `4xx` included. The exceptions are `401` and `429`: they are given before the header is read, so the same key can be sent again. If a request was refused for another reason, correct it and send it with a new key.

Keys are remembered for the workspace and are not forgotten after a while, so never reuse one for another request. A UUID, or your own id of the thing you are creating, works well.

Three operations are safe to repeat even without the header, because they recognize what they have seen: [events](https://heymysocial.com/docs/api/operations/ingest-events) by `event_id`, [CRM records](https://heymysocial.com/docs/api/operations/send-crm-records) by the CRM's own ids, and [ad results](https://heymysocial.com/docs/api/operations/import-ads) by ad, period and numbers.

## Pagination

Two operations return lists, and each does it its own way.

| Operation | How it pages |
|---|---|
| [List content items](https://heymysocial.com/docs/api/operations/list-content) | `page` (from 1) and `per_page` (1 to 50, default 25). The answer has `meta` with `total`, `page`, `per_page` and `timezone`. A page past the end is an empty list. |
| [List CRM reconciliation errors](https://heymysocial.com/docs/api/operations/list-crm-reconciliation-errors) | No pages. `limit` (1 to 200, default 50) returns the newest errors with the chosen status. |

There are no cursors and no `Link` headers. To walk through all content, ask for page 1 and go on until you have `total` items.

The operations that take a batch answer for the whole batch in one response. [Send events](https://heymysocial.com/docs/api/operations/ingest-events) and [Send CRM records in a batch](https://heymysocial.com/docs/api/operations/send-crm-records) give one result for each item, in the order you sent them; [Import ad results](https://heymysocial.com/docs/api/operations/import-ads) gives counts and lists the rows that were not stored. Their maximum size is on each operation's page.

## Rate limits

Limits are counted over one minute.

<div class="table-scroll"><table><thead><tr><th>What</th><th>Limit</th><th>Counted per</th></tr></thead><tbody><tr><th scope="row">REST API</th><td>120 requests a minute</td><td>API key</td></tr><tr><th scope="row">Event ingestion and webhooks</th><td>600 requests a minute</td><td>Tracking site and sender address</td></tr><tr><th scope="row">Assistant connector</th><td>90 requests a minute</td><td>Signed-in person</td></tr><tr><th scope="row">Public forms</th><td>10 requests a minute</td><td>Visitor address</td></tr></tbody></table></div>

Two of them apply to the REST API:

- **Every call under `/api/v1`** counts against the REST API limit, 120 requests a minute for each key. On top of that, all calls from one sender address together may make 600 requests a minute, whichever keys they carry; calls without a valid key count there too.
- **`POST /events`** ([Send events](https://heymysocial.com/docs/api/operations/ingest-events)) counts against that limit and also against the limit for event ingestion, 600 requests a minute. On this address the second limit is counted per sender address alone, whichever key or workspace the events are for. Put several events in one request rather than sending them one by one.

A request under the limit carries `X-RateLimit-Limit` and `X-RateLimit-Remaining` headers; on `POST /events` they show whichever of the two limits has fewer requests left. A request over a limit is answered `429` with the code `rate_limited` and `retryable: true`. Its `Retry-After` header says how many seconds to wait before sending it again.

## Operations

Every operation has a page with its parameters, body, answers and a request you can paste. They are listed together under [API operations](https://heymysocial.com/docs/api/operations).

| Operation | Request | Scope |
|---|---|---|
| [List content items](https://heymysocial.com/docs/api/operations/list-content) | `GET /content` | `content:read` |
| [Create a draft](https://heymysocial.com/docs/api/operations/create-content-draft) | `POST /content` | `content:write` |
| [Get one content item](https://heymysocial.com/docs/api/operations/get-content) | `GET /content/{content}` | `content:read` |
| [Add a version](https://heymysocial.com/docs/api/operations/add-content-version) | `POST /content/{content}/versions` | `content:write` |
| [Ask a person to approve](https://heymysocial.com/docs/api/operations/request-content-approval) | `POST /content/{content}/approval-requests` | `content:write` |
| [Send CRM records in a batch](https://heymysocial.com/docs/api/operations/send-crm-records) | `POST /crm/{connection}/records` | `leads:write`, and `sales:write` for sale records |
| [List CRM reconciliation errors](https://heymysocial.com/docs/api/operations/list-crm-reconciliation-errors) | `GET /crm/reconciliation-errors` | `leads:read` |
| [Import ad results](https://heymysocial.com/docs/api/operations/import-ads) | `POST /ads/import` | `ads:write` |
| [Send events](https://heymysocial.com/docs/api/operations/ingest-events) | `POST /events` | `events:write` |

When something goes wrong, the answer has one shape. [Errors](https://heymysocial.com/docs/api/errors) explains it and lists every code.
