Skip to main content
The REST API lets your own scripts and tools read your account, channels, posts and analytics, and create or delete posts. It is the same data and the same checks you get in the app.
  • Base URL: your site address followed by /api/v1, for example https://your-site.example/api/v1.
  • Format: JSON in, JSON out.
  • Version: v1.
The API is a plan feature called API and webhooks. See API keys for how to make a key and what happens when your plan does not include the feature.

Quick start

1

Make a key

Create a key on the API keys page. Tick Can also create and remove posts if you want to create posts.
2

Find your channel ids

Call GET /channels and note the id of each channel you want to post to.
3

Create a post

Call POST /posts with some content and the channel ids.

Authentication

Send your key as a bearer token on every request:
Always send Accept: application/json. Without it, validation errors and missing records can come back as web pages or redirects instead of JSON. A key acts as the account that made it and only ever sees that account’s data. Another account’s post returns 404, as if it did not exist.

Rate limit

Each key can make 60 requests a minute. Beyond that the API answers 429 Too Many Attempts. with a Retry-After header that tells you how many seconds to wait. Successful responses carry X-RateLimit-Limit and X-RateLimit-Remaining.

Responses

A single record comes back as { "data": { ... } } and a list as { "data": [ ... ] }. The post list adds links and meta for paging. Times are ISO 8601 strings, and the API returns them in UTC (+00:00). DELETE /posts/{id} returns 204 with no body.

Endpoints

There is no endpoint to edit a post. To change one, delete it and create a new post, or edit it in the composer.

GET /me

Returns your account and details of the key you used.

GET /channels

Returns every channel you have connected, sorted by network and then name. There are no parameters and no paging.
Only channels with the status active accept new posts. See Connect channels.

GET /analytics

Returns headline figures for the posts you published in a period, the same numbers as the Analytics page. The key’s owner needs the Analytics feature, otherwise the API answers 403 with Analytics is not part of your plan.
Each post counts its most recent measurement, so a like is never counted twice. Figures depend on what each network reports. See Analytics.

GET /posts

Lists your posts, newest first. Each item is a post object. The response also holds links (first, last, prev, next) and meta (current_page, last_page, per_page, total and more).

GET /posts/{id}

Returns one post as a post object, with its media and the result for each channel. Posts that are not yours, and posts that were deleted, answer 404.

POST /posts

Creates one post for one or more channels. The post goes through the same checks as the composer. See Composer.

When the post goes out

MagicPost reads the timing fields in this order and uses the first one that is set:
If your team requires sign-off, a post that would be scheduled or published goes to pending_approval instead and waits for a reviewer. It is not sent until someone approves it. Drafts never need review. See Approval workflow.

Limits of API posts

Every channel receives the same content and the network’s default post type, with no per-channel text or options. A channel that requires an option the API cannot send answers with an option_required violation. Use the composer for those posts. media_urls accepts JPG, PNG and GIF pictures up to 5 MB, on a public https address.

Example

The response is 201 Created with the new post object.

DELETE /posts/{id}

Removes a post from MagicPost and cancels what is still waiting to go out. Channel results that are pending, scheduled, paused or failed are skipped. A recurring post also cancels its upcoming occurrences. Anything already published stays on the network, because the API does not delete posts there. The response is 204 No Content. A post that is not yours answers 404.

Objects

The post object

Each entry in targets: media and targets are included on every endpoint that returns a post.

Errors

Errors are JSON with a message.

Validation errors

Composer errors

When a post breaks a channel’s rules, violations lists the problems per channel id. Each has a rule code and a readable message.
Other 422 messages for POST /posts have an empty violations list or none at all: A problem while saving a picture, such as running out of media storage, comes back as a 422 with its own message.

Webhooks and the API

Instead of polling GET /posts/{id}, you can receive an event the moment a post is published, fails or needs attention. See Webhooks.

API keys

Make, use and revoke keys.

Webhooks

Receive events instead of polling.