Pogton
Docs Authentication

Getting started

Authentication

Authenticate Connect API requests with live and test API keys, stay within 300 requests per minute, retry safely with Idempotency-Key, and handle error codes.

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

  1. In the dashboard, go to Connect → API.
  2. Create a key, give it a name and choose Live or Test.
  3. 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 keyTest key
Prefixpk_pk_test_
AccountsReal accounts your users connectedSandbox accounts only
PublishingPublishes to the platformsValidates, then simulates publishing
WebhooksSentSent, with "test": true on post events
Webhook URLsHTTPS onlyHTTP 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:

HeaderMeaning
X-RateLimit-LimitRequests allowed per minute (300)
X-RateLimit-RemainingRequests left in this window
X-RateLimit-ResetUnix time (seconds) when the window resets
Retry-AfterOn 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

StatusCodeMeaning
400validation_errorThe body or query doesn't match the schema. details lists the fields.
400invalid_jsonThe body is not valid JSON.
400invalid_requestA parameter is missing or doesn't make sense, e.g. a reply without a single account.
400not_supportedThe platform doesn't support this, e.g. deleting a TikTok post.
400unsupported_platformUnknown platform slug.
401unauthorizedMissing, malformed, unknown or revoked API key.
403mode_mismatchA live key used a sandbox account, or a test key a real one.
403test_mode_onlyThe endpoint needs a test key.
403permission_deniedThe platform refused: a scope or app review is missing.
404post_not_found, account_not_found, user_not_found, media_not_found, upload_not_found, webhook_not_found, delivery_not_found, not_foundThe resource doesn't exist, or belongs to another organization.
404unknown_resourceThe platform has no lookup list of that kind.
409account_revokedThe account was disconnected.
409auth_expiredThe platform rejected the account's token. The account is now needs_reauth.
409post_not_editable, post_not_publishable, post_not_retryableThe post is in the wrong status for this call.
409post_processingThe post is being published right now. Try again in a minute.
409not_published, nothing_to_delete, nothing_to_retryNo targets match the call.
409idempotency_in_progressA request with this Idempotency-Key is still running.
410account_revokedAnalytics for a disconnected account.
422validation_failedThe content breaks a platform rule. details lists the issues per platform.
422idempotency_conflictThe Idempotency-Key was used with a different request.
422account_user_mismatch, multiple_usersThe accounts belong to another user, or to more than one.
422no_queue_schedule, queue_fullqueue: true without a schedule, or no free slot in 8 weeks.
422invalid_request, media_errorThe platform rejected the content or couldn't fetch the media.
429rate_limitedOver 300 requests a minute for this key, or the platform's own limit.
500internal_errorSomething went wrong on our side. Check whether the work was done (for example with GET /posts) before retrying with a new Idempotency-Key.
502platform_error, networkThe 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.