Inbox, comments, and replies

Read threads and comments, reply, like, and manage inbox state with a scoped API key.

Updated

Open in ClaudeOpen in ChatGPT
On this page

The inbox endpoints let your key read the comment conversations (threads) on its scoped accounts, submit durable replies as the connected account, and update local inbox state. Reads need comment:read; replies need comment:reply; marking a thread handled needs thread:resolve; changing unread state needs thread:update. See the scope model in Authentication.

Two behaviors apply to every endpoint on this page. First, a scoped key only ever sees threads and comments inside its selected Brands and accounts; an out-of-scope filter value returns an empty result, never an error, so responses leak no existence information. Second, read responses carry a requestId correlation field (null unless the request carried a UUID in Idempotency-Key or X-Request-ID).

List inbox threads

GET /api/v1/threads

Lists the threads visible to the caller, newest activity first. A thread is one comment conversation on a connected account, linked where known to the Postkub post target it belongs to. Scopes: comment:read. CLI: postkub threads list (alias postkub inbox list). MCP: threads_list.

Query parameters

NameTypeRequiredDescription
limitintegerNoPage size, 1-100, default 50
cursorstringNoOpaque cursor from nextCursor, max 512 characters
handledstringNotrue for handled threads, false for open threads
accountIdstringNoRepeatable account filter; pass the parameter once per account ID
postTargetIdstringNoOnly threads linked to this post target; the literal none selects threads with no linked post
socialPostIdstringNoOnly threads linked to this discovered post; the literal none selects unlinked threads

Request example

curl -sS "https://postkub.com/api/v1/threads?handled=false&limit=50" \
  -H "Authorization: Bearer <API_KEY>"

Response 200 OK

{
  "requestId": null,
  "items": [
    {
      "id": "thread_example123",
      "socialAccountId": "acc_example1",
      "brandId": "brand_example1",
      "provider": "meta",
      "platform": "facebook",
      "providerThreadId": "17841400000000001",
      "postTargetId": "target_example123",
      "status": "open",
      "revision": 3,
      "lastCommentAt": "2026-12-04T07:20:00.000Z",
      "unreadCount": 2,
      "createdAt": "2026-12-01T10:05:00.000Z"
    }
  ],
  "nextCursor": null
}

status is open or handled; revision is the optimistic-concurrency version you must send back when updating state. See Pagination for cursor rules.

StatusMeaning
200Thread page returned
400Invalid query (see Errors)
401Authentication required
403Key lacks comment:read

Summarize the inbox by post

GET /api/v1/inbox/posts

Folds the visible threads into one bucket per linked post so an agent can show a Buffer-style by-post inbox view. Threads with no known linked post land in a bucket whose postTargetId is null, and posts with zero comments still appear, so nothing in the inbox becomes invisible. Not available as a CLI command or MCP tool. Scopes: comment:read.

Query parameters

NameTypeRequiredDescription
handledstringNotrue counts only handled threads, false only open threads
accountIdstringNoRepeatable account filter; pass the parameter once per account ID

Request example

curl -sS "https://postkub.com/api/v1/inbox/posts" \
  -H "Authorization: Bearer <API_KEY>"

Response 200 OK

{
  "requestId": null,
  "items": [
    {
      "postTargetId": "target_example123",
      "postId": "post_example123",
      "accountId": "acc_example1",
      "caption": "New menu launched this week",
      "mediaUrl": "https://cdn.example.com/media/abc.jpg",
      "permalink": "https://www.facebook.com/acme/posts/123",
      "commentCount": 12,
      "unreadCommentCount": 3,
      "openThreadCount": 5,
      "handledThreadCount": 7,
      "lastCommentAt": "2026-12-04T07:20:00.000Z"
    }
  ],
  "nextCursor": null
}

postTargetId is null for threads without a known post; pass the literal none as the postTargetId filter on GET /api/v1/threads to page through exactly that bucket. openThreadCount counts threads still unanswered. nextCursor is always null today: the whole matching set is returned, and pagination arrives only when tenant volume demands it.

StatusMeaning
200Per-post summary returned
400Invalid query (see Errors)
401Authentication required
403Key lacks comment:read

Read one thread

GET /api/v1/threads/{id}

Returns one thread with its comments, oldest first, up to 200 comments. Scopes: comment:read. CLI: postkub threads get. MCP: threads_get.

Parameters

NameInTypeRequiredDescription
idpathstringYesThread ID

Request example

curl -sS https://postkub.com/api/v1/threads/thread_example123 \
  -H "Authorization: Bearer <API_KEY>"

Response 200 OK

