Post, measure and manage social accounts from your code
The Contentee API lets you list a profile's social media accounts, read their statistics, and publish or schedule posts to each network. It's written for developers and coding agents integrating with Contentee.
https://api.contentee.aix-api-key header, one key per profile{ "error": "…" }Contents
Concepts
- Profile
- One brand or workspace in Contentee. Every API key belongs to exactly one profile, and every request acts on that profile.
- Account
- A destination on a social network: a LinkedIn person or company page, a Facebook Page, a Pinterest board, a YouTube channel, a subreddit. A profile can have several accounts on the same network.
- Default account
- Each network has one default account per profile. A post that doesn't name an account goes to the default.
- Account id
- Contentee's opaque id for an account. The same id is used in every endpoint. It's not the network's own id for the account.
People connect accounts in the Contentee web app. The API can't connect accounts.
Authentication
Every request uses one key: the profile's API key, sent in the x-api-key header. The same key works for posting, listing accounts, checking post status and reading statistics.
x-api-key: <profile API key>| Where to get it | Contentee → Profile settings → API key. Only the profile's owner can see and rotate it. |
| Scope | One profile. Don't send x-profile-id: the stats endpoints ignore it, and the posting endpoints refuse a request where it names a different profile. |
| Rotation | Rotating the key invalidates the old one immediately. |
| Errors | 401 means a missing or invalid key. Stop and alert a person. Don't retry. |
Logged in to Contentee? Every endpoint below has a Try it button. It sends the request for the profile you pick at the top of the page, using your login, so you never paste the key into this page.
Listing accounts
There are two ways to list accounts, and both return the same account ids. Use this one to find accounts you can post to with POST /api/posts. To find X, TikTok and Reddit accounts, or to check whether a connection is broken, use GET /api/v1/stats/accounts.
Lists the profile's accounts on facebook, instagram, linkedin, pinterest and youtube. Filter with ?platform=. An invalid platform returns 400.
GET /api/accounts?platform=linkedin
x-api-key: <profile API key>{
"accounts": [
{ "id": "cmf1a...", "platform": "linkedin", "handle": "Acme Inc", "isDefault": true },
{ "id": "cmf1b...", "platform": "linkedin", "handle": "Jane Doe", "isDefault": false }
]
}Which accounts appear
An account appears only if a person added it to this profile in the web app. When someone connects a login with access to several accounts, such as a LinkedIn person and their company pages, only the accounts they tick are added. The rest are never listed and can't be posted to.
Statistics
The statistics endpoints are read-only. Numbers are collected from the networks periodically, not live: lastCollectedAt and metricsFetchedAt say how fresh they are.
null means the network doesn't report that number, or nothing has been collected yet. 0 means it's known to be zero. Show null as "not available", never as 0.fromandtoareYYYY-MM-DD, inclusive, in the profile's time zone (profile.timeZone). The maximum range is 366 days.400means bad parameters, and the message says which.401means a bad key. An unknown path returns404.
Lists every account Contentee reports stats for: LinkedIn, Pinterest, YouTube, Facebook, Instagram, Reddit, TikTok and X. Without from and to you get the account list only. With them, each account also gets totals, posts and days. Send both or neither.
GET /api/v1/stats/accounts?from=2026-11-01&to=2026-11-24
x-api-key: <profile API key>{
"profile": { "id": "cm...", "name": "Acme", "timeZone": "Europe/Stockholm" },
"generatedAt": "2026-11-25T10:00:00.000Z",
"accounts": [
{
"id": "cmf1a...",
"network": "linkedin",
"handle": "Acme Inc",
"name": "Acme Inc",
"url": "https://www.linkedin.com/company/acme",
"status": "connected",
"lastCollectedAt": "2026-11-25T03:00:00.000Z",
"urn": "urn:li:organization:12345",
"totals": {
"followers": 1520, "followersGained": 34, "impressions": 18200,
"reach": 9100, "engagements": 640, "videoViews": null, "linkClicks": 210
},
"totalsBasis": "daily",
"posts": { "published": 12, "scheduled": 3 },
"days": [
{ "date": "2026-11-01", "followers": 1486, "impressions": 700, "reach": 350,
"engagements": 22, "videoViews": null, "linkClicks": 8 }
]
}
]
}Fields
| Field | Meaning |
|---|---|
network | linkedin, pinterest, youtube, facebook, instagram, reddit, tiktok or x. |
handle | The name people recognise. For Reddit it's r/<name> or u/<name>. name is the display name and url the public profile. |
urn | LinkedIn only: urn:li:organization:<id> for a company page, urn:li:person:<id> for a person. What a mention links to. For a company page, name is its LinkedIn name, the exact words a mention must use. |
status | connected or broken. A broken account must be reconnected in Contentee, and posts to it fail until it is. |
totals.followers | Followers on the last collected day at or before to. followersGained is last day minus first day, or null with fewer than two days. |
totalsBasis | "daily": totals come from the network's per-day numbers and days[] is filled in. "posts": totals are summed from posts in the range, and the activity fields in days[] are null. |
posts | published in the range, and scheduled after now. |
Returns the top posts in a date range, sorted highest first with nulls last. Ties go newest first. There's no pagination, so narrow the range or filter by account to see more.
| Param | Values | |
|---|---|---|
from, to | Required | YYYY-MM-DD |
sort | Optional | impressions (default), engagements (likes + comments + shares + saves), linkClicks, publishedAt |
limit | Optional | 1–50, default 10 |
accountId | Optional | An account id. Repeat it for several accounts. Without it, all accounts are included. |
GET /api/v1/stats/posts?from=2026-11-01&to=2026-11-24&sort=engagements&limit=50&accountId=cmf1a...
x-api-key: <profile API key>{
"posts": [
{
"id": "cmp9...",
"accountId": "cmf1a...",
"network": "linkedin",
"url": "https://www.linkedin.com/feed/update/urn:li:share:7.../",
"publishedAt": "2026-11-12T08:00:00.000Z",
"text": "First 280 characters of the caption as plain text…",
"thumbnailUrl": "https://…",
"metrics": {
"impressions": 2400, "views": null, "likes": 51, "comments": 6,
"shares": 4, "saves": null, "linkClicks": 38
},
"metricsFetchedAt": "2026-11-24T03:00:00.000Z"
}
]
}What each network reports
Account level: totals and days
| Network | totalsBasis | followers | impressions | reach | engagements | videoViews | linkClicks |
|---|---|---|---|---|---|---|---|
| LinkedIn company page | daily | ✓ | ✓ | ✓ | ✓ | null | ✓ |
| LinkedIn personal profile | posts | null | null | null | null | null | null |
| daily | ✓ | ✓ | null | ✓ | ✓ | ✓ | |
| YouTube | posts | ✓ | null | null | ✓ | ✓ | null |
| posts | ✓ | null | null | ✓ | null | null | |
| posts | ✓ | null | null | ✓ | null | null | |
| posts | null | null | null | ✓ | null | null | |
| TikTok | posts | null | null | null | null | null | null |
| X | posts | null | null | null | null | null | null |
Post level: metrics
| Network | impressions | views | likes | comments | shares | saves | linkClicks |
|---|---|---|---|---|---|---|---|
| LinkedIn company page | ✓ | null | ✓ | ✓ | ✓ | null | ✓ |
| LinkedIn personal profile | null | null | null | null | null | null | null |
| ✓ | ✓ | null | null | null | ✓ | ✓ | |
| YouTube | null | ✓ | ✓ | ✓ | null | null | null |
| null | null | ✓ | ✓ | ✓ | null | null | |
| null | null | ✓ | ✓ | null | null | null | |
| null | null | ✓ | ✓ | null | null | null | |
| TikTok | null | null | null | null | null | null | null |
| X | null | null | null | null | null | null | null |
LinkedIn personal profiles, TikTok and X are listed with their post counts, but no metrics are collected for them.
Posting
There are two posting endpoints. For a posting system that has to be reliable, use POST /api/posts wherever the network is supported. Use POST /api/distribute for X, TikTok, Reddit and Discord, or when you want Contentee to write the text.
| POST /api/posts | POST /api/distribute | |
|---|---|---|
| Text | Published exactly as sent | AI writes a post per network, unless you pass platformText |
| Networks | Facebook, Instagram, LinkedIn, Pinterest, YouTube | Those five plus X, TikTok, Reddit, Discord |
| Per call | One post to one account | One post per network or per chosen account |
| Idempotent | Yes, with Idempotency-Key | No. Retrying creates duplicates |
| Scheduling | Now or at scheduledAt, up to 90 days ahead | Now or at scheduledAt |
| Status | GET /api/posts?reference=. Cancel with DELETE | results[] in the response only |
Publishes one post to one account, with the text exactly as sent, now or at a time you choose. Publishing happens in the background, so the response is 202 and you poll for the result.
POST /api/posts
x-api-key: <profile API key>
Idempotency-Key: launch-2026-11-25-linkedin
Content-Type: application/json{
"platform": "linkedin",
"text": "Exactly what should be posted.\n\n#launch",
"rewrite": false,
"accountId": "cmf1a...",
"link": "https://acme.com/launch",
"title": "We just launched"
}| Field | Notes | |
|---|---|---|
Idempotency-Key header | Required | Your id for this post, at most 64 characters. Sending the same key again returns the same post with 200 and never creates a second one. |
platform | Required | facebook, instagram, linkedin, pinterest or youtube |
text | Required | Not empty. Never trimmed, rewritten or reformatted. |
rewrite | Required | Must be false. |
accountId | Optional | From GET /api/accounts. Without it, the post goes to the network's default account. |
scheduledAt | Optional | When to publish: an ISO 8601 time with an offset, such as 2026-12-01T14:30:00+07:00 or …Z. Omit it to publish now. See Scheduling. |
reference | Optional | If sent, must equal the Idempotency-Key. |
title | Optional | Used by YouTube, Pinterest and LinkedIn link cards. |
link | Optional | A public http(s) URL. How it's used depends on the network. |
imageUrl / videoUrl | Optional | Public http(s) URLs. Send one or the other, not both. Contentee downloads and uploads them. |
thumbnailUrl | Optional | Only together with videoUrl. |
mentions | Optional | LinkedIn only. Words in text to turn into clickable tags of company pages or people. See LinkedIn mentions. |
accountId is set, the post goes to that account or fails. It never falls back to another account.Responses
202 | Accepted and queued, or scheduled. |
200 | This Idempotency-Key was already used. You get the existing post. |
400 | Nothing was created. Causes: a validation error, the network isn't connected, accountId isn't one of this profile's accounts on that network, several accounts with no default and no accountId, the plan's post limit is reached, scheduledAt is in the past, more than 90 days ahead or has no offset, a media URL couldn't be downloaded, or a mention is invalid. |
503 | Contentee couldn't check a mentioned page's name with LinkedIn just now. Nothing was created. Send the same request again. |
401 / 403 | Bad key or no access. Stop. |
The post object
{
"id": "cmp9...",
"reference": "launch-2026-11-25-linkedin",
"platform": "linkedin",
"status": "queued",
"scheduledAt": null,
"externalId": null,
"permalink": null,
"publishedAt": null,
"error": null,
"accountId": "cmf1a...",
"accountHandle": "Acme Inc",
"createdAt": "2026-11-25T10:00:00.000Z",
"updatedAt": "2026-11-25T10:00:00.000Z"
}scheduled: waiting forscheduledAt. Only posts sent withscheduledAtstart here. The rest start atqueued.queuedorprocessing: in progress. Keep polling.published: it's live, andexternalId,permalinkandpublishedAtare set.failed: it definitely wasn't posted.errorgives the reason in plain language.cancelled: a scheduled post that was cancelled. It will never be posted.
Scheduling
Add scheduledAt to publish later. The post is stored straight away with "status": "scheduled". At that time it publishes exactly like a post sent now: to the same account, with the same retries, ending as published or failed.
- Send an ISO 8601 time with an offset, such as
2026-12-01T14:30:00+07:00or…Z. A time without an offset is refused, so Contentee never guesses the time zone. - The time must be in the future and at most 90 days ahead. Otherwise you get
400and nothing is created. - Contentee downloads the image or video when it accepts the post, so a scheduled post doesn't depend on the link still working later. If the download fails, you get
400. - Idempotency is the same: sending the same key again returns the same post, whatever state it's in.
scheduledAtin the response is always UTC. It'snullfor a post sent now.
{
"platform": "linkedin",
"text": "Our December release is live.",
"rewrite": false,
"accountId": "cmf1a...",
"scheduledAt": "2026-12-01T14:30:00+07:00"
}{
"id": "cmp9...",
"reference": "december-release-linkedin",
"platform": "linkedin",
"status": "scheduled",
"scheduledAt": "2026-12-01T07:30:00.000Z",
"externalId": null,
"permalink": null,
"publishedAt": null,
"error": null,
"accountId": "cmf1a...",
"accountHandle": "Acme Inc",
"createdAt": "2026-11-25T10:00:00.000Z",
"updatedAt": "2026-11-25T10:00:00.000Z"
}LinkedIn mentions
On LinkedIn, a post can tag company pages and people, so that their name shows as a clickable link. The text is still published exactly as sent: mentions only says which words in it become tags.
{
"platform": "linkedin",
"accountId": "cmf1b...",
"text": "Our first video is out at Acme Inc. Thanks Jane Doe!",
"mentions": [
{ "text": "Acme Inc", "accountId": "cmf1a..." },
{ "text": "Jane Doe", "urn": "urn:li:person:AbC123" }
],
"rewrite": false
}| Field | Notes |
|---|---|
mentions | Up to 10 entries. Only with "platform": "linkedin". |
mentions[].text | The words in text that become the tag. Each mention takes the first place its words appear that no earlier mention has taken, so to tag a name twice, list it twice. |
mentions[].accountId | A LinkedIn company page connected to this profile (its id from GET /api/v1/stats/accounts). text must be the page's exact current LinkedIn name, including case. Contentee checks it with LinkedIn when it accepts the post. |
mentions[].urn | Instead of accountId: any urn:li:organization:<id> or urn:li:person:<id>, for pages and people not connected to Contentee. Their names can't be checked, and LinkedIn shows a company mention as plain text unless text is the page's exact name. |
You get 400, and nothing is created, when mentions is sent for another network, a mention's words aren't in text, an entry has both or neither of accountId and urn, the accountId isn't a LinkedIn company page of this profile, or the words aren't the page's exact LinkedIn name (the error gives the name). The post object then has a mentions list showing what was tagged, with each URN.
Post types per network
What gets posted with POST /api/posts depends on which media fields you send. Character limits count characters as people see them (an emoji is 1), except YouTube's description, which counts bytes. Text that's too long is refused, never shortened.
| Network | You send | Result | Limits |
|---|---|---|---|
text | Text post | 3,000 chars | |
+ link | Link card, titled by title or the link | ||
+ imageUrl | Image post (link ignored) | ||
+ videoUrl | Video post (link ignored) | ||
text | Text post | 63,206 chars | |
+ link | Link preview | ||
+ imageUrl | Photo post (link ignored) | ||
+ videoUrl | Reel (link ignored) | ||
text + imageUrl | Feed image post | 2,200 chars, 30 hashtags. Media required. link ignored. | |
text + videoUrl | Reel, thumbnailUrl as cover | ||
text + imageUrl | Image pin | Description 500, title 100, link 2,048. Media required. accountId is a board. | |
text + videoUrl | Video pin | ||
| YouTube | text + videoUrl | Video upload | Description 5,000 bytes, title 100 chars, no < or >. Video required. |
Without a title, YouTube uses the first non-empty line of text. A custom thumbnailUrl is best effort: channels without permission still get the video, without the thumbnail.
Returns the post created with that key, as { "posts": [ … ] }. An empty list means the request never arrived, so it's safe to send it again with the same key. A post that was accepted is always found here, even if its request ended in a 5xx.
Recommended client loop
- Generate a unique
Idempotency-Keyper post and store it. - Send
POST /api/posts. On a timeout, network error or 5xx, send the same request with the same key again. Retrying is always safe. - Poll
GET /api/posts?reference=<key>every 30–60 seconds until the status ispublishedorfailed. A scheduled post staysscheduleduntil its time, so start polling then. - On a
400, don't retry unchanged. Show theerrorto a person, or fix the input.
Cancels a scheduled post before its time comes. Once the post has started, it can no longer be cancelled.
DELETE /api/posts?reference=december-release-linkedin
x-api-key: <profile API key>200 | Cancelled. You get the post, now with "status": "cancelled". |
409 | Too late: the post has already started (queued, processing, published or failed). Nothing changes. |
404 | No post has that reference. |
POST /api/posts again with the same Idempotency-Key returns the cancelled post. To post it after all, use a new key.Contentee writes a post per network from your article and publishes it now or at a scheduled time. The whole call uses one post from the plan's allowance, however many networks it reaches.
{
"title": "10 Tips for Better Social Media Marketing",
"content": "<h1>10 Tips</h1><p>Tip 1: …</p>",
"language": "en",
"platforms": ["linkedin", "twitter", "facebook", "tiktok"],
"socialAccountIds": ["cmf1a...", "cmf1b..."],
"url": "https://yourblog.com/social-media-tips",
"imageUrl": "https://cdn.example.com/featured.png",
"videoUrl": "https://cdn.example.com/promo.mp4",
"preferVideo": true,
"platformText": { "twitter": "Exact text for X" },
"scheduledAt": "2026-12-01T14:30:00",
"timezone": "Europe/Stockholm"
}| Field | Notes | |
|---|---|---|
title, content, language | Required | The article. content may be HTML. language is a code such as en or sv. |
platforms | Required | Any of linkedin, twitter (or x), facebook, instagram, youtube, tiktok, pinterest, reddit, discord. |
socialAccountIds | Optional | One post per listed account. Networks with none listed post to their default account. |
platformText | Optional | Exact text per network. Listed networks skip the AI rewrite. |
url | Optional | Inserted where links are clickable. Links to the profile's website get UTM tags. |
imageUrl, videoUrl | Optional | Type is detected from the file extension. Video: .mp4 .mov .webm .mkv .avi. Image: .png .jpg .jpeg .gif .webp .bmp .svg. |
preferVideo | Optional | With both media sent, video wins unless this is false. |
scheduledAt | Optional | Future ISO datetime. Without an offset it's read in timezone, then the owner's time zone, then UTC. Omit to publish now. |
topic, metaDescription, relatedKeywords | Optional | Help the AI. topic (or title) is the Reddit post title. |
Media per network
| Network | Text only | Image | Video |
|---|---|---|---|
| ✓ | ✓ | ✓ | |
| X | ✓ | ✓ | ✓ |
| ✓ | ✓ | ✓ | |
| — | ✓ | ✓ | |
| — | ✓ | ✓ | |
| ✓ | ✓ | ✓ | |
| Discord | ✓ | ✓ | ✓ |
| YouTube | — | — | Required |
| TikTok | — | — | Required |
YouTube and TikTok are skipped, not failed, when there's no video, and no quota is used. Account ids for X, TikTok and Reddit come from GET /api/v1/stats/accounts.
{
"groupId": "distribute_…",
"socialPostsCount": 3,
"scheduledCount": 0,
"skippedCount": 1,
"quotaExhausted": 0,
"scheduledAt": null,
"results": [
{ "platform": "linkedin", "socialAccountId": "cmf1a...", "ok": true, "postId": "cmp9..." },
{ "platform": "tiktok", "ok": false, "skipped": true, "error": "tiktok requires a video; skipped (no video supplied)" }
]
}ok: false with skipped: true means nothing was created for that network. ok: false without skipped is a failure, explained in error.
Quick reference
| Purpose | Request |
|---|---|
| List postable accounts | GET /api/accounts[?platform=] |
| List all accounts and their status | GET /api/v1/stats/accounts |
| Account stats for a range | GET /api/v1/stats/accounts?from=&to= |
| Top posts for a range | GET /api/v1/stats/posts?from=&to= |
| Publish one post verbatim | POST /api/posts |
| Schedule one post verbatim | POST /api/posts with scheduledAt |
| Tag LinkedIn pages or people | POST /api/posts with mentions |
| Cancel a scheduled post | DELETE /api/posts?reference= |
| Check a post's status | GET /api/posts?reference= |
| Publish an article to many networks | POST /api/distribute |