Create a post
Creates a draft, scheduled post, or immediate post. This endpoint requires a read-write API key. Provide exactly one creation mode: publishNow, scheduledFor, or isDraft.
Authorization
bearerAuth PostZen API key.
In: header
Header Parameters
Optional idempotency key. Repeating the same value returns the original post instead of creating a new one.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Provide exactly one creation mode: publishNow, scheduledFor, isDraft, or queuedFromProfile. platforms is required unless isDraft is true.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/posts" \ -H "Content-Type: application/json" \ -d '{ "title": "Launch post", "content": "We shipped the new release.", "publishNow": true, "platforms": [ { "platform": "twitter", "accountId": "1934567890123456789" } ] }'{ "existingPost": { "_id": "jx58t2kqm4wr9v3n7c1zp6bs0dh5fg8y", "title": "Launch post", "content": "We shipped the new release.", "status": "published", "scheduledFor": null, "timezone": "UTC", "platforms": [] }, "message": "Post already exists for this request id"}{ "post": { "_id": "jx58t2kqm4wr9v3n7c1zp6bs0dh5fg8y", "title": "Launch post", "content": "We shipped the new release.", "status": "published", "scheduledFor": null, "timezone": "UTC", "platforms": [ { "platform": "twitter", "accountId": { "_id": "j97kp4mw2xnv6r1t8c3zq5bs9fh0yg4d", "platform": "twitter", "username": "acme", "displayName": "Acme", "isActive": true }, "status": "published", "platformPostUrl": "https://x.com/acme/status/1934567890123456789" } ] }, "message": "Post published successfully"}{ "error": "JSON body is required"}{ "error": "Unauthorized"}{ "error": "The Free plan includes 2 connected accounts. Upgrade your plan to connect more.", "code": "paymentRequired", "reason": "freeTierExceeded", "documentationUrl": "https://docs.postzen.dev/api-reference/connect/create-connect-url", "dashboardUrl": "https://app.postzen.dev/settings?tab=billing", "details": { "planId": "free", "includedAccounts": 2, "freeTierAccountLimit": 2, "currentAccountCount": 2, "hasPaymentMethod": false }}{ "error": "API key requires read_write permission"}{ "error": "Failed to create post"}List posts GET
Returns posts created for the profiles available to the API key, newest first. Read-only and read-write API keys are accepted. Published posts include a `platformPostUrl` for each published platform target. Results are capped to the 1000 most recent matching posts.
Get a post GET
Returns one post when it belongs to a profile available to the API key. Missing and inaccessible posts both return 404.