{"openapi":"3.1.0","info":{"title":"DunSocial API","description":"PAT-safe REST surface for scheduling and publishing social posts,\nmanaging drafts, media, memory, and workspace personalization.\n\nAuthenticate with `Authorization: Bearer <token>` (session or personal\naccess token). Workspace-scoped routes also need `X-Workspace-Id`.\n\nSession-only routes (AI, billing, team admin, webhook endpoint CRUD,\nCLI token admin) are omitted from this document.\n","version":"0.1.0","contact":{"name":"DunSocial","url":"https://www.dunsocial.com/developers"}},"servers":[{"url":"https://api.dunsocial.com","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Workspaces"},{"name":"Accounts"},{"name":"Posts"},{"name":"Drafts"},{"name":"Media"},{"name":"Memory"},{"name":"Personalization"},{"name":"Webhooks"}],"paths":{"/api/workspaces":{"get":{"tags":["Workspaces"],"operationId":"listWorkspaces","summary":"List workspaces for the authenticated user","description":"Does not require X-Workspace-Id. Includes unpaid workspaces with hasAccess false.","x-required-scope":"workspace:read","responses":{"200":{"description":"Workspace list","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Workspace"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/workspaces/{id}":{"get":{"tags":["Workspaces"],"operationId":"getWorkspace","summary":"Get one workspace","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Workspace","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Workspace"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/workspaces/{id}/ai-voice-settings":{"get":{"tags":["Personalization"],"operationId":"getPersonalization","summary":"Get workspace AI voice / personalization","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Settings or null","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"oneOf":[{"$ref":"#/components/schemas/Personalization"},{"type":"null"}]}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}},"patch":{"tags":["Personalization"],"operationId":"updatePersonalization","summary":"Update or clear workspace personalization","description":"Owners and admins only. Send null (or empty fields) to clear.","x-required-scope":"workspace:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Personalization"},{"type":"null"}]}}}},"responses":{"200":{"description":"Updated settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/social-accounts":{"get":{"tags":["Accounts"],"operationId":"listSocialAccounts","summary":"List connected social accounts","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Accounts (OAuth tokens omitted)","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SocialAccount"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/social-accounts/reddit/flair-options":{"get":{"tags":["Accounts"],"operationId":"listRedditFlairs","summary":"List Reddit flair templates for a subreddit","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/SubredditQuery"}],"responses":{"200":{"description":"Flair choices","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RedditFlairs"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/social-accounts/reddit/post-requirements":{"get":{"tags":["Accounts"],"operationId":"getRedditRequirements","summary":"Live Reddit post rules for a subreddit","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/SubredditQuery"}],"responses":{"200":{"description":"Requirements","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RedditRequirements"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/social-accounts/pinterest/boards":{"get":{"tags":["Accounts"],"operationId":"listPinterestBoards","summary":"List boards for the connected Pinterest account","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Boards","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PinterestBoards"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"tags":["Accounts"],"operationId":"createPinterestBoard","summary":"Create a Pinterest board","description":"Creates a real board on Pinterest. Default privacy is PUBLIC so the board appears on the profile.","x-required-scope":"workspace:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePinterestBoardRequest"}}}},"responses":{"200":{"description":"Created board","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CreatePinterestBoardResponse"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/social-accounts/discord/channels":{"get":{"tags":["Accounts"],"operationId":"listDiscordChannels","summary":"List text and announcement channels for the connected Discord server","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"name":"socialAccountId","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Channels","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DiscordChannels"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/social-accounts/slack/channels":{"get":{"tags":["Accounts"],"operationId":"listSlackChannels","summary":"List public and private channels for the connected Slack team","x-required-scope":"workspace:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"name":"socialAccountId","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Channels","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SlackChannels"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/posts":{"get":{"tags":["Posts"],"operationId":"listPosts","summary":"List posts","x-required-scope":"posts:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/PostStatus"}},{"name":"socialAccountId","in":"query","schema":{"type":"string"}},{"name":"groupId","in":"query","schema":{"type":"string"}},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Offset"}],"responses":{"200":{"description":"Paginated posts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedPosts"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/posts/validate":{"post":{"tags":["Posts"],"operationId":"validatePost","summary":"Dry-run schedule/publish checks","description":"Always HTTP 200. Read data.valid and data.issues. Does not write.","x-required-scope":"posts:schedule","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidatePostRequest"}}}},"responses":{"200":{"description":"Validation result","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ValidatePostResult"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/posts/schedule":{"post":{"tags":["Posts"],"operationId":"schedulePost","summary":"Schedule a post","description":"Validation is all-or-nothing. Returns one post per social account.","x-required-scope":"posts:schedule","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchedulePostRequest"}}}},"responses":{"201":{"description":"Created posts","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/posts/publish-now":{"post":{"tags":["Posts"],"operationId":"publishPost","summary":"Queue a post for immediate publish","description":"Returns status scheduled. Poll GET /api/posts/{id} until published or failed.","x-required-scope":"posts:publish","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishPostRequest"}}}},"responses":{"201":{"description":"Queued posts","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/posts/schedule-thread":{"post":{"tags":["Posts"],"operationId":"scheduleThread","summary":"Schedule an X thread (2–25 tweets)","x-required-scope":"posts:schedule","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleThreadRequest"}}}},"responses":{"201":{"description":"Thread created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/posts/publish-thread-now":{"post":{"tags":["Posts"],"operationId":"publishThread","summary":"Queue an X thread for immediate publish","x-required-scope":"posts:publish","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishThreadRequest"}}}},"responses":{"201":{"description":"Thread queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/posts/x-cap-usage":{"get":{"tags":["Posts"],"operationId":"getXCapUsage","summary":"X monthly posting cap usage","x-required-scope":"posts:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cap usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/posts/{id}":{"get":{"tags":["Posts"],"operationId":"getPost","summary":"Get a post","x-required-scope":"posts:read","parameters":[{"$ref":"#/components/parameters/PostIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Post","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Post"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Posts"],"operationId":"deletePost","summary":"Delete a post","x-required-scope":"posts:delete","parameters":[{"$ref":"#/components/parameters/PostIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/posts/{id}/reschedule":{"post":{"tags":["Posts"],"operationId":"reschedulePost","summary":"Reschedule a scheduled or failed post","x-required-scope":"posts:schedule","parameters":[{"$ref":"#/components/parameters/PostIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReschedulePostRequest"}}}},"responses":{"200":{"description":"Updated post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/posts/{id}/cancel":{"post":{"tags":["Posts"],"operationId":"cancelPost","summary":"Cancel a scheduled post","x-required-scope":"posts:schedule","parameters":[{"$ref":"#/components/parameters/PostIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/drafts":{"get":{"tags":["Drafts"],"operationId":"listDrafts","summary":"List drafts","x-required-scope":"posts:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Offset"}],"responses":{"200":{"description":"Drafts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Drafts"],"operationId":"createDraft","summary":"Create a draft","x-required-scope":"drafts:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDraftRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/drafts/{id}":{"get":{"tags":["Drafts"],"operationId":"getDraft","x-required-scope":"posts:read","parameters":[{"$ref":"#/components/parameters/DraftIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Drafts"],"operationId":"updateDraft","x-required-scope":"drafts:write","parameters":[{"$ref":"#/components/parameters/DraftIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDraftRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Drafts"],"operationId":"deleteDraft","x-required-scope":"drafts:write","parameters":[{"$ref":"#/components/parameters/DraftIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/media":{"get":{"tags":["Media"],"operationId":"listMedia","x-required-scope":"media:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Offset"}],"responses":{"200":{"description":"Gallery page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/media/upload-url":{"post":{"tags":["Media"],"operationId":"requestUploadUrl","summary":"Get a presigned upload URL","x-required-scope":"media:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestUploadUrl"}}}},"responses":{"200":{"description":"Presign","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/UploadUrl"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/media/complete":{"post":{"tags":["Media"],"operationId":"completeUpload","summary":"Confirm an upload so it appears in the gallery","x-required-scope":"media:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteUpload"}}}},"responses":{"201":{"description":"Asset","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/MediaAsset"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/media/{id}":{"get":{"tags":["Media"],"operationId":"getMedia","x-required-scope":"media:read","parameters":[{"$ref":"#/components/parameters/MediaIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Media"],"operationId":"deleteMedia","x-required-scope":"media:write","parameters":[{"$ref":"#/components/parameters/MediaIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/memory/collections":{"get":{"tags":["Memory"],"operationId":"listCollections","x-required-scope":"memory:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Collections","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"tags":["Memory"],"operationId":"createCollection","x-required-scope":"memory:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCollectionRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"}}}},"/api/memory/collections/{id}":{"get":{"tags":["Memory"],"operationId":"getCollection","x-required-scope":"memory:read","parameters":[{"$ref":"#/components/parameters/CollectionIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"tags":["Memory"],"operationId":"updateCollection","x-required-scope":"memory:write","parameters":[{"$ref":"#/components/parameters/CollectionIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCollectionRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}}}},"delete":{"tags":["Memory"],"operationId":"deleteCollection","x-required-scope":"memory:write","parameters":[{"$ref":"#/components/parameters/CollectionIdPath"},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}}}}},"/api/memory":{"get":{"tags":["Memory"],"operationId":"listMemories","x-required-scope":"memory:read","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"},{"name":"collectionId","in":"query","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":100}}],"responses":{"200":{"description":"Memories","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}}}},"post":{"tags":["Memory"],"operationId":"saveMemory","x-required-scope":"memory:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveMemoryRequest"}}}},"responses":{"201":{"description":"Saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}}}}},"/api/memory/search":{"post":{"tags":["Memory"],"operationId":"searchMemory","x-required-scope":"memory:write","parameters":[{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchMemoryRequest"}}}},"responses":{"200":{"description":"Hits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}}}}},"/api/memory/{id}":{"delete":{"tags":["Memory"],"operationId":"deleteMemory","x-required-scope":"memory:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/WorkspaceIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["collectionId"],"properties":{"collectionId":{"type":"string"},"memoryId":{"type":"string"}}}}}},"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Session token or dun_pat_ personal access token"}},"parameters":{"WorkspaceIdHeader":{"name":"X-Workspace-Id","in":"header","required":true,"schema":{"type":"string"}},"WorkspaceIdPath":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"PostIdPath":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"DraftIdPath":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"MediaIdPath":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"CollectionIdPath":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"SubredditQuery":{"name":"subreddit","in":"query","required":true,"schema":{"type":"string"}},"Limit":{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":200}},"Offset":{"name":"offset","in":"query","schema":{"type":"integer","default":0}}},"schemas":{"SuccessEnvelope":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","const":true},"data":{}}},"ErrorEnvelope":{"type":"object","required":["success","error"],"properties":{"success":{"type":"boolean","const":false},"error":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}}},"SubscriptionRequired":{"allOf":[{"$ref":"#/components/schemas/ErrorEnvelope"},{"type":"object","required":["code","billingUrl","httpStatus"],"properties":{"code":{"type":"string","const":"subscription_required"},"httpStatus":{"type":"integer","const":402},"subscriptionStatus":{"type":"string"},"workspaceSlug":{"type":"string"},"billingUrl":{"type":"string","format":"uri"}}}]},"Workspace":{"type":"object","required":["id","name","slug"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"logo":{"type":["string","null"]},"timezone":{"type":"string"},"role":{"type":"string"},"subscription":{"$ref":"#/components/schemas/WorkspaceSubscription"}}},"WorkspaceSubscription":{"type":"object","properties":{"status":{"type":"string"},"planName":{"type":["string","null"]},"hasAccess":{"type":"boolean"},"accessMessage":{"type":"string"},"billingUrl":{"type":"string"},"cancelAtPeriodEnd":{"type":"boolean"},"currentPeriodEnd":{"type":["string","null"]}}},"SocialAccount":{"type":"object","required":["id","providerName"],"properties":{"id":{"type":"string"},"providerId":{"type":"string"},"providerName":{"type":"string"},"username":{"type":["string","null"]},"displayName":{"type":["string","null"]},"profileImageUrl":{"type":["string","null"]},"isConnected":{"type":"boolean"},"needsReconnect":{"type":"boolean"}}},"RedditFlairs":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"textEditable":{"type":"boolean"}}}}}},"PinterestBoard":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"privacy":{"type":"string","enum":["PUBLIC","SECRET"]}}},"PinterestBoards":{"type":"object","properties":{"boards":{"type":"array","items":{"$ref":"#/components/schemas/PinterestBoard"}}}},"CreatePinterestBoardRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":50},"privacy":{"type":"string","enum":["PUBLIC","SECRET"]},"socialAccountId":{"type":"string"}}},"CreatePinterestBoardResponse":{"type":"object","required":["board"],"properties":{"board":{"$ref":"#/components/schemas/PinterestBoard"},"socialAccountId":{"type":"string"}}},"RedditRequirements":{"type":"object","properties":{"is_flair_required":{"type":"boolean"},"title_text_max_length":{"type":"integer"},"title_text_min_length":{"type":"integer"}}},"PostStatus":{"type":"string","enum":["draft","scheduled","published","failed","cancelled"]},"Post":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/PostStatus"},"content":{"type":"string"},"scheduledAt":{"type":["string","null"]},"publishedPostUrl":{"type":["string","null"]},"error":{"type":["string","null"]},"groupId":{"type":["string","null"]},"socialAccountId":{"type":"string"},"mediaUrls":{"type":"array","items":{"type":"string"}}}},"PaginatedPosts":{"allOf":[{"$ref":"#/components/schemas/SuccessEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Post"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}]},"PostMetadata":{"type":"object","additionalProperties":true,"properties":{"reddit":{"$ref":"#/components/schemas/RedditPostOptions"},"instagram":{"$ref":"#/components/schemas/InstagramPostOptions"},"pinterest":{"$ref":"#/components/schemas/PinterestPostOptions"},"tiktok":{"$ref":"#/components/schemas/TikTokPostOptions"},"discord":{"$ref":"#/components/schemas/DiscordPostOptions"},"slack":{"$ref":"#/components/schemas/SlackPostOptions"}}},"RedditPostOptions":{"type":"object","required":["subreddit","title","kind"],"properties":{"subreddit":{"type":"string"},"title":{"type":"string"},"kind":{"type":"string","enum":["self","link","image","video"]},"body":{"type":"string"},"url":{"type":"string"},"flairId":{"type":"string"},"flairText":{"type":"string"},"posterMediaAssetId":{"type":"string"},"nsfw":{"type":"boolean"},"spoiler":{"type":"boolean"},"sendReplies":{"type":"boolean"},"resubmit":{"type":"boolean"}}},"InstagramPostOptions":{"type":"object","required":["format"],"properties":{"format":{"type":"string","enum":["feed_image","carousel","reel","story"]},"caption":{"type":"string"},"altText":{"type":"string"},"shareToFeed":{"type":"boolean"},"coverMediaAssetId":{"type":"string"},"thumbOffset":{"type":"number"},"audioName":{"type":"string"},"collaborators":{"type":"array","items":{"type":"string"}}}},"PinterestPostOptions":{"type":"object","required":["boardId","title","description"],"properties":{"boardId":{"type":"string"},"boardName":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"link":{"type":"string"}}},"TikTokPostOptions":{"type":"object","required":["privacyLevel"],"properties":{"title":{"type":"string"},"privacyLevel":{"type":"string","enum":["PUBLIC_TO_EVERYONE","MUTUAL_FOLLOW_FRIENDS","FOLLOWER_OF_CREATOR","SELF_ONLY"]},"disableComment":{"type":"boolean"},"disableDuet":{"type":"boolean"},"disableStitch":{"type":"boolean"},"videoCoverTimestampMs":{"type":"number"}}},"DiscordPostOptions":{"type":"object","required":["channelId"],"properties":{"channelId":{"type":"string","description":"Discord channel snowflake"},"channelName":{"type":"string"}}},"DiscordChannel":{"type":"object","required":["id","name","type"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","announcement"]},"parentId":{"type":"string"},"position":{"type":"integer"},"nsfw":{"type":"boolean"}}},"DiscordChannels":{"type":"object","required":["channels","guildId"],"properties":{"channels":{"type":"array","items":{"$ref":"#/components/schemas/DiscordChannel"}},"guildId":{"type":"string"},"source":{"type":"string","enum":["live","cache"]}}},"SlackPostOptions":{"type":"object","required":["channelId"],"properties":{"channelId":{"type":"string","description":"Slack channel id (C… or G…)"},"channelName":{"type":"string"}}},"SlackChannel":{"type":"object","required":["id","name","type"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["public","private"]},"isMember":{"type":"boolean"}}},"SlackChannels":{"type":"object","required":["channels","teamId"],"properties":{"channels":{"type":"array","items":{"$ref":"#/components/schemas/SlackChannel"}},"teamId":{"type":"string"},"source":{"type":"string","enum":["live","cache"]}}},"ValidatePostRequest":{"type":"object","required":["socialAccountIds","content"],"properties":{"socialAccountIds":{"type":"array","minItems":1,"items":{"type":"string"}},"content":{"type":"string"},"metadata":{"$ref":"#/components/schemas/PostMetadata"},"mediaUrls":{"type":"array","items":{"type":"string"}}}},"ValidatePostResult":{"type":"object","required":["valid","issues"],"properties":{"valid":{"type":"boolean"},"issues":{"type":"array","items":{"$ref":"#/components/schemas/ValidateIssue"}}}},"ValidateIssue":{"type":"object","properties":{"socialAccountId":{"type":["string","null"]},"platform":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"},"next":{"type":"string","description":"One-sentence fix. Optional so older clients can ignore it."}}},"SchedulePostRequest":{"allOf":[{"$ref":"#/components/schemas/ValidatePostRequest"},{"type":"object","required":["scheduledAt"],"properties":{"scheduledAt":{"type":"string","format":"date-time"}}}]},"PublishPostRequest":{"allOf":[{"$ref":"#/components/schemas/ValidatePostRequest"},{"type":"object","properties":{"naturalPosting":{"type":"boolean"}}}]},"ReschedulePostRequest":{"type":"object","required":["scheduledAt"],"properties":{"scheduledAt":{"type":"string","format":"date-time"},"content":{"type":"string"},"metadata":{"$ref":"#/components/schemas/PostMetadata"},"mediaUrls":{"type":"array","items":{"type":"string"}}}},"ThreadTweet":{"type":"object","required":["content"],"properties":{"content":{"type":"string"},"mediaUrls":{"type":"array","items":{"type":"string"}}}},"ScheduleThreadRequest":{"type":"object","required":["socialAccountId","tweets","scheduledAt"],"properties":{"socialAccountId":{"type":"string"},"tweets":{"type":"array","minItems":2,"maxItems":25,"items":{"$ref":"#/components/schemas/ThreadTweet"}},"scheduledAt":{"type":"string","format":"date-time"},"metadata":{"type":"object"}}},"PublishThreadRequest":{"type":"object","required":["socialAccountId","tweets"],"properties":{"socialAccountId":{"type":"string"},"tweets":{"type":"array","minItems":2,"maxItems":25,"items":{"$ref":"#/components/schemas/ThreadTweet"}},"metadata":{"type":"object"}}},"CreateDraftRequest":{"type":"object","required":["content"],"properties":{"content":{"type":"string"},"name":{"type":"string"},"socialAccountIds":{"type":"array","items":{"type":"string"}},"selectedPlatforms":{"type":"array","items":{"type":"string"}},"mediaUrls":{"type":"array","items":{"type":"string"}},"platformContent":{"type":"object","additionalProperties":{"type":"string"}},"platformMedia":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"UpdateDraftRequest":{"allOf":[{"$ref":"#/components/schemas/CreateDraftRequest"},{"type":"object","properties":{"id":{"type":"string"}}}]},"RequestUploadUrl":{"type":"object","required":["filename","mimeType","fileSize"],"properties":{"filename":{"type":"string"},"mimeType":{"type":"string"},"fileSize":{"type":"number"}}},"UploadUrl":{"type":"object","required":["uploadUrl","storageKey"],"properties":{"uploadUrl":{"type":"string"},"storageKey":{"type":"string"},"expiresAt":{"type":"string"}}},"CompleteUpload":{"type":"object","required":["storageKey","originalFilename","mimeType","fileSize"],"properties":{"storageKey":{"type":"string"},"originalFilename":{"type":"string"},"mimeType":{"type":"string"},"fileSize":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"duration":{"type":"number","description":"Video duration in milliseconds. Values under 1000 are treated as seconds and converted on write."},"altText":{"type":"string"}}},"MediaAsset":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"originalFilename":{"type":"string"},"mimeType":{"type":"string"},"fileSize":{"type":"number"},"previewUrl":{"type":"string"},"altText":{"type":["string","null"]}}},"CreateCollectionRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"color":{"type":"string","enum":["red","orange","yellow","green","teal","blue","purple","pink"]},"isPrivate":{"type":"boolean"}}},"UpdateCollectionRequest":{"type":"object","properties":{"name":{"type":"string"},"color":{"type":"string"},"isPrivate":{"type":"boolean"}}},"SaveMemoryRequest":{"type":"object","required":["text","collectionId"],"properties":{"text":{"type":"string"},"collectionId":{"type":"string"}}},"SearchMemoryRequest":{"type":"object","required":["prompt","collectionIds"],"properties":{"prompt":{"type":"string"},"collectionIds":{"type":"array","maxItems":10,"items":{"type":"string"}},"topK":{"type":"integer","minimum":1,"maximum":20,"default":5}}},"Personalization":{"type":"object","properties":{"description":{"type":"string"},"tone":{"type":"string"},"style":{"type":"string"},"personality":{"type":"string"}}},"WebhookEventType":{"type":"string","enum":["post.scheduled","post.rescheduled","post.cancelled","post.published","post.publish_failed","social_account.reconnect_required"]},"WebhookEvent":{"type":"object","required":["id","type","apiVersion","createdAt","workspace","data"],"properties":{"id":{"type":"string"},"type":{"$ref":"#/components/schemas/WebhookEventType"},"apiVersion":{"type":"string"},"createdAt":{"type":"string"},"workspace":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"}}},"data":{"type":"object","additionalProperties":true}}}},"responses":{"BadRequest":{"description":"Validation or business rule failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"Unauthorized":{"description":"Missing or invalid bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"Forbidden":{"description":"Wrong workspace, missing scope, or role","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"PaymentRequired":{"description":"Workspace is not on a paid plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRequired"}}}},"TooManyRequests":{"description":"Rate limited or X monthly posting cap","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"rateLimit":{"value":{"success":false,"error":"Rate limit exceeded"}},"xCap":{"value":{"success":false,"error":"X monthly posting cap reached","code":"x_cap_exceeded"}}}}}}}}}