# API introduction (/en/api)

```txt
Base URL: https://api.tebar.app/v1
```

The dashboard and Tebar's own MCP server use this API, so anything you can do there can also be done through the API.

## Authentication [#authentication]

Create an API key in the dashboard: the account menu → **API keys** → **Create an API key**. Choose **read** or **read and write** access. The full key is only shown once.

Send the key in the `Authorization` header:

```bash
curl https://api.tebar.app/v1/accounts \
  -H "Authorization: Bearer tb_live_xxx"
```

- Keys are accepted **only** in the header, never in the query string.
- Tebar only stores a hash of the key, so a lost key cannot be shown again. Revoke it and create a new one.
- Up to 25 active keys per account.
- `write` access includes `read`.

## Format [#format]

- Request and response bodies are JSON with `snake_case` field names.
- Times are ISO 8601. Send them with a time zone (`2026-10-15T09:00:00+07:00`); responses are always in UTC.

## Pagination [#pagination]

```txt
GET /v1/posts?limit=20&cursor=...
```

```json
{ "data": [], "next_cursor": "..." }
```

`next_cursor` is `null` on the last page. `limit` is at most 100.

## Idempotency [#idempotency]

Send an `Idempotency-Key` header when creating a post. If a request with the same key and body is sent again (after a timeout, for example), Tebar returns the post it already created instead of making a new one. The same key with a different body is refused with `409 idempotency_conflict`.

```bash
curl -X POST https://api.tebar.app/v1/posts \
  -H "Authorization: Bearer tb_live_xxx" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"content":"Hello!","targets":[{"account_id":"..."}]}'
```

## Rate limits [#rate-limits]

Responses include the `RateLimit-Limit`, `RateLimit-Remaining`, and `RateLimit-Reset` headers. When a limit is exceeded, the API answers `429 rate_limited`.

## Main endpoints [#main-endpoints]

| Method | Path                               | Scope | What it does                                                                            |
| ------ | ---------------------------------- | ----- | --------------------------------------------------------------------------------------- |
| GET    | `/me`                              | read  | Account info and the token's kind of access                                             |
| GET    | `/accounts`                        | read  | Connected social accounts                                                               |
| GET    | `/accounts/{id}/publishing-limit`  | read  | Remaining posting quota                                                                 |
| POST   | `/accounts/discord/webhook`        | write | [Connect a Discord channel with a webhook URL](/en/discord#through-the-api)             |
| POST   | `/posts`                           | write | [Create a post](/en/api/posts)                                                          |
| GET    | `/posts`, `/posts/{id}`            | read  | List and details of posts created through Tebar                                         |
| PATCH  | `/posts/{id}`                      | write | Change a scheduled post                                                                 |
| DELETE | `/posts/{id}`                      | write | Cancel a scheduled post                                                                 |
| POST   | `/posts/{id}/publish`              | write | Publish now                                                                             |
| POST   | `/posts/{id}/retry`                | write | Retry the accounts that failed                                                          |
| POST   | `/media/from-url`, `/media/upload` | write | [Upload media](/en/api/media)                                                           |
| GET    | `/ideas/board`                     | read  | [Ideas board](/en/api/ide)                                                              |
| POST   | `/ideas`, `/idea-columns`          | write | [Add an idea, add a column](/en/api/ide)                                                |
| GET    | `/comments`                        | read  | [Comments](/en/api/komentar-statistik)                                                  |
| GET    | `/accounts/{id}/insights`          | read  | [Account statistics](/en/api/komentar-statistik)                                        |
| GET    | `/accounts/{id}/posts`             | read  | [Every post on an account](/en/api/komentar-statistik#posts-on-an-account)              |
| GET    | `/accounts/{id}/posts/{postId}`    | read  | [One post and its Threads thread parts](/en/api/komentar-statistik#posts-on-an-account) |
| POST   | `/insights/sync`                   | read  | [Fetch the latest statistics and post list](/en/api/komentar-statistik)                 |