{
  "requestId": null,
  "thread": {
    "id": "thread_example123",
    "socialAccountId": "acc_example1",
    "brandId": "brand_example1",
    "provider": "meta",
    "platform": "facebook",
    "providerThreadId": "17841400000000001",
    "postTargetId": "target_example123",
    "status": "open",
    "revision": 3,
    "lastCommentAt": "2026-12-04T07:20:00.000Z",
    "unreadCount": 2,
    "createdAt": "2026-12-01T10:05:00.000Z"
  },
  "comments": [
    {
      "id": "comment_example123",
      "threadId": "thread_example123",
      "parentCommentId": null,
      "provider": "meta",
      "providerCommentId": "17841400000000002",
      "authorProviderId": "user_98765",
      "authorName": "Somchai J.",
      "authorHandle": "@somchai",
      "text": "When does this restock?",
      "unread": true,
      "ownerLikedAt": null,
      "providerCreatedAt": "2026-12-04T07:19:30.000Z",
      "createdAt": "2026-12-04T07:19:31.000Z"
    }
  ]
}

ownerLikedAt is the timestamp when the connected account liked that comment, or null. A thread outside the key's scope answers the same 404 as a missing one.

StatusMeaning
200Thread with comments returned
400Invalid thread ID (see Errors)
401Authentication required
403Key lacks comment:read
404Thread missing or outside the key's scope

Update thread state

PATCH /api/v1/threads/{id}

Marks a thread handled or unhandled and/or marks its comments read or unread. This is a guarded mutation: it requires an Idempotency-Key header and the thread's current revision. Scopes: thread:resolve for handled; thread:update for unread. CLI: postkub threads update (alias postkub threads resolve for handled-only updates). MCP: threads_update, or threads_resolve for handled-only updates.

Parameters

NameInTypeRequiredDescription
idpathstringYesThread ID
Idempotency-KeyheaderUUIDYesStable client UUID; repeat the same UUID after a lost response
expectedRevisionbodyintegerYesCurrent thread revision; minimum 1
handledbodybooleanWith unreadtrue marks handled, false reopens
unreadbodybooleanWith handledtrue marks the thread's comments unread, false marks them read

Send at least one of handled or unread; both may be sent together.

Request example

curl -sS -X PATCH https://postkub.com/api/v1/threads/thread_example123 \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Idempotency-Key: 3f9d1c2e-5a47-4b08-9c1d-2e3f4a5b6c7d" \
  -H "Content-Type: application/json" \
  -d '{"expectedRevision": 3, "handled": true}'

Response 200 OK

{
  "requestId": "3f9d1c2e-5a47-4b08-9c1d-2e3f4a5b6c7d",
  "threadId": "thread_example123",
  "revision": 4,
  "status": "handled",
  "unreadCount": 0,
  "handledAt": "2026-12-04T08:00:00.000Z",
  "replayed": false
}

Setting handled to false resets handledAt to null. The unread flag applies to every comment in the thread at once. An identical replay returns the stored receipt with replayed: true; see Idempotency.

StatusMeaning
200State updated (or identical replay returned)
400Validation error or bad header (see Errors)
401Authentication required
403Key lacks thread:resolve or thread:update for the requested change
404Thread missing or outside the key's scope
409REVISION_CONFLICT (stale expectedRevision, with error.details.currentRevision), IDEMPOTENCY_CONFLICT, or LOCK_TIMEOUT

List comments

GET /api/v1/comments

Lists comments newest first, with optional account, thread, and unread filters. Scopes: comment:read. CLI: postkub comments list. MCP: comments_list.

Query parameters

NameTypeRequiredDescription
limitintegerNoPage size, 1-100, default 50
cursorstringNoOpaque cursor from nextCursor, max 512 characters
unreadstringNotrue for unread comments only, false for read only
threadIdstringNoOnly comments in this thread
accountIdstringNoSingle account ID filter

Request example

curl -sS "https://postkub.com/api/v1/comments?unread=true&limit=50" \
  -H "Authorization: Bearer <API_KEY>"

Response 200 OK

{
  "requestId": null,
  "items": [
    {
      "id": "comment_example123",
      "threadId": "thread_example123",
      "parentCommentId": null,
      "provider": "meta",
      "providerCommentId": "17841400000000002",
      "authorProviderId": "user_98765",
      "authorName": "Somchai J.",
      "authorHandle": "@somchai",
      "text": "When does this restock?",
      "unread": true,
      "ownerLikedAt": null,
      "providerCreatedAt": "2026-12-04T07:19:30.000Z",
      "createdAt": "2026-12-04T07:19:31.000Z"
    }
  ],
  "nextCursor": null
}

A threadId that is unknown or outside the key's scope returns an empty page, not an error.

StatusMeaning
200Comment page returned
400Invalid query (see Errors)
401Authentication required
403Key lacks comment:read

Reply to a comment

POST /api/v1/comments/{id}/replies

Accepts a durable reply to be published by the worker as the connected account. 202 Accepted means the reply was accepted as asynchronous work - it is never a provider success confirmation; the durable outcome arrives via the status URL. Scopes: comment:reply. CLI: postkub comments reply. MCP: comments_reply.

Parameters

NameInTypeRequiredDescription
idpathstringYesComment ID to reply to
Idempotency-KeyheaderUUIDYesStable client UUID; repeat the same UUID after a lost response
messagebodystringYesReply text, 1-2200 characters after trimming

Request example

