PostMantis
API Reference

Overview

The mental model for profiles, posts, media, and the current public PostMantis API contract.

Start here for the API mental model.

What the API is for

PostMantis gives agents and backend systems one runtime API to publish and track delivery state for accounts already connected in the dashboard.

Scope

The runtime surface for agents, automations, and backend services:

  • profiles (read-only)
  • posts
  • media uploads

Account administration — only in the dashboard:

  • connect and manage social profiles
  • create and scope API keys
  • billing and settings

Also available here as a convenience:

  • create and publish posts manually

Resource model

TermMeaning
ProfileOne already-connected publishable destination in your account
PostThe top-level publishing workflow resource
DeliveryOne delivery intention created by pairing a post with a selected profile
Provider optionsProvider-specific write options grouped under the provider_options object
Delivery resultThe delivery outcome returned in deliveries[] when you read a post later

Profile

A profile is one already-connected publishable destination — a specific X account, LinkedIn page, YouTube channel, or Pinterest board already connected in the dashboard. Profiles are primarily read-oriented in the public API.

GET /api/profiles provides enough information to choose destinations. GET /api/profiles/{id} is optional. If you need to stop future use of a profile without deleting history, use POST /api/profiles/{id}/disconnect.

Post

A post is the main publishing workflow. It can be a draft, a scheduled post, or an immediate publish request.

A post may include body, media, selected profiles, and provider-specific parameters in provider_options.

When you create or publish a post, PostMantis expands it into one or more deliveries based on the selected profiles.

Media

Media can come from remote URLs, completed upload sessions, or direct multipart/form-data uploads on post create or update.

These are ingestion methods, not different downstream media models. Before PostMantis accepts a post, every supported media-like input is normalized into a PostMantis-owned asset. Downstream workflow and provider publishing then operate only on owned asset references.

Core semantics

Acceptance commands

These endpoints accept work and return non-terminal workflow state:

Terminal states appear only when you read the post later.

Why you may still see scheduled in the response

Non-draft writes enter pending first. The server then reads the post back before returning the response, so a fast worker may already advance the serialized response to scheduled.

POST /api/posts accepts both application/json and multipart/form-data. Use multipart when uploading local files directly.

post[body]                              post[scheduled_at]
profiles[]                              provider_options[provider][field]
media[n][file|url|asset_id|alt]

For each media[n], send exactly one of file, url, or asset_id.

Provider cover assets follow the same rule in multipart requests:

  • provider_options[youtube][cover][file|url|asset_id]
  • provider_options[instagram][cover][file|url|asset_id]
  • provider_options[pinterest][cover][file|url|asset_id]

API key scope is immutable. If you need different access later, revoke the old key and create a new one in the dashboard.

Post visibility is all-or-nothing: a key can read a post only when every delivery on that post is inside the key scope.

Common request flows

IntentRequestAccepted responseWhat happens next
Save a draft onlyPOST /api/posts with post.draft: truedraftStored, not submitted for delivery yet
Publish an existing draft nowPOST /api/posts/{id}/publish with empty bodypendingAccepted immediately, then the workflow advances to scheduled and dispatches as soon as possible
Publish an existing draft laterPOST /api/posts/{id}/publish with top-level scheduled_atpendingAccepted immediately, then the workflow advances to scheduled and waits until that future time
Create and publish nowPOST /api/posts without draft or post.scheduled_atpendingAccepted immediately, then the workflow advances to scheduled and dispatches as soon as possible
Create and schedule for laterPOST /api/posts with future post.scheduled_atpendingAccepted immediately, then the workflow advances to scheduled and waits until the future time
Cancel a scheduled postPOST /api/posts/{id}/cancelcanceledOnly works after the post reached scheduled and while every delivery is still pending

Non-draft writes are accepted into pending first. Later reads move to scheduled or completed once the publishing workflow advances the post.

Read endpoints

Publish retries

Delivery retries happen in the background workflow, not in the original write request. PostMantis currently uses up to 3 total attempts for delivery task executions that throw, with a simple fixed 60-second delay between retries.

Provider-level failures returned as explicit publish results are different. Those deliveries are finalized as failed and exposed on the post resource without another automatic attempt.

Intermediate retry attempts stay at the workflow-runtime layer. Current user-facing reads and the Publishing Log show domain events and final delivery outcomes, not every internal worker retry attempt as a separate event.

Cancellation

POST /api/posts/{id}/cancel is the only deletion-like write. Use it only for posts that already reached scheduled and have not started settling any delivery yet. Deleting post records or already-published provider content is intentionally not supported.

Status model

Post workflow

StatusMeaning
draftStored, not submitted for delivery
pendingAccepted and not yet advanced by the workflow
scheduledAdvanced by the workflow and now dispatchable or waiting for time
completedWorkflow orchestration finished
canceledCanceled before any delivery left pending

completed ≠ fully published

completed means workflow orchestration finished. Inspect deliveries[] for the true delivery results.

Delivery result

StatusMeaning
pendingDelivery not finished
publishedDelivery succeeded
failedDelivery ended unsuccessfully

Media

Media status is a lightweight readiness signal, not a full per-asset workflow log. Use post status, delivery status, and the Publishing Log to understand the primary publish state.

StatusMeaning
pendingThe post has not yet reached a later workflow state
processedThe post progressed to scheduled, completed, or canceled
failedThe stored media record carries an explicit failure marker

Naming rule of thumb

TermUse for
profilesChoosing where a post should go
provider_optionsSetting provider-specific request fields
deliveriesReasoning about one delivery path inside a post
delivery resultsInspecting which deliveries succeeded or failed