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

# API reference

> Base URL, authentication, request and response rules, errors and limits shared by every PostSyncer REST API endpoint.

Each page in this section covers one endpoint. This page has the rules they all share. New to the API? Start with the [quickstart](/docs/quickstart.md).

## Base URL

```text theme={null}
https://postsyncer.com/api/v1
```

Every path in this reference is relative to it, except [Upload a file](/docs/api-reference/media/upload-file.md), which uses `https://upload.postsyncer.com/api/v1` with the same key. v1 is the only version.

## Authentication

Send your API key as a Bearer token on every request:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

Make keys in [Settings → API](https://app.postsyncer.com/settings/api). Each endpoint needs one `resource:action` permission, such as `posts:read`, and its page names it. [Authentication](/docs/essentials/authentication.md) lists every permission.

A missing or wrong key answers `401`:

```json 401 theme={null}
{
  "message": "Unauthenticated."
}
```

A key without the endpoint's permission answers `403`:

```json 403 theme={null}
{
  "message": "This API key does not have the \"posts:create\" permission. Edit the key in PostSyncer under Settings → API to grant it."
}
```

## Requests

* Send JSON bodies with `Content-Type: application/json`. File uploads use `multipart/form-data`.
* Every answer is JSON, whether or not you send an `Accept` header.
* Ids are integers.
* Post times you send and get back are `Y-m-d H:i` in the workspace's timezone, such as `2030-03-15 09:00`. Other timestamps in answers, such as a comment's `created_at`, are ISO 8601.
* Send `schedule_type` in lowercase: `draft`, `schedule` or `publish_now`. Statuses come back in uppercase, such as `SCHEDULED`.

## Responses

* One item answers as a plain object, such as `GET /posts/{id}`.
* Lists that aren't paged answer as a plain array, for example `GET /workspaces`, `GET /accounts`, `GET /labels`, `GET /campaigns`, `GET /snippets`, `GET /folders` and `GET /webhooks`.
* Paged lists put the items in `data` and the page details next to them, for example `GET /posts`, `GET /media` and `GET /comments`. [Pagination](/docs/pagination.md) shows each shape and a loop that reads every page.

## Errors

Every error answer has a `message` you can show to a person. Some add an `error` code or more fields:

| Status | When | Also in the answer |
| - | - | - |
| `401` | The key is missing or wrong. | |
| `403` | The key lacks the permission, or your role in the workspace can't do it. | |
| `403` | Your plan doesn't include it, or you've reached its limit, such as the Free plan's 20 posts a month, or (`"limit": "free_accounts"`) a post to an account that isn't one of the 2 a Free owner posts to (outside a first week). | `"error": "plan_limit_reached"`, `limit`, `upgrade_url` (`null` when the plan isn't yours, and the message says to ask the owner) |
| `404` | The URL names something that doesn't exist, or that your key can't reach. An id in the request body that doesn't exist is a `422` instead. | Nothing: the answer is `{"message": "Not found."}`. The exception is the two routes that read a social post, [`POST /media/download/url`](/docs/api-reference/media/download-url) and [`POST /media/analyze-video`](/docs/api-reference/media/analyze-video): they answer with their own `message` and a `code` when the post is private or removed. |
| `409` | Someone changed the post since you read it. | `"error": "post_changed_elsewhere"` |
| `422` | A field is missing or wrong. | Usually `errors`, with each field's messages; some `422`s carry `code` or `error` instead, or only the `message`. |
| `429` | Too many requests. | |

```json 422 theme={null}
{
  "message": "The workspace id field is required.",
  "errors": {
    "workspace_id": ["The workspace id field is required."]
  }
}
```

[Error handling](/docs/essentials/error-handling.md) lists every `error` code and when to try again, and the other answers you can get: `402` (not enough AI credits), `500` and `503`.

## Limits

You can make 60 requests a minute: [Rate limits](/docs/rate-limits.md) has the headers and what a `429` means. Your plan sets how many accounts you connect and posts you send a month: [Plan limits](/docs/plan-limits.md) has what the Free plan includes, what needs a paid plan, and the answer over a limit.


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