Skip to main content

What You Need

Before you send requests, you need:
  1. An Ocoya API key
  2. A workspace ID
  3. Social profile IDs if you want to create or schedule posts

Get An API Key

Create or copy an API key from your Ocoya API settings. Create API key
API keys are for server-side usage. Do not expose them in browser JavaScript, mobile apps, or public repositories.

Base URL

All REST API examples use:

Send Your First Request

The fastest way to verify your API key is working is to call /me.
If the key is valid, the API returns your user context.

Typical Publishing Flow

1

List workspaces

Call GET /workspaces and choose the workspace you want to publish from.
2

Connect social profiles

If the workspace has no connected profiles yet, call POST /social-profiles/connection-url and open the returned url in a browser.
3

List social profiles

Call GET /social-profiles?workspaceId=WORKSPACE_ID to find connected profile IDs.
4

Resolve optional context

Call GET /brand-kits?workspaceId=WORKSPACE_ID and GET /hashtag-libraries?workspaceId=WORKSPACE_ID when an AI draft should use saved brand or hashtag context.
5

Create a draft or scheduled post

Call POST /post?workspaceId=WORKSPACE_ID with a caption, media URLs, target social profile IDs, and optional scheduledAt.
6

Create an AI draft

Call POST /post/ai?workspaceId=WORKSPACE_ID with a prompt when you want Ocoya to generate the caption first.
7

Create an AI campaign

Call POST /campaigns?workspaceId=WORKSPACE_ID to queue multi-post campaign generation and receive an immediate GENERATING response.
8

Manage posts

Use GET /post, PATCH /post/{postId}, and DELETE /post/{postId} to inspect, reschedule, or remove posts.

Create A Post

Use scheduledAt when you want a scheduled post. Omit it when you want a draft.

Connect A Social Profile

Use POST /social-profiles/connection-url when you need a browser URL for connecting a new social profile.
cURL
Open the returned url while signed in to Ocoya.

Create An AI Draft

Use POST /post/ai when you want Ocoya to generate the caption from a prompt before creating the draft. Use brandId, hashtagLibraryId, and referenceDesignIds when you want the draft to use saved brand kit, hashtag library, or Studio template context.
cURL

Create An AI Campaign

Use POST /campaigns when you want Ocoya to generate a multi-post campaign in the background. The response returns immediately with GENERATING status. Use hashtagLibraryId when the campaign should use a saved hashtag library.
cURL

MCP vs REST API

Use the REST API for backend systems that already know exactly what they need to do. Use MCP when you want AI clients such as Claude, Codex, or ChatGPT to discover and call Ocoya tools after the user approves OAuth access.