Every request to https://pogton.com/api/v1 needs an API key in the Authorization header. Call the API from your server only; anyone with the key can publish for every user of your organization.
curl https://pogton.com/api/v1/users \
-H "Authorization: Bearer pk_3f9a..."
Creating a key
- In the dashboard, go to Connect → API.
- Create a key, give it a name and choose Live or Test.
- Copy the key. It is shown once; Pogton only stores a hash.
You can have several keys and revoke one at any time. A revoked key stops working immediately. Connect links signed with a revoked key stop working too. You can also list, create, roll and revoke keys through the API.
Live and test keys
| Live key | Test key | |
|---|---|---|
| Prefix | pk_ | pk_test_ |
| Accounts | Real accounts your users connected | Sandbox accounts only |
| Publishing | Publishes to the platforms | Validates, then simulates publishing |
| Webhooks | Sent | Sent, with "test": true on post events |
| Webhook URLs | HTTPS only | HTTP allowed, for local tunnels |
Every response has an X-Pogton-Mode header with live or test, so you can check which mode a request ran in.
A live key can't publish to a sandbox account and a test key can't publish to a real one; both get 403 mode_mismatch. GET /api/v1/accounts only lists accounts of the key's mode.
Rate limits
Each key can make 300 requests per minute. The window is a fixed minute. Every response says where you are:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed per minute (300) |
X-RateLimit-Remaining | Requests left in this window |
X-RateLimit-Reset | Unix time (seconds) when the window resets |
Retry-After | On a 429 only: seconds to wait |
Over the limit, the API returns 429 rate_limited. Wait Retry-After seconds and try again. Requests to the MCP server count against the same limit. To publish many posts at once, use POST /api/v1/posts/batch: one request for up to 50 posts.
Idempotency
Network errors happen. To retry a request that creates something without doing it twice, send an Idempotency-Key header with a unique value, such as a UUID:
curl -X POST https://pogton.com/api/v1/posts \
-H "Authorization: Bearer pk_3f9a..." \
-H "Idempotency-Key: 0b6a8f8e-3c1d-4d55-9a57-2f2f1a6c9e10" \
-H "Content-Type: application/json" \
-d '{ "account_ids": ["j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed"], "content": "Hello" }'
- A repeat with the same key and the same body returns the first response, status code included, with
Idempotent-Replayed: true. Nothing is published again. - The same key with a different body returns
422 idempotency_conflict. - A repeat while the first request is still running returns
409 idempotency_in_progress. Wait a moment and retry. - Errors are stored too. After fixing a rejected request, send it with a new key.
- Keys are kept for 24 hours and are scoped to your organization. The maximum length is 255 characters.
These endpoints accept the header: POST /posts, POST /posts/batch, POST /posts/schedule, POST /posts/{id}/publish, POST /posts/{id}/retry, POST /posts/{id}/comments, POST /connect-link, POST /connect/authorize, POST /connect/sessions/{token}/select, POST /media/upload-url, POST /media, POST /webhooks and POST /webhooks/{id}/rotate-secret. Other endpoints ignore it.
Errors
Errors use HTTP status codes and one JSON shape:
{
"statusCode": 422,
"statusMessage": "The post does not meet the rules of one or more platforms",
"data": {
"error": {
"code": "validation_failed",
"message": "The post does not meet the rules of one or more platforms",
"details": [
{
"field": "content",
"code": "text_too_long",
"message": "X allows 280 characters; this text counts as 312",
"severity": "error",
"platform": "twitter",
"account_id": "j97ab3c4d5e6f7g8h9j0k1m2n3p4q5rs"
}
]
}
}
}
Branch on data.error.code; it is stable. Messages are for people and may change. details is set for validation errors: a list of { field, message } for a malformed request, or platform issues for validation_failed.
Error codes
| Status | Code | Meaning |
|---|---|---|
| 400 | validation_error | The body or query doesn't match the schema. details lists the fields. |
| 400 | invalid_json | The body is not valid JSON. |
| 400 | invalid_request | A parameter is missing or doesn't make sense, e.g. a reply without a single account. |
| 400 | not_supported | The platform doesn't support this, e.g. deleting a TikTok post. |
| 400 | unsupported_platform | Unknown platform slug. |
| 401 | unauthorized | Missing, malformed, unknown or revoked API key. |
| 403 | mode_mismatch | A live key used a sandbox account, or a test key a real one. |
| 403 | test_mode_only | The endpoint needs a test key. |
| 403 | permission_denied | The platform refused: a scope or app review is missing. |
| 404 | post_not_found, account_not_found, user_not_found, media_not_found, upload_not_found, webhook_not_found, delivery_not_found, not_found | The resource doesn't exist, or belongs to another organization. |
| 404 | unknown_resource | The platform has no lookup list of that kind. |
| 409 | account_revoked | The account was disconnected. |
| 409 | auth_expired | The platform rejected the account's token. The account is now needs_reauth. |
| 409 | post_not_editable, post_not_publishable, post_not_retryable | The post is in the wrong status for this call. |
| 409 | post_processing | The post is being published right now. Try again in a minute. |
| 409 | not_published, nothing_to_delete, nothing_to_retry | No targets match the call. |
| 409 | idempotency_in_progress | A request with this Idempotency-Key is still running. |
| 410 | account_revoked | Analytics for a disconnected account. |
| 422 | validation_failed | The content breaks a platform rule. details lists the issues per platform. |
| 422 | idempotency_conflict | The Idempotency-Key was used with a different request. |
| 422 | account_user_mismatch, multiple_users | The accounts belong to another user, or to more than one. |
| 422 | no_queue_schedule, queue_full | queue: true without a schedule, or no free slot in 8 weeks. |
| 422 | invalid_request, media_error | The platform rejected the content or couldn't fetch the media. |
| 429 | rate_limited | Over 300 requests a minute for this key, or the platform's own limit. |
| 500 | internal_error | Something went wrong on our side. Check whether the work was done (for example with GET /posts) before retrying with a new Idempotency-Key. |
| 502 | platform_error, network | The platform failed or couldn't be reached. Retry later. |
Errors from publishing itself are not HTTP errors: a post that fails on one platform still returns 201, with the error on that target.
Old error fields
The first version of the API returned only statusCode and statusMessage. Both are still in every error, so older clients keep working.
