Open API documentation
Create drafts, publish, read metrics and manage accounts from your own app or agent. OpenAPI
Quick start
The API is included in Pro, Pro Plus, Max, Ultra and Ultra Plus at no extra charge. It is not available on the free plan. Sign in and create a key under Settings → Developer API. The key is shown only once.
Send the key with every request. A key belongs to one workspace and can only do what you selected.
curl https://app.xingyuzhitong.com/api/agent/v1/accounts \ -H "Authorization: Bearer $CONTENT_DISTRIBUTOR_API_KEY"
Test keys
Tick “Test key” when creating a key; it starts with cdk_test_. It can read data, upload media and create drafts. Publishing only runs checks and never posts. Other changes return 403.
Test keys read real workspace data, and the drafts and media they create are real. Calls count as usual.
Publish a post
1. Get an upload URL and upload the media (up to 100 MB per file; use multipart:true for larger files). Skip this for text-only posts.
2. Create a draft. Use a new Idempotency-Key (16–128 characters) for each draft and keep it when retrying, so the draft is never duplicated.
3. Publish. Check with dryRun first, then send again without it; add scheduledAt to schedule. Direct publishing must be enabled per platform by the workspace owner. Otherwise, or when the post targets a platform that needs personal confirmation such as TikTok, give reviewUrl to the user.
curl https://app.xingyuzhitong.com/api/agent/v1/media/upload-ticket \
-H "Authorization: Bearer $CONTENT_DISTRIBUTOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename":"photo.jpg","mime":"image/jpeg","size":348211}'
curl --upload-file photo.jpg "<uploadUrl>"curl https://app.xingyuzhitong.com/api/agent/v1/drafts \
-H "Authorization: Bearer $CONTENT_DISTRIBUTOR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 4f1c2a9e7b5d4e0c8a61" \
-d '{"contentText":"Hello","platformTargets":["<accountId>"],"mediaIds":["<mediaId>"]}'curl https://app.xingyuzhitong.com/api/agent/v1/posts/<postId>/publish \
-H "Authorization: Bearer $CONTENT_DISTRIBUTOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"dryRun":true}'Publish notifications (Max, coming soon)
Coming soon: publish notifications are not enabled yet. The details below are published in advance so you can prepare; the related endpoints return an error until it opens.
About a minute after a post goes out on a platform (post.target.published) or needs attention (post.target.attention), we POST to your https endpoint. It contains only ids, a link and a result code.
Reply 2xx within 5 seconds; redirects are not followed. Failed deliveries are retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours. After failing for a full day (at least 30 times) the endpoint is disabled; delete and recreate it to resume. Deliveries may repeat, so deduplicate by id.
Verify the signature with the secret returned on creation, using the raw request body:
{
"id": "8d0f…:complete",
"type": "post.target.published",
"occurredAt": "2026-12-01T08:00:12.000Z",
"workspaceId": "…",
"postId": "…",
"targetId": "…",
"accountId": "…",
"platform": "bluesky",
"platformPostId": "…",
"url": "https://…",
"code": null
}import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(secret, signatureHeader, rawBody) {
const match = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(signatureHeader ?? "");
if (!match) return false;
if (Math.abs(Date.now() / 1000 - Number(match[1])) > 300) return false;
const expected = createHmac("sha256", secret)
.update(match[1] + "." + rawBody)
.digest();
return timingSafeEqual(expected, Buffer.from(match[2], "hex"));
}Use with AI agents (MCP)
The same operations are available over remote MCP. Only tools the key may use are listed.
claude mcp add --transport http content-distributor https://app.xingyuzhitong.com/api/agent/mcp \ --header "Authorization: Bearer $CONTENT_DISTRIBUTOR_API_KEY"
Rate limits
Per UTC day: Pro 1,000, Pro Plus 5,000, Max 20,000, Ultra 50,000, Ultra Plus 100,000, counted together for the workspace owner. Halved during the first 7 days after sign-up. At most 60 writes per minute.
Responses include X-RateLimit-Limit-Day, X-RateLimit-Remaining-Day and X-Request-Id. Plan limits on posts, storage and accounts apply to the API too.
Endpoints
Base URL: https://app.xingyuzhitong.com/api/agent/v1
GET /accounts
List connected accounts
Scope
cd.accounts.read· Test key: YesPOST /recommend-platforms
Suggest platforms and accounts for a piece of content
Scope
cd.accounts.read· Test key: YesGET /usage
Read plan limits and usage
Scope
cd.accounts.read· Test key: YesGET /connect-link
Get a web link where the user connects a new account
Scope
cd.connect.start· Test key: NoPATCH /accounts/{accountId}
Enable or disable an account (owners and admins)
Scope
cd.accounts.manage· Test key: NoGET /accounts/{accountId}/insights
Account metrics: 7 days; 28 days needs Pro Plus
Scope
cd.analytics.read· Test key: YesGET /accounts/{accountId}/posts
Recent posts on the platform with metrics
Scope
cd.analytics.read· Test key: YesGET /groups
List account groups
Scope
cd.accounts.manage· Test key: YesPOST /groups
Create a group
Scope
cd.accounts.manage· Test key: NoPATCH /groups/{groupId}
Update a group
Scope
cd.accounts.manage· Test key: NoDELETE /groups/{groupId}
Delete a group
Scope
cd.accounts.manage· Test key: NoPOST /media/upload-ticket
Get a one-time upload URL
Scope
cd.media.write· Test key: YesPOST /drafts
Create a draft (Idempotency-Key required)
Scope
cd.posts.draft· Test key: YesGET /posts
List posts
Scope
cd.posts.read· Test key: YesGET /posts/{postId}
Read one post and its status on each platform
Scope
cd.posts.read· Test key: YesPATCH /posts/{postId}
Edit a draft (send the latest updatedAt)
Scope
cd.posts.draft· Test key: NoDELETE /posts/{postId}
Delete a draft; never deletes published content
Scope
cd.posts.draft· Test key: NoPOST /posts/{postId}/publish
Publish a draft now or on schedule; dryRun only checks
Scope
cd.posts.publish· Test key: Checks onlyPOST /posts/{postId}/reschedule
Change the scheduled time
Scope
cd.posts.publish· Test key: NoPOST /posts/{postId}/cancel
Cancel a scheduled post
Scope
cd.posts.publish· Test key: NoPOST /posts/{postId}/reopen
Turn a cancelled post back into a draft
Scope
cd.posts.draft· Test key: NoGET /posts/{postId}/metrics
Metrics of one post on each platform
Scope
cd.posts.read· Test key: YesGET /analytics
Content overview
Scope
cd.posts.read· Test key: YesGET /publishing-stats
Daily publishing stats: 7 days; 28 days or more needs Pro Plus
Scope
cd.analytics.read· Test key: YesGET /webhooks
List notification endpoints (Max; coming soon)
Scope
cd.webhooks.manage· Test key: YesPOST /webhooks
Add a notification endpoint (Max; coming soon)
Scope
cd.webhooks.manage· Test key: NoDELETE /webhooks/{webhookId}
Remove a notification endpoint (coming soon)
Scope
cd.webhooks.manage· Test key: NoGET /workspaces
List the workspaces you can act on; a key is bound to one workspace and lists only that one
Scope
cd.accounts.read· Test key: YesGET /dashboard
Overview: counts of posts needing attention, waiting for a platform and scheduled today, plus open alerts; pass dayStart and dayEnd (ISO 8601 with time zone) to define “today”
Scope
cd.posts.read· Test key: YesGET /alerts
Problems found after publishing: content that was later removed or is no longer visible on the platform (up to 100 open ones)
Scope
cd.posts.read· Test key: YesPOST /alerts/{targetId}/resolve
Mark an alert as handled; this only changes our record and never touches the platform
Scope
cd.posts.draft· Test key: NoGET /media
List uploaded images and videos in the media library, newest first, with paging (page, limit)
Scope
cd.media.write· Test key: YesDELETE /media/{mediaId}
Delete a media item from the library. This cannot be undone; media still used by a draft or a publish task cannot be deleted (409). Published content is not affected
Scope
cd.media.write· Test key: NoPOST /posts/{postId}/targets/{targetId}/retry
Retry a failed platform target (failed status only), with the same requirements as publishing. If the previous outcome is unknown, send confirmDuplicateRisk:true to accept a possible duplicate; not available for platforms the user must confirm in person, such as TikTok
Scope
cd.posts.publish· Test key: NoPOST /posts/{postId}/targets/{targetId}/delete-remote
Delete the published item on this one platform (published targets only). This cannot be undone; confirm:true is required, with the same requirements as publishing. TikTok, YouTube, Telegraph and Instagram are not supported (409)
Scope
cd.posts.publish· Test key: NoGET /analytics/summary
Metrics overview across accounts: 7 days; 28 days needs Pro Plus; without accountIds all accounts are read, up to 20 at a time; YouTube and X are not available through the API
Scope
cd.analytics.read· Test key: YesGET /analytics/content
Content performance: how content published through us did on each platform over the last 7 days; 28 and 90 days need Pro Plus; filter by platform or accountIds; YouTube and X posts are marked excluded
Scope
cd.analytics.read· Test key: YesGET /comments
Comment feed: recent comments from several accounts merged into one timeline, read live from the platforms and never stored. Not available on the free plan (402); only platforms with interactions enabled
Scope
cd.engagement.manage· Test key: YesGET /accounts/{accountId}/posts/{platformPostId}/comments
Read the comments under one post of an account on the platform; not available on the free plan (402)
Scope
cd.engagement.manage· Test key: YesPOST /accounts/{accountId}/comments/{commentId}/reply
Reply publicly to a comment as the account (text, 1–1000 characters). YouTube, Bluesky, Mastodon and Tumblr are read-only and return 409. Spam checks apply; not available on the free plan (402)
Scope
cd.engagement.manage· Test key: NoPOST /accounts/{accountId}/comments/{commentId}/hide
Hide or unhide a comment (hidden:true hides, false restores). Only on platforms that support it; others return 409. Not available on the free plan (402)
Scope
cd.engagement.manage· Test key: NoGET /accounts/{accountId}/conversations
List an account’s direct-message conversations, read live from the platform. Threads has no direct-message API and returns 409; not available on the free plan (402)
Scope
cd.engagement.manage· Test key: YesGET /accounts/{accountId}/conversations/{conversationId}/messages
Read the messages in one conversation; not available on the free plan (402)
Scope
cd.engagement.manage· Test key: YesPOST /accounts/{accountId}/conversations/{conversationId}/messages
Send a direct message as the account (recipientId and text required; text 1–1000 characters). Mastodon messages are read-only and return 409. Spam checks apply; not available on the free plan (402)
Scope
cd.engagement.manage· Test key: No
Common errors
Errors return { error: { code, message, statusCode } }. Include X-Request-Id when reporting a problem.
401 API_KEY_INVALID
The key is wrong. Revoked or expired keys return API_KEY_REVOKED or API_KEY_EXPIRED.
402 API_PLAN_REQUIRED
The workspace owner has no paid plan.
402 API_PLAN_UPGRADE_REQUIRED
This feature needs a higher plan.
403 insufficient_scope
The key does not have this scope.
403 API_TEST_KEY_NOT_ALLOWED
Test keys cannot do this.
403 AGENT_PUBLISH_NOT_ENABLED
The owner has not enabled direct publishing for these platforms. Give the returned reviewUrl to the user.
403 AGENT_PUBLISH_NEEDS_USER_CONFIRMATION
Includes a platform the user must confirm in person, such as TikTok.
409 MAIN_DRAFT_CONFLICT
The draft was just changed. Read it again first.
409 API_PLATFORM_DATA_NOT_OPEN
Account data of this platform is not available through the API.
428 MAIN_DRAFT_IDEMPOTENCY_REQUIRED
Idempotency-Key is missing or malformed when creating a draft.
429 API_DAILY_LIMIT_EXCEEDED
Daily calls used up. Wait for Retry-After; resets at 00:00 UTC.