Back to Blog
TimeToPostREST APIcurlsocial media schedulingAPI examples

How to Schedule a Social Post with the TimeToPost REST API: a Worked curl Example

T
TimeToPost Team

TL;DR: To schedule a post with the TimeToPost REST API, create a personal token, send it as a Bearer header, and `POST /api/posts` with `content`, either `accountIds` or `platforms`, and a future ISO 8601 `scheduledAt`. A successful request returns `201` and a post with `status: "scheduled"` plus the scheduled time.

Prerequisites and what you need before you call the API

Before you schedule anything, create a personal API token in the dashboard under Settings → API and send it on every request as a Bearer token, like Authorization: Bearer ttp_your_token_here. The docs say tokens are shown exactly once when they are created, so copy yours right away. Also, scheduledAt has to be a future ISO 8601 timestamp. Past times get rejected, which is the API being annoyingly strict for your own good.

If you want a quick refresher on the surrounding scheduler behavior, the scheduling docs explain how TimeToPost treats future timestamps and post lifecycle states.

The minimal POST /api/posts shape

To schedule one post, send JSON to POST https://timetopost.co/api/posts with these parts:

  • content, the text of the post
  • target the post with either accountIds for specific connected accounts, or platforms for platform-level targeting like twitter or linkedin
  • mediaUrls, optional, for attached media
  • scheduledAt, to publish later

If you omit scheduledAt, the post is saved as a draft instead of being scheduled.

The API reference also notes that the REST API is the same API the web dashboard uses, so the same validation applies whether you click buttons or send JSON by hand.

Worked curl example: schedule one post

Here is a minimal example that schedules one post to a single connected account:

curl -X POST https://timetopost.co/api/posts \
  -H "Authorization: Bearer ttp_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Launching the new guide today. Please save your draft link and check the API docs if you need the exact payload.",
    "accountIds": ["cmb8x2k4p0001exampleaccountid"],
    "scheduledAt": "2026-07-01T15:00:00.000Z"
  }'

Line by line, what matters:

  • -X POST, tells curl to send a create request.
  • The URL points to https://timetopost.co/api/posts, which is the create-post endpoint in the REST API reference.
  • Authorization: Bearer ..., authenticates the request with your personal API token.
  • Content-Type: application/json, tells the API to read the body as JSON.
  • content, the post text TimeToPost will publish later.
  • accountIds, the connected account you want to post to. The docs say these are specific connected accounts, using integration ids from GET /api/integrations.
  • scheduledAt, the future publish time in ISO 8601 format. Use a future timestamp, not a timestamp from the archaeological layer.

If you prefer platform targeting instead of a specific account, the docs also allow platforms such as [ "twitter", "linkedin" ]. If you already have media uploaded, add mediaUrls as an array of public URLs. The media upload flow uses POST /api/media/presign, then a direct file upload, then the returned publicUrl in mediaUrls.

Verify the result in the API response

A successful create request returns HTTP 201 and the created post. For a scheduled post, look for two things in the response:

  • status: "scheduled"
  • the scheduledAt value you sent

That is the API confirming the post landed in the scheduler queue instead of being saved as a draft.

A response will look roughly like this, with your real ids and timestamps in place:

{
  "success": true,
  "post": {
    "id": "post_123456",
    "content": "Launching the new guide today. Please save your draft link and check the API docs if you need the exact payload.",
    "status": "scheduled",
    "scheduledAt": "2026-07-01T15:00:00.000Z"
  }
}

The docs also say post records include id, content, platforms, status, scheduledAt, publishedAt, and mediaUrls, so those are the fields to expect when you fetch posts back later.

Common mistakes that cause validation errors

For scheduling failures, the usual suspects are boring but effective:

  • scheduledAt is in the past, which the API rejects with a validation error
  • the Authorization header is missing or invalid, which returns a 401
  • the JSON body is malformed, so the server cannot parse the request

The docs also note that errors use conventional HTTP status codes and return a JSON body with success: false and a message. So if something breaks, check the status code first, then the message, then your JSON syntax before blaming the universe.

If you are migrating from another scheduler, what to export first

If you are moving queued work into TimeToPost, export the pieces that matter before you cancel anything: queued post details, media URLs, connected account IDs, and any settings you need to recreate. That is enough to rebuild the post queue in TimeToPost with POST /api/posts, and, when needed, the media flow through POST /api/media/presign.

You can also use the MCP overview if you want the same scheduling actions through an agent or MCP-compatible client instead of raw HTTP. Same backend, fewer thumbs on the keyboard.

Put these strategies into action

TimeToPost helps you schedule content, track performance, and grow your audience, all in one place.

No card for your first 3 posts. TimeToPost posts them at your best time.