Drafts, scheduled posts and publishing.
GET/api/workspaces/{workspaceId}/composes
List drafts
Scope: posts:read. Unscheduled drafts, each in the same shape POST composes accepts.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mine query · "1" — 1 = only the ones this API key created.
200 { drafts }
POST/api/workspaces/{workspaceId}/composes
Create a post or draft
Scope: posts:draft (higher post scopes work too: posts:schedule, posts:publish). With publishAt: scheduled to every account in platformAccountIds. Without it: saved as a draft (posts:draft is enough). With draftId: replaces that draft’s content (the key’s own drafts only) and schedules it if publishAt is set. A publishAt at least 5 minutes ahead needs posts:schedule; sooner (now) needs posts:publish — otherwise 403 api_key_missing_scope naming the scope. A YouTube target can carry youtubeOptions.tags (up to 30 tags, each ≤ 100 characters, ≤ 500 in total counting YouTube’s quotes and commas, no < or >; a leading # is dropped and duplicates removed — 400 invalid_youtube_tags otherwise). A YouTube target can carry youtubeOptions.playlistIds (≤ 5 of the channel’s own playlist ids — GET accounts/{accountId}/youtube/playlists; 400 invalid_youtube_playlists for a malformed id, 400 unknown_playlist for one that isn’t the channel’s): the video is added to them right after it goes live, 50 YouTube units each, never failing the publish (c569); on a post to several channels each video goes only into its own channel’s playlists — the other channels’ ids are skipped. Accounts in a group with an approval policy create a post waiting for approval. Media are URLs from the upload routes. A YouTube target can carry subtitle tracks, youtubeOptions.captions: [{ ref, language, name? }] — ≤ 5, one per language (BCP-47, e.g. en, es-419), each ref a Hayyvn upload of an SRT or WebVTT file (POST uploads with application/x-subrip / text/vtt, ≤ 1 MB; library files can’t be used yet) — 400 invalid_captions otherwise; a subtitle file is never a post’s media (400 incompatible_plan). They are added right after the upload (400 YouTube units each, from the workspace’s publish allowance); a refusal is retried later and never fails the publish — the job records captionsError (c568). A YouTube target can carry a custom thumbnail, youtubeOptions.thumbnailRef: a Hayyvn image URL (an upload or a library item’s url), JPEG or PNG, ≤ 2 MB, at least 640×360 (400 invalid_thumbnail otherwise). It is set right after the upload and never fails the publish — a channel not verified for custom thumbnails keeps YouTube’s own frame (c565). youtubeOptions.firstComment (≤ 2,000 characters, no < >; 400 invalid_youtube_first_comment) is posted as the channel right after the video goes live — it never fails the publish; comments off on the video (or a made-for-kids video, skipped without a call) → the job records firstCommentError: comments_disabled. YouTube can’t pin it through the API (c570). An API key setting a first comment is sending a comment: it also needs comments:reply (403 api_key_missing_scope) and **send** reply mode (403 draft_mode_cannot_send), and the text is stored with the key’s disclosure (R2-F1).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).
Body · application/json
contentKind "short_video" | "long_video" | "photo" | "story" · requiredplatformAccountIds string[] · requireddefaultCaption string ≤4000defaultMediaRefs string ≤2000[]overrides objecttiktokOptions objectyoutubeOptions objectinstagramOptions objectpublishAt string (date-time)draftId stringstudioClipId string
201 The created post or draft.
DELETE/api/workspaces/{workspaceId}/composes/{composeId}
Delete a draft
Scope: posts:draft (higher post scopes work too: posts:schedule, posts:publish). Removes an unscheduled draft. The key can only act on posts and drafts it created itself (403 api_key_not_post_owner / api_key_not_draft_owner).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).composeId path · string · requiredpermanent query · "1" — Not for API keys (403 people_only): removed drafts can be restored in the app for 30 days, and only people delete them for good there.
200 { ok: true }
GET/api/workspaces/{workspaceId}/media/{mediaId}/captions
List a YouTube video’s subtitles
Scope: posts:read. The subtitle tracks Hayyvn put on a published YouTube video — language, name and when — never YouTube’s caption ids. mediaId is Hayyvn’s id (GET media → mediaId); the YouTube video id is accepted too. Needs posts:read. YouTube only (400 not_supported); 404 not_found for an unknown post or one on an account the key can’t see.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · required
200 { mediaId, captions: [{ language, name, uploadedAt }] }
POST/api/workspaces/{workspaceId}/media/{mediaId}/captions
Add or replace a YouTube subtitle track
Scope: posts:schedule (higher post scopes work too: posts:publish). Adds a subtitle track to a published YouTube video, or — when Hayyvn already put one in that language there — replaces its file (the track keeps its name). Body { ref, language, name? }: ref a Hayyvn upload (POST uploads) of an SRT or WebVTT file, ≤ 1 MB, with real cues; language a code like en, es-419; name ≤ 150 characters, no < > (400 invalid_captions otherwise). Up to 5 tracks per video (400 too_many_captions). Needs posts:schedule. YouTube only (400 not_supported); 404 not_found for an unknown post or one on an account the key can’t see; 409 while the account is being handed back to its creator; 400 account_or_token_missing when the channel isn’t connected; 404 video_not_found when YouTube no longer has it. Each upload uses 400 units of the day’s YouTube quota — a large share (429 youtube_quota_exhausted, nothing changed); at most 10 changes per hour per workspace (429 rate_limited). Audited as media.captions_changed (language, action).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · required
Body · application/json
ref string ≤2000 · requiredlanguage string ≤40 · requiredname string ≤200
200 { mediaId, action: "added" | "replaced", captions: [{ language, name, uploadedAt }] }
DELETE/api/workspaces/{workspaceId}/media/{mediaId}/captions
Remove a YouTube subtitle track
Scope: posts:schedule (higher post scopes work too: posts:publish). Removes the subtitle track Hayyvn put on a published YouTube video in ?language= (deleted on YouTube; adding it back needs the file again). 404 caption_not_found when Hayyvn hasn’t put that language there; a track already removed in YouTube Studio counts as removed. Needs posts:schedule; same gates as POST. Uses 50 units of the day’s YouTube quota. Audited as media.captions_changed (action: removed).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · requiredlanguage query · string — The track’s language code, as GET lists it.
200 { mediaId, action: "removed", captions: [{ language, name, uploadedAt }] }
PATCH/api/workspaces/{workspaceId}/media/{mediaId}/details
Edit a YouTube video’s details
Scope: posts:schedule (higher post scopes work too: posts:publish). Changes a published YouTube video’s title, description and/or tags without re-uploading it. Body { title?, description?, tags? } — at least one; only what you send changes. title ≤ 100 characters; description ≤ 5,000 bytes and replaces the whole description; tags replaces the whole list (≤ 30, each ≤ 100 characters, ≤ 500 in total; [] removes them); no < or > in any (400 invalid_youtube_title / invalid_youtube_description / invalid_youtube_tags). Everything else on the video (category, languages) is kept: Hayyvn reads the current details and sends them back with only these changed. mediaId is Hayyvn’s id (GET media → mediaId, or a YouTube job’s mediaId in GET scheduled-posts); the YouTube video id is accepted too. Needs posts:schedule. YouTube only (400 not_supported); 404 not_found for an unknown post or one on an account the key can’t see; 400 account_or_token_missing when the channel isn’t connected; 404 video_not_found when YouTube no longer has it. YouTube is always read first (what Hayyvn stored may be stale): already that way there → 200 with unchanged: true, nothing changed (1 unit used). An account being handed back to its creator → 409. Each edit reserves 51 units of the day’s YouTube quota (429 youtube_quota_exhausted, nothing changed); at most 30 edits per hour per workspace (429 rate_limited). Audited as media.details_changed (which fields, never their text).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · required
Body · application/json
title string ≤1000description string ≤20000tags string ≤500[]
200 { mediaId, title, description, tags } (null when Hayyvn doesn’t know a field yet; plus unchanged: true when nothing changed)
GET/api/workspaces/{workspaceId}/media/{mediaId}/playlists
List a YouTube video’s playlists
Scope: posts:read. The playlists Hayyvn put a published YouTube video in (at publish or with POST) — { id, title } only. Playlists it was added to in YouTube Studio aren’t known here. mediaId is Hayyvn’s id (GET media → mediaId); the YouTube video id is accepted too. Needs posts:read. 404 not_found for an unknown post or one on an account the key can’t see.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · required
200 { mediaId, playlists: [{ id, title }] }
POST/api/workspaces/{workspaceId}/media/{mediaId}/playlists
Add a YouTube video to a playlist
Scope: posts:schedule (higher post scopes work too: posts:publish). Adds a published YouTube video to one of its channel’s playlists. Body { playlistId } (from GET accounts/{accountId}/youtube/playlists; 400 unknown_playlist when it isn’t the channel’s). Already added by Hayyvn → 200 with unchanged: true, nothing sent (YouTube would add it a second time). Needs posts:schedule. YouTube only (400 not_supported); 404 not_found for an unknown post or one on an account the key can’t see; 400 account_or_token_missing when the channel isn’t connected; 409 while the account is being handed back to its creator. Uses 50 units of the day’s YouTube quota (429 youtube_quota_exhausted, nothing changed); at most 30 playlist changes per hour per workspace (429 rate_limited). Audited as media.playlist_changed.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · required
Body · application/json
playlistId string · required
200 { mediaId, playlists: [{ id, title }] } (plus unchanged: true when it was already in it)
DELETE/api/workspaces/{workspaceId}/media/{mediaId}/playlists/{playlistId}
Remove a YouTube video from a playlist
Scope: posts:schedule (higher post scopes work too: posts:publish). Takes a published YouTube video out of a playlist Hayyvn put it in; add it back with POST. 404 not_in_playlist when Hayyvn has no record of it (added in YouTube Studio — remove it there). Needs posts:schedule. Same gates as POST: YouTube only, the key’s accounts, 409 during a hand-back; 50 units of the day’s YouTube quota; 30 changes per hour per workspace. Audited as media.playlist_changed.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · requiredplaylistId path · string · required
200 { mediaId, playlists: [{ id, title }] }
PATCH/api/workspaces/{workspaceId}/media/{mediaId}/thumbnail
Set a YouTube video’s thumbnail
Scope: posts:schedule (higher post scopes work too: posts:publish). Sets or changes a published YouTube video’s custom thumbnail without re-uploading it. Body { thumbnailRef }: a Hayyvn image URL — an upload (POST uploads) or a library item’s url — JPEG or PNG, ≤ 2 MB, at least 640×360 (1280×720 is best); 400 invalid_thumbnail otherwise. mediaId is Hayyvn’s id (GET media → mediaId, or a YouTube job’s mediaId in GET scheduled-posts); the YouTube video id is accepted too. Needs posts:schedule. The channel must be verified for custom thumbnails: 409 channel_not_verified (with verifyUrl) otherwise. YouTube only (400 not_supported); 404 not_found for an unknown post or one on an account the key can’t see; 400 account_or_token_missing when the channel isn’t connected; 404 video_not_found when YouTube no longer has it; 409 while the account is being handed back to its creator. A successful change also clears a thumbnail that didn’t take at publish. Each change uses 50 units of the day’s YouTube quota (429 youtube_quota_exhausted, nothing changed); at most 30 changes per hour per workspace (429 rate_limited). Audited as media.thumbnail_changed.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · required
Body · application/json
thumbnailRef string ≤2000 · required
200 { mediaId, customThumbnail: true }
PATCH/api/workspaces/{workspaceId}/media/{mediaId}/visibility
Change a YouTube video’s visibility
Scope: posts:schedule (higher post scopes work too: posts:publish). Changes a published YouTube video to public, unlisted or private without re-uploading it — e.g. publish unlisted for review, make it public later. mediaId is Hayyvn’s id (GET media → mediaId, or GET scheduled-posts → a YouTube job’s mediaId); the YouTube video id is accepted too. Making a video **public** is publishing it, so a key needs posts:publish for that value (403 api_key_missing_scope naming it); unlisted and private need posts:schedule. YouTube only (400 not_supported for an Instagram or TikTok post); 404 not_found for an unknown post or one on an account the key can’t see; 400 account_or_token_missing when the channel isn’t connected; 404 video_not_found when YouTube no longer has it. YouTube is always read first (what Hayyvn stored may be stale): already at that value there → 200 with unchanged: true, nothing changed (1 unit used). An account being handed back to its creator → 409. Each change reserves 51 units of the day’s YouTube quota (429 youtube_quota_exhausted, nothing changed); at most 30 changes per hour per workspace (429 rate_limited). Audited as media.visibility_changed.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).mediaId path · string · required
Body · application/json
privacyStatus "public" | "unlisted" | "private" · required
200 { mediaId, privacyStatus } (plus unchanged: true when it already had that value)
GET/api/workspaces/{workspaceId}/posting-schedules
List auto-post schedules
Scope: posts:read. Recurring auto-post schedules (posting from the library): cadence, accounts, status + pausedReason, nextAt, pending drafts waiting to be scheduled (each with composeId, occurrenceAt, caption, asset { assetId, title, kind, removed }), lastMaterializedAt. Creating, switching on and changing schedules are people-only; a posts:schedule key can schedule or skip pending drafts (below). A limited key sees only schedules whose every account is its own.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).removed query · "1" — 1 = the Removed list instead.
200 { schedules, meta }
POST/api/workspaces/{workspaceId}/posting-schedules/{scheduleId}/pending/{composeId}/schedule
Schedule a pending auto-post draft
Scope: posts:schedule (higher post scopes work too: posts:publish). Schedules a draft an auto-post schedule prepared (composeId from GET posting-schedules → pending) to the schedule’s accounts, with its stored caption and media. The draft was made by the schedule, so any key that sees the schedule may use it; the post records the key (it can then reschedule / cancel it). A publishAt at least 5 minutes ahead needs posts:schedule; sooner (now) needs posts:publish — otherwise 403 api_key_missing_scope naming the scope. Monthly post limit, approval policies and platform rules apply as for POST composes. A schedule paused for a plan or limit reason (plan, quota, daily_cap, kill_switch) is 409 schedule_paused for keys. While auto-posting is turned off for maintenance, every call is 409 auto_post_off. A limited key: the draft’s library items must still be in its groups’ folders (400 library_item_not_available).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).scheduleId path · string · requiredcomposeId path · string · required
Body · application/json
publishAt string (date-time) · required
201 { ok: true, scheduledPostId }
POST/api/workspaces/{workspaceId}/posting-schedules/{scheduleId}/pending/{composeId}/skip
Skip a pending auto-post draft
Scope: posts:schedule (higher post scopes work too: posts:publish). Passes on a draft an auto-post schedule prepared: it stops waiting and stays in the drafts list (nothing is deleted). 404 when it is no longer waiting.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).scheduleId path · string · requiredcomposeId path · string · required
200 { ok: true }
POST/api/workspaces/{workspaceId}/publish-jobs/{jobId}
Retry a failed publish
Scope: posts:schedule (higher post scopes work too: posts:publish). Retries one failed publish job (a post to one account). A post still waiting for approval is refused (409 approval_open). A post created for a later time retries with posts:schedule; one created to publish at once (its publishAt under 5 minutes after it was created) needs posts:publish. When the last attempt reached the platform but no answer came back and there is nothing to check it against (a TikTok upload with no publish id), a plain retry is refused with 409 outcome_unknown — the post may already be live; check, and only if it is not there send { confirmNotPublished: true }. The key can only act on posts and drafts it created itself (403 api_key_not_post_owner / api_key_not_draft_owner).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).jobId path · string · required
200 { ok: true }
POST/api/workspaces/{workspaceId}/publish-jobs/{jobId}/dismiss
Dismiss a publish failure
Scope: posts:schedule (higher post scopes work too: posts:publish). Marks one FAILED publish job as acknowledged, so it stops counting as an unresolved failure. Bookkeeping only: the job keeps its error and stays listed; DELETE on the same path takes it back. A job that hasn’t failed is 409 not_dismissable; a job retried or (un)dismissed in between is 409 job_changed (with its current status / dismissed), nothing written. A key’s dismiss records no user; the audit carries the key. The key can only act on posts and drafts it created itself (403 api_key_not_post_owner / api_key_not_draft_owner).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).jobId path · string · required
200 { ok: true } (or alreadyDismissed: true)
DELETE/api/workspaces/{workspaceId}/publish-jobs/{jobId}/dismiss
Take back a dismissed failure
Scope: posts:schedule (higher post scopes work too: posts:publish). Un-dismisses a publish failure, so it counts as unresolved again. A job that changed in between is 409 job_changed, nothing written. The key can only act on posts and drafts it created itself (403 api_key_not_post_owner / api_key_not_draft_owner).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).jobId path · string · required
200 { ok: true } (or alreadyActive: true)
GET/api/workspaces/{workspaceId}/scheduled-posts
List scheduled and published posts
Scope: posts:read. Posts with their per-account publish jobs, approval state (approvalState, approvalHeld, this round’s approvals), newest first. A YouTube job also carries mediaId (for PATCH media/{mediaId}/visibility) and visibility (public, unlisted, private, or null when not known yet), plus youtube: { uploadStatus, failureReason } — YouTube keeps processing a video after the upload, and can still reject it: uploaded (still processing), processed, rejected / failed (stopped by YouTube after upload — the job is then failed with a plain-words error, e.g. a copyright match; a retry re-uploads and may be refused again), deleted (the video is no longer on YouTube — the job is failed with “This video was removed from YouTube.” and already dismissed), unknown (Hayyvn stopped checking after ~2 days), or null (not checked). failureReason is YouTube’s token (copyright, duplicate, codec, …; removed when the video is gone); left out for client members.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).before query · string (date-time) — Cursor: posts scheduled before this ISO time.beforeId query · string — Cursor tie-breaker: the last post id of the previous page.group query · string ≤100 — Account group: its id, its name (case-insensitive) or none (accounts in no group). Intersects with accountId. An empty group returns an empty list (never every account); an unknown or removed group is 404 group_not_found; over 100 characters is 400 invalid_request.ids query · string — Only these post ids (comma-separated).mine query · "1" — 1 = only the ones this API key created.status query · string — Only posts in this status (400 invalid_status lists the allowed values).
200 { posts }
GET/api/workspaces/{workspaceId}/scheduled-posts/{postId}
Get a post
Scope: posts:read. One post, with its content in the same shape POST composes accepts, its publish jobs and approval state.
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).postId path · string · required
200 The post.
PATCH/api/workspaces/{workspaceId}/scheduled-posts/{postId}
Edit a waiting post
Scope: posts:schedule (higher post scopes work too: posts:publish). Same body and checks as POST composes, plus optional publishAt (A publishAt at least 5 minutes ahead needs posts:schedule; sooner (now) needs posts:publish — otherwise 403 api_key_missing_scope naming the scope.). Content type and accounts can’t change (400 targets_locked); once publishing has started it’s 409 not_editable. The key can only act on posts and drafts it created itself (403 api_key_not_post_owner / api_key_not_draft_owner).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).postId path · string · required
Body · application/json
contentKind "short_video" | "long_video" | "photo" | "story" · requiredplatformAccountIds string[] · requireddefaultCaption string ≤4000defaultMediaRefs string ≤2000[]overrides objecttiktokOptions objectyoutubeOptions objectinstagramOptions objectpublishAt string (date-time)
200 The updated post.
POST/api/workspaces/{workspaceId}/scheduled-posts/{postId}/cancel
Cancel a post
Scope: posts:schedule (higher post scopes work too: posts:publish). Cancels a post that hasn’t published yet. Posts already live stay up (deleting live posts is for people in the app). The key can only act on posts and drafts it created itself (403 api_key_not_post_owner / api_key_not_draft_owner).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).postId path · string · required
200 { ok: true, … }
POST/api/workspaces/{workspaceId}/scheduled-posts/{postId}/reschedule
Reschedule a post
Scope: posts:schedule (higher post scopes work too: posts:publish). Moves a waiting post to a new time. A publishAt at least 5 minutes ahead needs posts:schedule; sooner (now) needs posts:publish — otherwise 403 api_key_missing_scope naming the scope. The key can only act on posts and drafts it created itself (403 api_key_not_post_owner / api_key_not_draft_owner).
Parameters
workspaceId path · string · required — The workspace the key belongs to (see GET /api/api-keys/self).postId path · string · required
Body · application/json
publishAt string (date-time) · required
200 { ok: true, publishAt }