curl -sS -X POST https://postkub.com/api/v1/comments/comment_example123/replies \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Idempotency-Key: 5c2e8f90-1a34-4e67-b2a9-0d8c7b6a5f4e" \
  -H "Content-Type: application/json" \
  -d '{"message": "It restocks next Monday - thank you for asking!"}'

Response 202 Accepted

{
  "requestId": "5c2e8f90-1a34-4e67-b2a9-0d8c7b6a5f4e",
  "replyId": "reply_example123",
  "commentId": "comment_example123",
  "threadId": "thread_example123",
  "socialAccountId": "acc_example1",
  "revision": 1,
  "state": "pending",
  "statusUrl": "/api/v1/replies/reply_example123",
  "replayed": false
}

The reply is capability-gated per account: a provider or platform without a qualified reply capability fails closed with 422 before anything is dispatched. Poll statusUrl to follow execution; the worker retries transient failures within a budget of 5 attempts and a 24-hour processing deadline.

StatusMeaning
202Reply accepted as async work; poll the status URL
400Validation error or bad header (see Errors)
401Authentication required
403Key lacks comment:reply
404Comment missing or outside the key's scope
409IDEMPOTENCY_CONFLICT (same UUID reused with a different payload)
422ACCOUNT_NOT_ACTIVE, PROVIDER_CAPABILITY_UNAVAILABLE, or PLATFORM_NOT_SUPPORTED - nothing was dispatched

Check reply status

GET /api/v1/replies/{id}

Returns a reply's execution state and its attempt history. Scopes: comment:read. CLI: postkub replies get. MCP: replies_get.

Parameters

NameInTypeRequiredDescription
idpathstringYesReply ID from the acceptance response

Request example

curl -sS https://postkub.com/api/v1/replies/reply_example123 \
  -H "Authorization: Bearer <API_KEY>"

Response 200 OK

{
  "requestId": "5c2e8f90-1a34-4e67-b2a9-0d8c7b6a5f4e",
  "replyId": "reply_example123",
  "commentId": "comment_example123",
  "threadId": "thread_example123",
  "socialAccountId": "acc_example1",
  "revision": 2,
  "state": "sent",
  "text": "It restocks next Monday - thank you for asking!",
  "providerReplyId": "17841400000000099",
  "attemptCount": 1,
  "attemptBudget": 5,
  "nextAttemptAt": null,
  "lastErrorCode": null,
  "lastErrorMessage": null,
  "sentAt": "2026-12-04T08:00:10.000Z",
  "attempts": [
    {
      "attemptNumber": 1,
      "state": "succeeded",
      "requestStartedAt": "2026-12-04T08:00:09.000Z",
      "finishedAt": "2026-12-04T08:00:10.000Z",
      "providerReplyId": "17841400000000099",
      "errorCode": null,
      "errorMessage": null,
      "outcomeSource": null
    }
  ]
}

state is one of pending, queued, processing, outcome_unknown, needs_review, blocked, sent, failed. Treat outcome_unknown and needs_review as requiring human attention; never re-reply with a new idempotency key on top of an uncertain outcome (see Idempotency). Up to 20 most recent attempts are returned.

StatusMeaning
200Reply status and attempts returned
400Invalid reply ID (see Errors)
401Authentication required
403Key lacks comment:read
404Reply missing or outside the key's scope

Like or unlike a comment

POST /api/v1/comments/{id}/like
DELETE /api/v1/comments/{id}/like

Adds or removes the connected account's like on a comment directly on the provider. This is a web dashboard session action: API keys are rejected with 403, and there is no CLI command or MCP tool. Scopes: any authenticated web session; no API-key action exists for likes.

Parameters

NameInTypeRequiredDescription
idpathstringYesComment ID

Request example

# Session-cookie action: sign in through the web dashboard, not an API key.
curl -sS -X POST https://postkub.com/api/v1/comments/comment_example123/like \
  -b session.txt

Response 200 OK

{
  "requestId": null,
  "commentId": "comment_example123",
  "liked": true
}

The reaction is one-way: it appears on the provider immediately, and provider reaction state is never synced back. Repeating a call in the same direction is a no-op, which is what makes retrying after an ambiguous timeout safe. Liking follows the same capability gate as replies, plus a per-provider like capability.

StatusMeaning
200Liked or unliked (same-direction repeats are no-ops)
400Invalid comment ID (see Errors)
401Authentication required
403API keys do not carry this action (ACTION_NOT_AVAILABLE_FOR_KEYS); sign in with a web session
404Comment missing or outside the caller's scope
409CREDENTIAL_UNAVAILABLE, CREDENTIAL_EXPIRED, or ACCESS_TOKEN_EXPIRED - reconnect the channel
422ACCOUNT_NOT_ACTIVE, PROVIDER_CAPABILITY_UNAVAILABLE, PLATFORM_NOT_SUPPORTED, or LIKE_CAPABILITY_UNAVAILABLE
500CREDENTIAL_UNREADABLE
502PROVIDER_REQUEST_FAILED - the provider rejected the request
504PROVIDER_TIMEOUT - outcome is ambiguous; retrying the same like is safe