Build your Faryen integration.
Create a scoped key in your workspace, keep it on your server and make your first request.
API, MCP and webhooks are included with Studio and Agency. Compare plans.
Create a workspace key
Open Settings → API & AI connections → Create key. Name it, choose only the permissions needed and select a 30-day, 90-day or one-year expiry. Save it in your secret manager: it is shown once.
Use Authorization: Bearer on each request. Never put keys in URLs, frontend bundles, repositories or chat messages. Expiry, revocation, workspace ownership and plan eligibility are checked on every call.
curl https://app.faryen.com/api/v1/workspaces \
-H "Authorization: Bearer $FARYEN_API_KEY"Create a draft
A key with posts:write can create an unpublished draft. Creating a draft never publishes. Each destination needs account_id, post_format and comment_plan. Optional caption_override, media_paths_override and provider options customize that destination.
An optional post_id must be a fresh UUID. For uploaded media, use the same post_id chosen for the upload. Updating a draft replaces its content, media and destination plan; omitted media_paths and targets become empty lists.
curl -X POST "https://app.faryen.com/api/v1/workspaces/$WORKSPACE_ID/posts" \
-H "Authorization: Bearer $FARYEN_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: draft-campaign-001" \
-d '{"content":"A new idea, ready to review.","media_paths":[],"targets":[]}'Review and submit
Read GET …/posts/{post_id}. Supply its expected_revision when editing, scheduling, publishing, canceling or deleting. If the revision changed, a 409 response requires reading and reviewing the updated plan.
POST …/schedule requires posts:schedule and a future scheduled_at with an explicit UTC offset, such as 2026-12-01T09:00:00+01:00. Faryen normalizes it to UTC. POST …/publish requires posts:publish and queues a draft immediately.
POST …/cancel returns a scheduled, unstarted post to draft. DELETE removes an eligible unpublished Faryen post; it does not remove a remote social post. Once delivery starts, keep its results and create a new draft for another publication.
Retry safely
Every mutation requires an Idempotency-Key of 8–128 letters, digits, dots, colons, underscores or hyphens. A new action needs a new key. After a timeout, retry the identical request with its original key.
The action and replay record commit together. Identical retries return the original action result with replayed: true; a changed request using the same key returns 409. Records last 30 days. A retry still requires valid credentials and current plan/scope access. Replays count toward minute limits, but do not consume another monthly operation.
Webhook signing secrets are shown only on the first response, then omitted on replay. If that response is lost, revoke the subscription and create another. Upload-session replay preserves the reserved path and may mint a fresh upload URL.
Pagination and errors
List responses contain data and next_cursor. Use limit from 1 to 100 (default 50); pass the returned cursor as after. Treat analytics cursors as opaque strings and URL-encode them.
Errors include error.code, error.message and request_id. 401: invalid credentials. 403: missing permission or plan. 409: revision or idempotency conflict. 422: invalid post plan. Follow Retry-After on 429. On 503 or an uncertain network response, retry the identical mutation with its original key.
All endpoints and request schemasKeep exploring
MCP guide