# ContentGenius Public API 1.0.0: documentation for agents > Plain-text copy of /documentation. The OpenAPI 3.1 contract is /api/v1/openapi.json. # Start here The ContentGenius **Public API** (`/api/v1`, version 1.0.0) exposes the app's features over HTTP, for scripts, the `cgenius` CLI and AI agents. This site is written for both people and agents. An agent can read all of it as plain text at [/documentation/llms.txt](/documentation/llms.txt). ## What exists today | Piece | State | |---|---| | Public API | 65 Operations in this build. The [API reference](/documentation/api) lists each one. The machine-readable contract is [`GET /api/v1/openapi.json`](/api/v1/openapi.json). | | Capability coverage | 65 of 150 app capabilities have an Operation; 80 are planned; 5 are excluded on purpose. | | `cgenius` CLI | **Not released yet.** The command names are fixed; see [CLI](/documentation/cli). Use HTTP until then. | | Agent skill | A `SKILL.md` for the v1 API: [/documentation/skill.md](/documentation/skill.md). See [Agent skill](/documentation/skills). | > **Workspaces.** Operations that work on content (blogs, offers, ideas, Jobs) run in the caller's Workspace: one per LeadGenius company the user owns or belongs to, or a personal Workspace when they have none. `GET /api/v1/me` lists them; send `X-Workspace-Id` to pick one (default: the first). If LeadGenius cannot be reached, these Operations answer `503 upstream_unavailable`; retry later. The reference marks each Operation that needs a Workspace. ## Quick start (five calls) 1. **Get a token.** In the app, open **Settings → API Tokens → Create Token**. Pick the Scopes and keep **AI access** on if the agent will generate content. Copy the `cg_…` token; it is shown once. (A CLI or agent can also use the [login flow](/documentation/recipes#cli-login).) 2. **Configure.** ```bash export CGENIUS_API_URL="https://app.cgenius.app" export CGENIUS_API_TOKEN="cg_…" # never print or log it ``` 3. **Check who you are.** ```bash curl -sS "$CGENIUS_API_URL/api/v1/me" -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` The answer names the owner, the token's Scopes, whether it has AI access, the Workspaces, the rate limits and the remaining credits. 4. **Start work.** Generation is a **Job**: the call answers `202` with `{job}` and a `Location` header. ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/blogs/v3/pipelines" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"requestData":{"topic":"How AI changes B2B sales","blogSize":"medium","tone":"professional"}, "agentConfiguration":{"defaultAgentId":""}}' ``` 5. **Wait for the result.** Read `GET /api/v1/jobs/{jobId}` every few seconds until `status` is `COMPLETED`, `FAILED` or `CANCELLED`. Reading also moves the Job forward, and Jobs started with an API token keep running on the server even when nobody reads them. A finished Job lists what it made in `result.resources`. ## Rules for agents - Keep the token secret: never echo it, log it, write it to a file the user did not ask for, or put it in a URL. - Send an `Idempotency-Key` (a new UUID per intended action) on every call that starts a Job, so a retry after a network error does not start a second one. - Decide on `error.code`, not on the message. The [codes table](/documentation/concepts#errors) says what to do for each. - On `429`, wait `Retry-After` seconds. Do not poll faster than every 2 seconds. - Ask the user before deleting, publishing, or anything that sends content outside the app. - Quote `correlationId` (also the `X-Request-Id` response header) when you report a failure. - Use only `/api/v1`. The app's own routes (`/api/...` outside `/api/v1`) check no Scope, so they refuse API tokens with limited Scopes (`403`) and can change without notice. ## What an agent can do | Goal | Operations | Recipe | |---|---|---| | Check the setup and find the agents to use | `me.get`, `assistants.list` | [Find your agents](/documentation/recipes#find-your-agents) | | Write a blog | `blogs.v3.create` (or v2, v1), then `jobs.get` | [Write a blog](/documentation/recipes#write-a-blog-v3-engine) | | Ideas from the user's LeadGenius leads | `leadApp.companies.list`, `ideation.leadIdeas.create` | [Ideas from LeadGenius leads](/documentation/recipes#ideas-from-leadgenius-leads) | | Write and save a social post, then send it to Buffer | `generate.socialPost`, `jobs.get`, `publish.buffer` | [Write a social post](/documentation/recipes#write-a-social-post-and-send-it-to-buffer) | | Write an email, a presentation or a research report | `generate.email`, `generate.presentation`, `generate.research`, then `jobs.get` | [Write a social post](/documentation/recipes#write-a-social-post-and-send-it-to-buffer) (same steps) | | Make a video ad from an idea and post it | `generate.videoAd`, `generate.videoAd.get`, `publish.buffer` | [Make a video ad](/documentation/recipes#make-a-video-ad-from-an-idea) | | Size a social post for a channel | `social.channels.list`, `social.fit` | [Size a social post](/documentation/recipes#size-a-social-post-for-each-channel) | | Find saved content and send it to the user's sites | `contentItems.list`, `contentItems.get`, `integrationEndpoints.list`, `contentItems.send` | [Send content to your sites](/documentation/recipes#send-content-to-your-sites) | | Publish or schedule through Buffer | `connections.buffer.channels`, `publish.buffer` | [Publish through Buffer](/documentation/recipes#publish-through-buffer) | | Keep a generated image | `media.generatedImages.import`, `media.images.get` | [Keep a generated image](/documentation/recipes#keep-a-generated-image) | | Generate an offer | `generate.offer` | [Generate an offer](/documentation/recipes#generate-an-offer) | | Check credits and buy more (pay as you go) | `billing.get`, `billing.checkout`, `billing.portal` | [Credits and buying](/documentation/recipes#credits-and-buying) | | Read or change preferences | `settings.get`, `settings.update` | [Settings](/documentation/recipes#read-and-change-settings) | The [Agent skill](/documentation/skills) page chains these into complete workflows. ## Related documentation All EpsimoAI product documentation: [doc.epsimoai.com](https://doc.epsimoai.com/). | Product | Documentation | What ContentGenius uses it for | |---|---|---| | EpsimoAgents | [https://backend2.epsimoagents.com/guide/index](https://backend2.epsimoagents.com/guide/index) | the assistants (agents) that write ContentGenius content, projects, threads and credits | | LeadGenius | [https://app.leadgenius.app/docs#/](https://app.leadgenius.app/docs#/) | the companies and leads that lead ideas are written from; ContentGenius uses the same sign-in | # Concepts ## Base URL and versions | Environment | Base URL | |---|---| | Production | `https://app.cgenius.app` | | Local development | `http://localhost:3000` | Every path starts with `/api/v1`. The version in `GET /api/v1/health` and the OpenAPI document follows semver: additive changes keep `v1`; a breaking change gets `/api/v2` and a deprecation period announced with `Deprecation` and `Sunset` headers. ## Authentication Send `Authorization: Bearer ` on every call except the public ones (`/health`, `/openapi.json`, the CLI login start and exchange). Two kinds of token work: - **API token** (`cg_` + 64 hex characters): made in **Settings → API Tokens** or by the [CLI login](/documentation/recipes#cli-login). It has Scopes and an expiry (default 90 days, at most 365). Only its SHA-256 is stored. - **Cognito ID token** of a signed-in app user. The app's own pages use it; it has every Scope. The app's own routes (`/api/...` outside `/api/v1`) check no Scope. They accept only API tokens that hold every Scope, or legacy tokens made before Scopes existed; a token with limited Scopes gets `403` there. Integrations use `/api/v1`. ### Scopes A token can do only what its Scopes allow; anything else answers `403 insufficient_scope` with `error.details.missingScopes`. Starting a Job needs the resource's write Scope **and** `jobs:write`. | Scope | Allows | |---|---| | `content:read` | Read content, blogs, ideas, brand voices, questionnaires; list assistants, projects, LeadGenius companies and social channel rules | | `content:write` | Create and change those; start content generation | | `publish:read` | Read publications, schedules, publishing endpoints, the Buffer connection and its channels | | `publish:write` | Publish and schedule (including Buffer posts) | | `connections:manage` | Connect and disconnect social and Buffer accounts | | `media:read` | Read the media library | | `media:write` | Upload and change media; keep generated images | | `settings:read` | Read settings and `/me` | | `settings:write` | Change settings | | `jobs:read` | Read Jobs | | `jobs:write` | Start, advance, cancel and resume Jobs | | `tokens:manage` | List, create and revoke API tokens; read the audit log | | `maintenance:read` | Read maintenance tickets | | `maintenance:write` | Create and change maintenance tickets | Tokens created before Scopes existed show as **full access, no AI access**. ### AI access Operations that call EpsimoAgents (generation, credits) or read the Lead App need **AI access**. A token gets it when the user approves it in the browser and signs in once more on the Cognito page; the token then acts as that user, until the sign-in ends (the token page shows the end date). Without it these Operations answer `403 ai_access_unavailable`. The reference marks them **needs AI**. ## Errors Every error has one shape: ```json { "error": { "code": "validation_failed", "message": "Validation failed", "correlationId": "4f1c…", "fields": [{ "field": "requestData.topic", "message": "Required" }], "details": {} } } ``` | Code | HTTP | What to do | |---|---|---| | `validation_failed` | 400 | Fix the fields listed in `error.fields` and send again. | | `unauthenticated` | 401 | The token is missing, wrong, revoked or expired. Ask the user for a new token. | | `credits_exhausted` | 402 | The user is out of EpsimoAgents credits. Stop and tell the user. | | `insufficient_scope` | 403 | The token lacks a Scope (`error.details.missingScopes`). Ask the user for a token with it. | | `ai_access_unavailable` | 403 | The token has no AI access, or it ended. Ask the user to create a token with AI access. | | `workspace_required` | 403 | Send `X-Workspace-Id` with one of the Workspaces of `GET /api/v1/me`. | | `forbidden` | 403 | This caller may not do this (for example an API token approving tokens). Do not retry. | | `not_found` | 404 | The id does not exist or belongs to someone else. Do not retry. | | `conflict` | 409 | The resource is in a state that does not allow this (for example cancelling a finished Job). Read it again. | | `account_link_required` | 409 | The account needs linking by an administrator. Tell the user. | | `idempotency_key_reused` | 409 | The Idempotency-Key was used with another body. Use a new key. | | `idempotency_in_progress` | 409 | The first request with this key is still running. Wait and retry with the same key. | | `version_conflict` | 412 | The record changed since you read it. Read it again, then retry with the new version in `If-Match`. | | `session_expired` | 410 | The CLI login session expired or was denied. Start a new one. | | `payload_too_large` | 413 | The body is over 1 MB. Send less. | | `unsupported_media_type` | 415 | Send `Content-Type: application/json` (or the media type the Operation names). | | `reference_not_found` | 422 | An id in the body (assistant, project, content) does not exist. Fix it. | | `network_rules_violation` | 422 | The content breaks a social network rule (`error.details`). Shorten or change it. | | `network_not_enabled` | 422 | The network is not connected for this Workspace. | | `url_not_allowed` | 422 | The URL is not allowed (private address, wrong scheme or port). | | `schedule_in_past` | 422 | Pick a time in the future. | | `connection_needs_reauth` | 422 | The social connection must be reconnected by the user in the app. | | `provider_limit_reached` | 429 | The social network refused for quota reasons. Wait before retrying. | | `rate_limited` | 429 | Wait for `Retry-After` seconds, then retry. | | `internal` | 500 | Retry once after a few seconds; if it fails again, report the `correlationId`. | | `upstream_unavailable` | 503 | A dependency is down or not configured yet. Retry later with backoff. | ## Idempotency Operations marked **idempotent** accept `Idempotency-Key` (up to 255 characters). For 24 hours, the same key with the same body returns the first answer again, with `Idempotent-Replay: true`. The same key with another body answers `409 idempotency_key_reused`; a key whose first request is still running answers `409 idempotency_in_progress`. ## Lists and pagination List Operations take `limit` (1 to 100, default 25) and `cursor`, and answer `{items, nextCursor?}`. Pass `nextCursor` back unchanged with the same filters; a cursor from another list or filter answers `400`. ## Versions and If-Match Records you can change carry `version`. Send it as `If-Match: "3"` on an update; if someone changed the record since, the answer is `412 version_conflict` and nothing is written. ## Rate limits | Limit | Default | |---|---| | Requests per minute, per token (or per signed-in user) | 120 | | Job starts per minute, per user | 10 | | Jobs running at once, per user | 5 | Over a limit, the answer is `429 rate_limited` with `Retry-After` (seconds). `GET /api/v1/me` shows the limits that apply. ## Request ids Every answer has `X-Request-Id`, equal to `error.correlationId` on errors. You may send your own `X-Request-Id` (8 to 128 characters of `A-Z a-z 0-9 . _ -`) to tie the server logs to yours. ## Workspaces A user has one Workspace per LeadGenius company they own or are an active member of (`c:`), ordered by name, or a personal Workspace (`u:`) when they have no company. Content Operations act on the **Active Workspace**: the one named by `X-Workspace-Id`, else the first in `GET /api/v1/me`. A value that is not one of the caller's Workspaces is ignored. Memberships are read from LeadGenius and kept 5 minutes; if LeadGenius cannot be reached, these Operations answer `503 upstream_unavailable`. ## Jobs Long work (writing a blog, generating an offer, analysing leads) is a **Job**. | Field | Meaning | |---|---| | `status` | `PENDING` → `RUNNING` → `COMPLETED`, `FAILED` or `CANCELLED` | | `progress` | 0 to 100; never goes down; 100 only with `COMPLETED` | | `currentStep` | the Step that runs now (`''` when none) | | `steps` | each Step's status, and its result once completed | | `partialContent` | text written so far by the running Step | | `result.resources` | `COMPLETED` only: `[{type, id}]` of what the Job made (for example `content`, `offer`) | | `error` | `FAILED` only: `{code, message, step}`, with the codes of the table above | | `origin` | `ui`, `api` or `scheduler` | How a Job moves: - `GET /api/v1/jobs/{id}` reads it and, when no one else is working on it and nothing changed in the last 2 seconds, runs it for up to 10 seconds first. - `POST /api/v1/jobs/{id}/advance` runs it for one request; with `Accept: text/event-stream` you receive the text as it is written (`chunk`, then `view`). - Jobs started with an **API token** also run on the server every minute, so a script may start one and come back later. - `POST /api/v1/jobs/{id}/cancel` stops a running Job; `POST /api/v1/jobs/{id}/resume` restarts a `FAILED` one from the failed Step. - A Job started with a token that is later revoked, or that loses AI access, fails with `ai_access_unavailable`. Resume it with a valid token. Polling: read every 2 to 5 seconds while `RUNNING`; a blog takes one to several minutes, an offer a few minutes. ## CORS Browsers may call the API only from the app's own origins (the Lead App and ContentGenius domains). Scripts, servers, CLIs and agents are not affected. # Recipes Every recipe assumes `CGENIUS_API_URL` and `CGENIUS_API_TOKEN` are set ([Start here](/documentation)). ## Wait for a Job (any language) ```ts async function waitForJob(jobId: string): Promise { const headers = { Authorization: `Bearer ${process.env.CGENIUS_API_TOKEN}` }; for (;;) { const res = await fetch(`${process.env.CGENIUS_API_URL}/api/v1/jobs/${jobId}`, { headers }); if (res.status === 429) { await sleep(1000 * Number(res.headers.get('retry-after') ?? 5)); continue; } const body = await res.json(); if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`); const { job } = body; if (job.status === 'COMPLETED') return job.result; if (job.status === 'FAILED') throw new Error(`${job.error.code}: ${job.error.message}`); if (job.status === 'CANCELLED') throw new Error('cancelled'); await sleep(3000); } } const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); ``` ```bash job_id="" while :; do body=$(curl -sS "$CGENIUS_API_URL/api/v1/jobs/$job_id" -H "Authorization: Bearer $CGENIUS_API_TOKEN") status=$(echo "$body" | jq -r '.job.status') echo "$status $(echo "$body" | jq -r '.job.progress')%" case "$status" in COMPLETED|FAILED|CANCELLED) echo "$body" | jq '.job'; break;; esac sleep 3 done ``` ## Find your agents Generations name an EpsimoAgents **assistant** (the agent that writes). List the user's assistants and let the user pick one, or use the one they named. Scope: `content:read`; needs AI access. ```bash curl -sS "$CGENIUS_API_URL/api/v1/assistants" -H "Authorization: Bearer $CGENIUS_API_TOKEN" | jq '.items[] | {assistant_id, name}' curl -sS "$CGENIUS_API_URL/api/v1/projects" -H "Authorization: Bearer $CGENIUS_API_TOKEN" | jq '.items[] | {project_id, name}' ``` Use `assistant_id` as `agentConfiguration.defaultAgentId` (blog v3), `requestData.assistantId` (blog v2), `assistant_id` (blog v1) or `assistantId` (lead ideas). ## Write a blog (v3 engine) Scopes: `content:write`, `jobs:write`; needs AI access. ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/blogs/v3/pipelines" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"requestData":{"topic":"Zero-trust for SMBs","title":"Zero trust, small budget","keywords":"zero trust, SMB","tone":"practical","blogSize":"medium","includeFAQ":true}, "agentConfiguration":{"defaultAgentId":""}}' ``` `requestData.topic` and `agentConfiguration.defaultAgentId` are required; `researchAgentId`, `outlineAgentId` and `writingAgentId` override the default agent per phase. The Job id is the pipeline id. Read it with `GET /api/v1/blogs/v3/pipelines/{id}` or `GET /api/v1/jobs/{id}`. When it is `COMPLETED`, `result.resources` names the content item. Regenerate one section of a finished blog (index from 0): ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/blogs/v3/pipelines//sections/2/regenerate" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" -H "Idempotency-Key: $(uuidgen)" ``` Resume a failed pipeline: `POST /api/v1/blogs/v3/pipelines/{id}/resume`. ## Write a blog (v2 or v1 engine) ```bash # v2: requestData.topic, wordCount, blogSize (single|small|medium|big|huge), assistantId curl -sS -X POST "$CGENIUS_API_URL/api/v1/blogs/v2/tasks" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \ -d '{"requestData":{"topic":"Edge AI","wordCount":1200,"blogSize":"medium","assistantId":""}}' # v1: assistant_id, topic, blogSize curl -sS -X POST "$CGENIUS_API_URL/api/v1/blogs/v1/jobs" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \ -d '{"assistant_id":"","topic":"Edge AI","blogSize":"small"}' ``` ## Suggest content ideas from leads Scopes: `content:write`, `jobs:write`; needs AI access (it reads the Lead App as the user). ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/ideation/analyze" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \ -d '{"leadIds":["",""]}' ``` The finished Job's `result` holds `suggestions` and `leadsAnalyzed`. ## Generate an offer `variant`: `batch` (one section per subject) or `basic`, `zero`, `mid`, `full` (the new-batch pipelines; `mid` and `full` need `assistantsId: {"assistantsId": ""}`). ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/generate/offer" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \ -d '{"variant":"batch","client_name":"Acme","subjects":["SEO audit","Content plan"], "offerRecord":{"id":""},"assistantsId":["",""]}' ``` ## Ideas from LeadGenius leads Content ideas from the user's own LeadGenius leads, written by an agent. The agent never sees contact data (names, e-mails, phone numbers and URLs are removed). Scopes: `content:read` to list companies; `content:write` and `jobs:write` to start; needs AI access. 1. Find the company. The answer also says which company the user last used for ideas. ```bash curl -sS "$CGENIUS_API_URL/api/v1/lead-app/companies" -H "Authorization: Bearer $CGENIUS_API_TOKEN" # {"companies":[{"id":"company-…","name":"Acme","role":"owner"}],"selectedCompanyId":"company-…"} ``` 2. Start the Job. `mode` is `deep` (themes per group of 25 leads, then the ideas; a few minutes for a few hundred leads) or `quick` (statistics and 40 representative leads; about a minute). ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/ideation/lead-ideas" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"assistantId":"","companyId":"","mode":"deep","ideaCount":8, "focus":"We sell managed cloud security to mid-size manufacturers", "filters":{"minScore":60,"since":"2026-01-01"},"maxLeads":200}' ``` Optional fields: `leadIds` (hand-picked leads, at most 300), `filters.statuses`, `filters.keyword`, `maxLeads` (1 to 300), `ideaCount` (3 to 15), `focus` (what the company offers; it replaces the brand voice). 3. Wait for the Job ([Wait for a Job](#wait-for-a-job-any-language)). `job.result.suggestions` holds the ideas: topic, description, content type, target audience, angles, keywords, rationale, confidence, and the lead ids each idea comes from. `403 forbidden` means the user is not a member of that company. ## Write a social post and send it to Buffer The server writes the post with one of the user's agents and saves it to their content. Scopes: `content:write`, `jobs:write` (and `publish:write` to send). Needs AI access. 1. Start the Job. `length` is `short`, `medium` (default) or `long`. Add `"illustration":true` and an `imageAssistantId` (an assistant with the DALL-E tool) for an image; `brandVoiceId` for a brand voice; `"save":false` to keep it out of the user's content. ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/generate/social-posts" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \ -d '{"assistantId":"","topic":"Why small teams ship faster","platform":"linkedin","length":"long"}' # 202 {"job":{"jobId":"job_…","status":"PENDING",…}} ``` 2. Wait for the Job ([Wait for a Job](#wait-for-a-job-any-language)). `job.result` has `text` (what the network shows), `markdown`, `fit` (`status` `ok`, `short`, `long` or `over`), `image` (with `illustration`: `url`, the agent's link, valid about an hour; `path`, the saved copy; or a `note` when no image was made) and `contentId`, the saved post. 3. Send it: `POST /api/v1/publish/buffer` ([Publish through Buffer](#publish-through-buffer)) with `"text": job.result.text`, `"contentId": job.result.contentId` (the Buffer posts are recorded on the saved post) and, for the illustration, `"imageUrl": job.result.image.path` (the `s3://` path of the saved copy; Buffer gets a 30-day download link). Ask the user first. Emails (`POST /api/v1/generate/emails`), presentations (`POST /api/v1/generate/presentations`) and research reports (`POST /api/v1/generate/research`, with an assistant that has a web search tool) work the same way; see their fields in the [API reference](/documentation/api). ## Make a video ad from an idea The server writes a short ad script from one of the user's ideas, renders one MP4 per format on AWS Lambda and saves the ad to their content, linked to the idea. Scopes: `content:write`, `jobs:write` (and `publish:write` to post). Needs AI access. 1. Start the Job with an idea: `ideationId` (one of the user's saved ideas) or `idea` (`{"topic", "description", "targetAudience", "angles", "keywords"}`, for example a suggestion of `ideation.leadIdeas`). ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/generate/video-ads" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \ -d '{"assistantId":"","ideationId":"","formats":["9:16","1:1"],"lengthSeconds":30, "platform":"instagram","url":"acme.com/demo","brand":{"name":"Acme","primary":"#1d4ed8","accent":"#f59e0b"}}' ``` `formats`: `9:16` (Reels, TikTok, Shorts, Stories), `1:1` (feeds), `4:5` (Instagram and Facebook feed), `16:9` (YouTube, LinkedIn, X). `lengthSeconds`: 15, 30, 45 or 60. Add `"images":true` and an `imageAssistantId` (an assistant with the DALL-E tool) for photos behind up to three scenes; a photo that can't be made leaves a `note` and the ad still renders. To check the script before rendering, send `"render":false`, then start a second Job with the edited `job.result.script` as `script`. 2. Follow it with `GET /api/v1/generate/video-ads/{jobId}` (it also advances the Job). Rendering takes about 10 to 40 seconds per format. On `COMPLETED`, `job.result` has `script`, `caption` (with hashtags), `videos` (`format`, `path`, `url` valid 7 days, `width`, `height`, `durationSeconds`) and `contentId`. 3. Post it, after the user confirms: `POST /api/v1/publish/buffer` with `"text": job.result.caption`, `"contentId"`, and the right video per channel in `versions`: `{"": {"text": "", "videoUrl": ""}, "": {"text": "", "videoUrl": ""}}`. A top-level `videoUrl` goes to every channel. Paths (`s3://…`) of the user's own videos are sent to Buffer as 7-day links. ## Credits and buying Generations spend the user's EpsimoAgents credits: each new agent thread costs its model's price (1 for GPT-4o, less for cheaper models), and each rendered video costs 1. A research report is about 7, a video ad in two formats 3, a social post 1. Scopes: `settings:read` to read, `settings:write` to buy. Needs AI access. ```bash curl -sS "$CGENIUS_API_URL/api/v1/billing" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ | jq '{creditsLeft, plan: .status.subscription.plan_name, packs: [.catalog.packs[] | {id, threads, amount}]}' ``` When credits are short, a generation answers `402 credits_exhausted` before it starts (`error.details.estimatedCredits`, `creditsLeft`). To buy, after the user agrees, `POST /api/v1/billing/checkout` with `{"kind":"pack","itemId":"pack_100"}` (packs never expire) or `{"kind":"plan","itemId":"pro"}` (monthly), and give the user the returned `url` to pay on Stripe. Never pay for them. Credits are added once Stripe confirms the payment, usually within seconds: poll `GET /api/v1/billing`. `POST /api/v1/billing/portal` opens the Stripe portal to change or cancel a plan. ## Send content to your sites `GET /api/v1/content?type=social_post` lists the user's saved content, newest first; `GET /api/v1/content/{id}` reads one record. `GET /api/v1/publish/endpoints` lists the user's sites (Settings → Integrations). After the user confirms, send: ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/content//send" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" -d '{"endpointId":""}' # {"ok":true,"httpStatus":200,"message":"Accepted (HTTP 200): …","delivery":{…}} ``` The default `simple` format sends the title, the HTML content and the featured image link; `"options":{"format":"full"}` sends every section and field. `ok: false` means the site refused it (see `httpStatus` and `message`). The send is recorded on the content either way. ## Size a social post for each channel Each network has its own limit, ideal length, structure and hashtag count. Read the rules once and write to them, then check the text before publishing. Scope: `content:read`. No AI access needed. ```bash curl -sS "$CGENIUS_API_URL/api/v1/social/channels" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ | jq '.channels[] | {channel, maxChars, target, lengths, structure, hashtags, image}' ``` | Channel | Limit | Short | Standard (`target`) | Long | Hashtags | Image | |---|---|---|---|---|---|---| | LinkedIn (`linkedin`) | 3,000 | 400 to 800 | 1,300 to 2,000; hook in the first 210 characters | 2,200 to 2,900 | 3 to 5 | 1200 × 627 | | X (`twitter` or `x`) | 280 | 50 to 120 | 120 to 220; threads | 220 to 275 | at most 2 | 1600 × 900 | | Facebook (`facebook`) | 5,000 | 80 to 250 | 400 to 800 | 1,000 to 2,000 | at most 3 | 1200 × 630 | | Instagram (`instagram`) | 2,196 | 150 to 400 | 500 to 1,000; hook in the first 125 characters | 1,200 to 2,100 | 5 to 15 | 1080 × 1350 | | Threads (`threads`) | 500 | 100 to 200 | 200 to 350; threads | 350 to 480 | at most 1 | 1080 × 1350 | `lengths` gives the short, medium (standard) and long ranges; `target` is the medium one, and `social/fit` checks against it. The API answer is the source of truth. Check a draft and get a version that fits: ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/social/fit" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -d '{"channel":"x","text":""}' # {"channel":"twitter","length":412,"maxChars":280,"status":"over","hashtagCount":4,"hashtagsOk":false, # "fitted":"","thread":["… 1/2","… 2/2"]} ``` `status` is `over` (the network refuses it), `long` or `short` (outside the ideal range) or `ok`. `fitted` is cut at a paragraph, sentence or word, keeps the first hashtags allowed, and equals the text when it already fits. `thread` is there when the channel has threads and the post is longer than one post. Prefer rewriting the post yourself to the rules; use `fitted` when the user wants a quick cut. ## Receive content on your site When a user sends content to an endpoint of **Settings › Integrations** ("Send to your sites"), cgenius sends it to the endpoint URL as JSON, in one of two formats the user picks: **Simple** (the default, ready for WordPress) or **Full**. Headers of every request: | Header | Value | |---|---| | `Authorization` | Bearer , when one is set | | `X-Publish-Event` | content.publish (JSON) or content.image (multipart/form-data) | | `X-Publish-Delivery-Id` | The deliveryId | | `Content-Type` | application/json, or multipart/form-data for images | | `User-Agent` | EpsimoAI-Publisher/1.0 (or the User-Agent set in the endpoint headers) | ### Simple format (the default): ready for WordPress One request with a flat object: the post fields WordPress needs, the featured image, and a little context. Every key is always present (`null` or `[]` when there is nothing). Choose **Full** in the dialog for the body split into sections and blocks and every detail of the record (described below). ```json { "event": "content.publish", "format": "simple", "schemaVersion": 1, "deliveryId": "5b7a3c0e-1f2d-4c5b-9a8e-7d6c5b4a3f21", "sentAt": "2026-12-02T09:00:00.000Z", "id": "44ec852a-3956-4a89-a6a5-b101882c45ec", "type": "blog", "status": "publish", "title": "A lead handoff checklist for marketing and sales", "slug": "lead-handoff-checklist", "excerpt": "A lead handoff is the point at which a marketing conversation becomes a sales responsibility.", "content": "

A lead handoff is the point at which a marketing conversation becomes a sales responsibility.

Agree on what makes a lead ready for sales

Work through the following checklist together:

  • Define a suitable organisation. Agree which types of organisation you can serve.
  • Define a relevant need. Identify the problems that make an enquiry worth discussing.

\"Handoff

Conclusion

  1. Is the next owner clear?
  2. Can it be recorded in the CRM?

Want help? Talk to us.

", "featured_image": { "url": "https://app.cgenius.app/api/publish/image-links/0448c448-0000-4000-8000-000000000000/ep-1/AQICAHh-sample-token/lead-handoff-checklist-featured-1.png", "alt": null, "filename": "lead-handoff-checklist-featured-1.png" }, "images": [ { "url": "https://app.cgenius.app/api/publish/image-links/0448c448-0000-4000-8000-000000000000/ep-1/AQICAHh-sample-token/lead-handoff-checklist-inline-2.png", "alt": "Handoff stages", "filename": "lead-handoff-checklist-inline-2.png" } ], "videos": [], "tags": [ "crm" ], "seo": { "title": "Lead handoff checklist", "description": "A lead handoff is the point at which a marketing conversation becomes a sales responsibility.", "keywords": [ "lead handoff", "lead qualification", "CRM" ] }, "context": { "topic": "Lead handoff checklist", "audience": "Demand-generation and sales leaders", "tone": "professional", "word_count": 81, "reading_time_minutes": 1, "created_at": "2026-12-01T10:00:00.000Z", "updated_at": "2026-12-01T11:30:00.000Z", "platform": null, "hashtags": [], "subject": null, "source": "canvas" } } ``` | Field | In WordPress | |---|---| | `title` | Post title (post_title) | | `content` | Post content (post_content) | | `excerpt` | Excerpt (post_excerpt) | | `slug` | Slug (post_name) | | `status` | Status: publish or draft (post_status) | | `tags` | Tags, by name | | `featured_image.url` | Featured image: download it to the media library, then set it as the post thumbnail | | `images[].url` | Body images: download each one and replace its url in content (the links last 30 days) | | `videos[].url` | Video ads: a [video] shortcode (or a video block) in the content | | `seo.title, seo.description` | Yoast (_yoast_wpseo_title, _yoast_wpseo_metadesc) or Rank Math (rank_math_title, rank_math_description) | | `id` | A post meta (_cgenius_id), to update the same post on the next send | #### WordPress plugin (no other tool needed) Point the cgenius endpoint at `https://YOUR-SITE/wp-json/cgenius/v1/publish` with a token, and install this plugin: ```php Integrations: endpoint URL https://YOUR-SITE/wp-json/cgenius/v1/publish, same token. */ add_action('rest_api_init', function () { register_rest_route('cgenius/v1', '/publish', [ 'methods' => 'POST', 'callback' => 'cgenius_receive', 'permission_callback' => function (WP_REST_Request $request) { return defined('CGENIUS_TOKEN') && CGENIUS_TOKEN !== '' && hash_equals('Bearer ' . CGENIUS_TOKEN, (string) $request->get_header('authorization')); }, ]); }); function cgenius_receive(WP_REST_Request $request) { $p = $request->get_json_params(); if (($p['event'] ?? '') !== 'content.publish' || ($p['format'] ?? '') !== 'simple') { return new WP_Error('cgenius_format', 'Send the Simple format', ['status' => 400]); } require_once ABSPATH . 'wp-admin/includes/media.php'; require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/image.php'; // The same cgenius content updates the post made for it. $existing = get_posts([ 'post_type' => 'post', 'post_status' => 'any', 'numberposts' => 1, 'fields' => 'ids', 'meta_key' => '_cgenius_id', 'meta_value' => $p['id'], ]); $post = [ 'post_type' => 'post', 'post_title' => $p['title'], 'post_content' => $p['content'], 'post_excerpt' => $p['excerpt'], 'post_name' => $p['slug'], 'post_status' => $p['status'] === 'publish' ? 'publish' : 'draft', 'post_author' => defined('CGENIUS_AUTHOR_ID') ? CGENIUS_AUTHOR_ID : 1, ]; if ($existing) $post['ID'] = $existing[0]; $id = wp_insert_post(wp_slash($post), true); if (is_wp_error($id)) return $id; update_post_meta($id, '_cgenius_id', $p['id']); wp_set_post_tags($id, $p['tags'], false); // Body images: copy them to the media library (the cgenius links last 30 days). $content = $p['content']; foreach ($p['images'] as $img) { $media = media_sideload_image($img['url'], $id, $img['alt'] ?? '', 'id'); if (!is_wp_error($media)) $content = str_replace($img['url'], wp_get_attachment_url($media), $content); } // Video ads: each rendered video, played in the post. foreach (($p['videos'] ?? []) as $video) { $content .= "\n\n" . '[video src="' . esc_url($video['url']) . '"]'; } if ($content !== $p['content']) wp_update_post(wp_slash(['ID' => $id, 'post_content' => $content])); // Featured image. if (!empty($p['featured_image']['url'])) { $media = media_sideload_image($p['featured_image']['url'], $id, $p['featured_image']['alt'] ?? '', 'id'); if (!is_wp_error($media)) set_post_thumbnail($id, $media); } // SEO plugin fields (keep the lines of the plugin you use). update_post_meta($id, '_yoast_wpseo_title', $p['seo']['title']); update_post_meta($id, '_yoast_wpseo_metadesc', $p['seo']['description']); update_post_meta($id, 'rank_math_title', $p['seo']['title']); update_post_meta($id, 'rank_math_description', $p['seo']['description']); // cgenius shows this link on the content. return ['id' => $id, 'url' => get_permalink($id)]; } ``` #### From an automation tool (n8n, Make, Activepieces…) Map the fields above to a "Create post" step, or use this JavaScript, which creates the post through the WordPress REST API with an application password: ```js // cgenius (Simple format) -> a WordPress post, through the WordPress REST API. // Node 18+, n8n Code node, Pipedream... No dependencies. // wp = { url: "https://your-site.example", user: "editor", appPassword: "xxxx xxxx xxxx xxxx" } // (Users > Profile > Application Passwords in WordPress). async function publishToWordPress(body, wp) { if (typeof body === "string") body = JSON.parse(body); if (body.event !== "content.publish" || body.format !== "simple") throw new Error("Send the Simple format"); const auth = "Basic " + Buffer.from(wp.user + ":" + wp.appPassword).toString("base64"); const api = (path, init = {}) => fetch(wp.url.replace(/\/$/, "") + "/wp-json/wp/v2" + path, { ...init, headers: { Authorization: auth, ...init.headers } }) .then(async (r) => { if (!r.ok) throw new Error(path + ": HTTP " + r.status + " " + (await r.text())); return r.json(); }); // Copy an image to the media library; returns its id and URL. const upload = async (img) => { const file = await fetch(img.url); const media = await api("/media", { method: "POST", headers: { "Content-Type": file.headers.get("content-type") || "image/png", "Content-Disposition": 'attachment; filename="' + (img.filename || "image.png") + '"' }, body: Buffer.from(await file.arrayBuffer()), }); if (img.alt) await api("/media/" + media.id, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ alt_text: img.alt }) }); return media; }; // Tags by name: find or create each one. const tagIds = []; for (const name of body.tags) { const found = await api("/tags?search=" + encodeURIComponent(name)); const tag = found.find((t) => t.name.toLowerCase() === name.toLowerCase()) || (await api("/tags", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name }) })); tagIds.push(tag.id); } let content = body.content; for (const img of body.images) content = content.split(img.url).join((await upload(img)).source_url); // Video ads: each rendered video as a video block. for (const v of body.videos || []) content += '\n
'; const featured = body.featured_image ? await upload(body.featured_image) : null; return api("/posts", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ title: body.title, content, excerpt: body.excerpt, slug: body.slug, status: body.status, // "publish" or "draft" tags: tagIds, ...(featured ? { featured_media: featured.id } : {}), }), }); // returns the post; answer cgenius with { url: post.link } } ``` #### JSON Schema (simple format) ```json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://app.cgenius.app/schemas/content.publish.simple.v1.json", "title": "cgenius content.publish, simple format (schemaVersion 1)", "type": "object", "properties": { "event": { "type": "string", "const": "content.publish", "description": "Always \"content.publish\"" }, "format": { "type": "string", "const": "simple", "description": "Always \"simple\"" }, "schemaVersion": { "type": "integer", "const": 1, "description": "1" }, "deliveryId": { "type": "string", "description": "The id of this send" }, "sentAt": { "type": "string", "format": "date-time", "description": "When it was sent (ISO 8601)" }, "id": { "type": "string", "description": "cgenius content id: the same content sent again has the same id, so update the post you made for it" }, "type": { "type": "string", "description": "blog, social (or the network: linkedin...), email..." }, "status": { "type": "string", "enum": [ "publish", "draft" ], "description": "publish, or draft to keep it as a draft" }, "title": { "type": "string", "description": "Post title" }, "slug": { "type": "string", "description": "URL slug" }, "excerpt": { "type": "string", "description": "Short summary" }, "content": { "type": "string", "description": "The body as HTML, without the title; images point at download links" }, "featured_image": { "type": [ "object", "null" ], "properties": { "url": { "type": "string", "description": "Download link (no sign-in, valid 30 days): copy the image to your media library" }, "alt": { "type": [ "string", "null" ], "description": "Alt text" }, "filename": { "type": [ "string", "null" ], "description": "A file name for it" } }, "required": [ "url", "alt", "filename" ], "description": "The main image; null when there is none" }, "images": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Download link (no sign-in, valid 30 days): copy the image to your media library" }, "alt": { "type": [ "string", "null" ], "description": "Alt text" }, "filename": { "type": [ "string", "null" ], "description": "A file name for it" } }, "required": [ "url", "alt", "filename" ], "description": "An image" }, "description": "The other images of the body (already in content by their url)" }, "videos": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "Public download link of the MP4" }, "format": { "type": "string", "description": "9:16, 1:1, 4:5 or 16:9" }, "width": { "type": [ "integer", "null" ], "description": "Width in pixels" }, "height": { "type": [ "integer", "null" ], "description": "Height in pixels" }, "duration_seconds": { "type": [ "number", "null" ], "description": "Length in seconds" } }, "required": [ "url", "format", "width", "height", "duration_seconds" ], "description": "A video" }, "description": "Rendered videos (video ads); [] for other content" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "Tag names" }, "seo": { "type": "object", "properties": { "title": { "type": "string", "description": "SEO title (70 characters at most)" }, "description": { "type": "string", "description": "Meta description (160 characters at most)" }, "keywords": { "type": "array", "items": { "type": "string" }, "description": "Keywords" } }, "required": [ "title", "description", "keywords" ], "description": "For your SEO plugin" }, "context": { "type": "object", "properties": { "topic": { "type": [ "string", "null" ], "description": "Topic" }, "audience": { "type": [ "string", "null" ], "description": "Target audience" }, "tone": { "type": [ "string", "null" ], "description": "Tone" }, "word_count": { "type": "integer", "description": "Words" }, "reading_time_minutes": { "type": "integer", "description": "Reading time at 200 words a minute" }, "created_at": { "type": [ "string", "null" ], "description": "Created (ISO 8601)" }, "updated_at": { "type": [ "string", "null" ], "description": "Last changed (ISO 8601)" }, "platform": { "type": [ "string", "null" ], "description": "Social posts: the network" }, "hashtags": { "type": "array", "items": { "type": "string" }, "description": "Social posts: hashtags, with #" }, "subject": { "type": [ "string", "null" ], "description": "Emails: the subject" }, "source": { "type": [ "string", "null" ], "description": "Where it was written (canvas...)" } }, "required": [ "topic", "audience", "tone", "word_count", "reading_time_minutes", "created_at", "updated_at", "platform", "hashtags", "subject", "source" ], "description": "Details that are not post fields" } }, "required": [ "event", "format", "schemaVersion", "deliveryId", "sentAt", "id", "type", "status", "title", "slug", "excerpt", "content", "featured_image", "images", "videos", "tags", "seo", "context" ], "description": "A post cgenius sends to your endpoint (one request, Content-Type: application/json). Every key is always present." } ``` ### Full format The full format makes these requests, in this order: 1. **The structured content**: one `POST` with `Content-Type: application/json` and `event: "content.publish"`. By default this is the only request: every image is a download link in `images[].url` (no sign-in, valid 30 days), and the `` of the HTML points at it. 2. **Each image file**, only when the user chooses "Links, then each file in its own request": one `POST` per image, `multipart/form-data`, `event: "content.image"`, the file in the field `file`, with the same `deliveryId`. A webhook tool that shows only its last request then shows an image request: the content is the one before it. Every key of the JSON is always there (`null`, `[]` or `{}` when there is nothing), so a parser built from the sample below fits every send. Copy the sample or the JSON Schema into your tool, or start from the parsers. ### Sample request ```json { "event": "content.publish", "schemaVersion": 1, "deliveryId": "5b7a3c0e-1f2d-4c5b-9a8e-7d6c5b4a3f21", "sentAt": "2026-12-02T09:00:00.000Z", "status": "publish", "endpoint": { "id": "ep-1", "name": "My website" }, "imageDelivery": "link", "content": { "id": "44ec852a-3956-4a89-a6a5-b101882c45ec", "type": "blog", "kind": "blog", "title": "Lead handoff checklist", "headline": "A lead handoff checklist for marketing and sales", "slug": "lead-handoff-checklist", "subtitle": null, "excerpt": "A lead handoff is the point at which a marketing conversation becomes a sales responsibility.", "tags": [ "blog", "crm" ], "topic": "Lead handoff checklist", "tone": "professional", "audience": "Demand-generation and sales leaders", "source": "canvas", "threadId": "7f0c1d2e-0000-4000-8000-000000000000", "createdAt": "2026-12-01T10:00:00.000Z", "updatedAt": "2026-12-01T11:30:00.000Z", "body": { "html": "

A lead handoff checklist for marketing and sales

A lead handoff is the point at which a marketing conversation becomes a sales responsibility.

Agree on what makes a lead ready for sales

Work through the following checklist together:

  • Define a suitable organisation. Agree which types of organisation you can serve.
  • Define a relevant need. Identify the problems that make an enquiry worth discussing.

\"Handoff

Conclusion

  1. Is the next owner clear?
  2. Can it be recorded in the CRM?

Want help? Talk to us.

", "markdown": "# A lead handoff checklist for marketing and sales\n\nA lead handoff is…", "text": "A lead handoff checklist for marketing and sales\nA lead handoff is the point at which a marketing conversation becomes a sales responsibility.\nAgree on what makes a lead ready for sales\nWork through the following checklist together:\nDefine a suitable organisation. Agree which types of organisation you can serve.\nDefine a relevant need. Identify the problems that make an enquiry worth discussing.\nConclusion\nIs the next owner clear?\nCan it be recorded in the CRM?\nWant help? Talk to us." }, "sections": [ { "index": 0, "heading": null, "level": 0, "anchor": null, "text": "A lead handoff is the point at which a marketing conversation becomes a sales responsibility.", "html": "

A lead handoff is the point at which a marketing conversation becomes a sales responsibility.

", "blocks": [ { "type": "paragraph", "text": "A lead handoff is the point at which a marketing conversation becomes a sales responsibility.", "html": "

A lead handoff is the point at which a marketing conversation becomes a sales responsibility.

", "level": null, "ordered": null, "items": [], "imageId": null, "src": null, "alt": null, "language": null, "rows": [] } ] }, { "index": 1, "heading": "Agree on what makes a lead ready for sales", "level": 2, "anchor": "agree-on-what-makes-a-lead-ready-for-sales", "text": "Work through the following checklist together:\nDefine a suitable organisation. Agree which types of organisation you can serve.\nDefine a relevant need. Identify the problems that make an enquiry worth discussing.", "html": "

Work through the following checklist together:

  • Define a suitable organisation. Agree which types of organisation you can serve.
  • Define a relevant need. Identify the problems that make an enquiry worth discussing.

\"Handoff

", "blocks": [ { "type": "paragraph", "text": "Work through the following checklist together:", "html": "

Work through the following checklist together:

", "level": null, "ordered": null, "items": [], "imageId": null, "src": null, "alt": null, "language": null, "rows": [] }, { "type": "list", "text": "Define a suitable organisation. Agree which types of organisation you can serve.\nDefine a relevant need. Identify the problems that make an enquiry worth discussing.", "html": "
  • Define a suitable organisation. Agree which types of organisation you can serve.
  • Define a relevant need. Identify the problems that make an enquiry worth discussing.
", "level": null, "ordered": false, "items": [ { "label": "Define a suitable organisation.", "text": "Define a suitable organisation. Agree which types of organisation you can serve.", "html": "Define a suitable organisation. Agree which types of organisation you can serve." }, { "label": "Define a relevant need.", "text": "Define a relevant need. Identify the problems that make an enquiry worth discussing.", "html": "Define a relevant need. Identify the problems that make an enquiry worth discussing." } ], "imageId": null, "src": null, "alt": null, "language": null, "rows": [] }, { "type": "image", "text": "Handoff stages", "html": "

\"Handoff

", "level": null, "ordered": null, "items": [], "imageId": "inline-1", "src": "https://app.cgenius.app/api/publish/image-links/0448c448-0000-4000-8000-000000000000/ep-1/AQICAHh-sample-token/lead-handoff-checklist-inline-2.png", "alt": "Handoff stages", "language": null, "rows": [] } ] }, { "index": 2, "heading": "Conclusion", "level": 2, "anchor": "conclusion", "text": "Is the next owner clear?\nCan it be recorded in the CRM?\nWant help? Talk to us.", "html": "
  1. Is the next owner clear?
  2. Can it be recorded in the CRM?

Want help? Talk to us.

", "blocks": [ { "type": "list", "text": "Is the next owner clear?\nCan it be recorded in the CRM?", "html": "
  1. Is the next owner clear?
  2. Can it be recorded in the CRM?
", "level": null, "ordered": true, "items": [ { "label": null, "text": "Is the next owner clear?", "html": "Is the next owner clear?" }, { "label": null, "text": "Can it be recorded in the CRM?", "html": "Can it be recorded in the CRM?" } ], "imageId": null, "src": null, "alt": null, "language": null, "rows": [] }, { "type": "paragraph", "text": "Want help? Talk to us.", "html": "

Want help? Talk to us.

", "level": null, "ordered": null, "items": [], "imageId": null, "src": null, "alt": null, "language": null, "rows": [] } ] } ], "links": [ { "text": "Talk to us", "url": "https://example.com/contact" } ], "callToAction": { "text": "Talk to us", "url": "https://example.com/contact" }, "seo": { "metaTitle": "Lead handoff checklist", "metaDescription": "A lead handoff is the point at which a marketing conversation becomes a sales responsibility.", "keywords": [ "lead handoff", "lead qualification", "CRM" ] }, "social": null, "email": null, "slides": [], "metrics": { "wordCount": 81, "characterCount": 488, "readingTimeMinutes": 1, "sectionCount": 3, "imageCount": 2 }, "fields": {} }, "featuredImageId": "illustration", "images": [ { "id": "illustration", "role": "featured", "alt": null, "caption": null, "originalSrc": null, "filename": "lead-handoff-checklist-featured-1.png", "contentType": "image/png", "size": null, "url": "https://app.cgenius.app/api/publish/image-links/0448c448-0000-4000-8000-000000000000/ep-1/AQICAHh-sample-token/lead-handoff-checklist-featured-1.png", "data": null, "note": null, "delivery": "link" }, { "id": "inline-1", "role": "inline", "alt": "Handoff stages", "caption": null, "originalSrc": "https://app.cgenius.app/api/image-proxy?url=s3%3A%2F%2Fbucket%2FpdfFile%2Fu%2Fchart.png", "filename": "lead-handoff-checklist-inline-2.png", "contentType": "image/png", "size": null, "url": "https://app.cgenius.app/api/publish/image-links/0448c448-0000-4000-8000-000000000000/ep-1/AQICAHh-sample-token/lead-handoff-checklist-inline-2.png", "data": null, "note": null, "delivery": "link" } ], "videos": [] } ``` ### Field reference | Field | Type | Meaning | |---|---|---| | `event` | string | Always "content.publish" (the images come as "content.image" requests) | | `schemaVersion` | integer | 1. A new version is announced before it changes how a key is read | | `deliveryId` | string | The id of this send; the image requests carry it too | | `sentAt` | string | When it was sent (ISO 8601) | | `status` | string | What the user asks your site to do: publish it, or keep it as a draft | | `endpoint` | object | Your endpoint, as named in cgenius | | `endpoint.id` | string | Endpoint id | | `endpoint.name` | string | Endpoint name | | `imageDelivery` | string | How the images come: link (download links in this request, the default), separate (links, then each file in its own request), inline (links and base64), or none | | `content` | object | The content | | `content.id` | string | cgenius content id (stable: use it to update the same post on a new send) | | `content.type` | string | Stored type: blog, social_post, email, research_report, commercial_offer, presentation… | | `content.kind` | string | Normalized kind: blog, social (or the network: linkedin, twitter…), email, presentation… | | `content.title` | string | The title of the content | | `content.headline` | string | null | The h1 the body opens with (the displayed title); not repeated in sections | | `content.slug` | string | A URL slug of the title | | `content.subtitle` | string | null | Subtitle | | `content.excerpt` | string | A short summary (about 300 characters) | | `content.tags` | string[] | Tags | | `content.topic` | string | null | Topic | | `content.tone` | string | null | Tone (professional, friendly…) | | `content.audience` | string | null | Target audience | | `content.source` | string | null | Where it was written (canvas, presentation-editor) | | `content.threadId` | string | null | Canvas thread id | | `content.createdAt` | string | null | Created (ISO 8601) | | `content.updatedAt` | string | null | Last changed (ISO 8601) | | `content.body` | object | The whole body; a format not chosen in the send options is null | | `content.body.html` | string | null | HTML | | `content.body.markdown` | string | null | Markdown (content written in the Canvas) | | `content.body.text` | string | null | Plain text | | `content.sections` | object[] | The body split at its headings, each with its blocks | | `content.sections[].index` | integer | 0, 1, 2… in reading order | | `content.sections[].heading` | string | null | The heading text; null for the text before the first heading | | `content.sections[].level` | integer | Heading level 1 to 3; 0 for the text before the first heading | | `content.sections[].anchor` | string | null | A slug of the heading, for in-page links; null without a heading | | `content.sections[].text` | string | The section as plain text (one line per paragraph or list item) | | `content.sections[].html` | string | The section as HTML, without its heading | | `content.sections[].blocks` | object[] | The section, block by block | | `content.sections[].blocks[].type` | string | paragraph, list, heading (h4–h6), quote, code, image, table, divider, or html (anything else, kept as is) | | `content.sections[].blocks[].text` | string | Plain text (list: one line per item; code: the code) | | `content.sections[].blocks[].html` | string | The block as HTML | | `content.sections[].blocks[].level` | integer | null | heading: 4 to 6; else null | | `content.sections[].blocks[].ordered` | boolean | null | list: true when numbered; else null | | `content.sections[].blocks[].items` | object[] | list: its items; else [] | | `content.sections[].blocks[].items[].label` | string | null | The item’s leading bold text ("Name the owner"), without a trailing colon; null when the item has none | | `content.sections[].blocks[].items[].text` | string | The item as plain text | | `content.sections[].blocks[].items[].html` | string | The item as HTML | | `content.sections[].blocks[].imageId` | string | null | image: its id in images[]; else null | | `content.sections[].blocks[].src` | string | null | image: its src in the HTML; else null | | `content.sections[].blocks[].alt` | string | null | image: its alt text; else null | | `content.sections[].blocks[].language` | string | null | code: its language when known; else null | | `content.sections[].blocks[].rows` | array[] | table: the cells’ text, row by row, header row first; else [] | | `content.links` | object[] | Every link of the body, in order | | `content.links[].text` | string | Link text | | `content.links[].url` | string | URL | | `content.callToAction` | object | null | The call to action: the post’s own, else the last link of the last section; null when there is none | | `content.callToAction.text` | string | Text | | `content.callToAction.url` | string | null | URL | | `content.seo` | object | Search details | | `content.seo.metaTitle` | string | Title for (70 characters at most) | | `content.seo.metaDescription` | string | Meta description (160 characters at most) | | `content.seo.keywords` | string[] | Keywords | | `content.social` | object | null | Social posts; null for other content | | `content.social.platform` | string | null | linkedin, twitter, facebook, instagram, threads | | `content.social.hashtags` | string[] | Hashtags, with # | | `content.social.callToAction` | string | null | Call to action text | | `content.social.length` | string | null | short, medium or long | | `content.email` | object | null | Emails; null for other content | | `content.email.subject` | string | null | Subject | | `content.email.recipient` | string | null | Recipient | | `content.slides` | object[] | Presentations: the slides; else [] | | `content.slides[].title` | string | Title | | `content.slides[].content` | string | Text | | `content.slides[].notes` | string | Speaker notes | | `content.slides[].imageUrl` | string | null | Download link of the slide image (also in images[], id "slide-1", "slide-2"…); null when it has none | | `content.metrics` | object | Counts | | `content.metrics.wordCount` | integer | Words | | `content.metrics.characterCount` | integer | Characters of the plain text | | `content.metrics.readingTimeMinutes` | integer | Reading time at 200 words a minute | | `content.metrics.sectionCount` | integer | Sections | | `content.metrics.imageCount` | integer | Images in images[] | | `content.fields` | object | Every other field of the record (research, ideas…); {} when the user left them out | | `featuredImageId` | string | null | The id in images[] of the main image; null when there is none | | `images` | object[] | Every image of the content | | `images[].id` | string | Its id: featured and gallery images "linked-…", the saved illustration "illustration", body images "inline-1", "inline-2"…, slide images "slide-1", "slide-2"… | | `images[].role` | string | featured (the main image), illustration, gallery, or inline (in the body) | | `images[].alt` | string | null | Alt text | | `images[].caption` | string | null | Caption | | `images[].originalSrc` | string | null | inline images: the src used in body.html and blocks, to replace with your own URL | | `images[].filename` | string | null | A file name for it ("my-post-featured-1.png") | | `images[].contentType` | string | null | image/png, image/jpeg, image/webp or image/gif | | `images[].size` | integer | null | Bytes | | `images[].delivery` | string | link: download it from url; file: url too, and the file comes next in its own request (content.image); inline: url too, and the bytes in data; unavailable: not sent (see note) | | `images[].url` | string | null | A download link, no sign-in needed (the app’s own images: valid 30 days); null when not sent | | `images[].data` | string | null | inline: the image bytes in base64; else null | | `images[].note` | string | null | Why the image went another way or was not sent | | `videos` | object[] | Rendered videos (video ads); [] for other content | | `videos[].format` | string | 9:16, 1:1, 4:5 or 16:9 | | `videos[].url` | string | Public download link of the MP4 | | `videos[].width` | integer | null | Width in pixels | | `videos[].height` | integer | null | Height in pixels | | `videos[].durationSeconds` | number | null | Length in seconds | | `videos[].sizeInBytes` | integer | null | File size | ### Image requests | Form field | Meaning | |---|---| | `file` | The image file (with its file name and content type) | | `event` | Always "content.image" | | `deliveryId` | The deliveryId of the content request it belongs to | | `contentId` | content.id | | `imageId` | Its id in images[] of the content request | | `role` | featured, illustration, gallery or inline | | `index` | 0, 1, 2… among the files of this send | | `total` | How many files this send has | | `alt` | Alt text (only when there is one) | | `caption` | Caption (only when there is one) | | `originalSrc` | inline images: the src used in the body (only for those) | ### No-code tools (n8n, Make, Zapier, Activepieces…) 1. Use a webhook trigger that parses JSON (not a "raw" webhook): the fields then arrive under body (for example body.content.title). 2. If the tool asks for a sample or a data structure, paste the sample JSON (or the JSON Schema). Every key is always present, so the structure it builds fits every send. 3. Images: download each one from images[].url (an HTTP GET, no sign-in) when you need the file; the HTML already points at those links. 4. If the user sends files too ("then each file in its own request"), branch on the X-Publish-Event header (or body.event): content.publish is the post; content.image is one image file (multipart, field "file"), with deliveryId and imageId to attach it to the post. 5. Loop over body.content.sections (heading, text, html, blocks) to build the page, or use body.content.body.html (or .markdown) as a whole. 6. Use body.content.id as the key of the post: a new send of the same content has the same id, so update instead of duplicating. 7. Answer 2xx when it is stored. Answer JSON with "url" (or "link") to show the published page on the content in cgenius. ### JavaScript ```js // cgenius → your site (schemaVersion 1). Plain JavaScript, no dependencies: // Node, n8n Code node, Pipedream, Activepieces code step, Cloudflare Workers... // Give it the request body (already parsed JSON, or the raw JSON string). function parseCgeniusContent(body) { if (typeof body === "string") body = JSON.parse(body); if (!body || body.event !== "content.publish") throw new Error("Not a cgenius content request"); if (body.schemaVersion !== 1) console.warn("cgenius schemaVersion " + body.schemaVersion + ": check the field reference"); const c = body.content; const imagesById = Object.fromEntries(body.images.map((i) => [i.id, i])); return { deliveryId: body.deliveryId, // the image requests that follow carry the same id publish: body.status === "publish", // false: keep it as a draft id: c.id, // stable: update the same post on a new send type: c.type, kind: c.kind, title: c.headline || c.title, slug: c.slug, subtitle: c.subtitle, excerpt: c.excerpt, tags: c.tags, seo: c.seo, // { metaTitle, metaDescription, keywords } html: c.body.html, markdown: c.body.markdown, text: c.body.text, sections: c.sections.map((s) => ({ heading: s.heading, level: s.level, anchor: s.anchor, text: s.text, html: s.html, paragraphs: s.blocks.filter((b) => b.type === "paragraph").map((b) => b.text), lists: s.blocks.filter((b) => b.type === "list").map((b) => ({ ordered: b.ordered, items: b.items.map((i) => ({ label: i.label, text: i.text })), })), images: s.blocks.filter((b) => b.type === "image").map((b) => imagesById[b.imageId] || { src: b.src, alt: b.alt }), blocks: s.blocks, // everything, in order })), links: c.links, callToAction: c.callToAction, // { text, url } or null social: c.social, // social posts, else null email: c.email, // emails, else null slides: c.slides, metrics: c.metrics, fields: c.fields, // every other detail of the record featuredImage: body.featuredImageId ? imagesById[body.featuredImageId] : null, images: body.images, // Each image: i.url downloads it (no sign-in). Body images: <img src> in html already points at i.url. imageFilesToExpect: body.images.filter((i) => i.delivery === "file").length, // requests that follow ("separate" only) }; } // An image request (multipart/form-data, field "file"): keep it with its post. // fields = the form fields, file = the uploaded file (name, type, bytes). function parseCgeniusImage(fields, file) { if (fields.event !== "content.image") throw new Error("Not a cgenius image request"); return { deliveryId: fields.deliveryId, contentId: fields.contentId, imageId: fields.imageId, // matches images[].id of the content request role: fields.role, // featured | illustration | gallery | inline index: Number(fields.index), total: Number(fields.total), alt: fields.alt || null, originalSrc: fields.originalSrc || null, // inline images: replace this src in the HTML file, }; } // Example: Express, one URL for both requests. // npm i express multer // const express = require("express"); // const multer = require("multer"); // const app = express(); // const upload = multer({ storage: multer.memoryStorage() }); // app.post("/cgenius", express.json({ limit: "20mb" }), upload.single("file"), (req, res) => { // if (req.get("authorization") !== "Bearer " + process.env.CGENIUS_ENDPOINT_TOKEN) return res.sendStatus(401); // const event = req.get("x-publish-event") || (req.body && req.body.event); // if (event === "content.publish") { // const post = parseCgeniusContent(req.body); // // ...create or update the post with id post.id... // return res.status(201).json({ url: "https://your-site.example/blog/" + post.slug }); // shown on the content in cgenius // } // if (event === "content.image") { // const image = parseCgeniusImage(req.body, req.file); // req.file.buffer, .originalname, .mimetype // // ...store the file, attach it to the post with id image.contentId... // return res.json({ ok: true }); // } // res.status(400).json({ error: "Unknown event" }); // }); // app.listen(3000); ``` ### Python ```python # cgenius -> your site (schemaVersion 1). Python 3.8+, no dependencies. import json def parse_cgenius_content(body): """body: the request JSON (dict) or its raw text.""" if isinstance(body, (str, bytes)): body = json.loads(body) if body.get("event") != "content.publish": raise ValueError("Not a cgenius content request") c = body["content"] images_by_id = {i["id"]: i for i in body["images"]} return { "delivery_id": body["deliveryId"], # the image requests carry the same id "publish": body["status"] == "publish", # False: keep it as a draft "id": c["id"], # stable: update the same post on a new send "type": c["type"], "kind": c["kind"], "title": c["headline"] or c["title"], "slug": c["slug"], "subtitle": c["subtitle"], "excerpt": c["excerpt"], "tags": c["tags"], "seo": c["seo"], # metaTitle, metaDescription, keywords "html": c["body"]["html"], "markdown": c["body"]["markdown"], "text": c["body"]["text"], "sections": [ { "heading": s["heading"], "level": s["level"], "anchor": s["anchor"], "text": s["text"], "html": s["html"], "paragraphs": [b["text"] for b in s["blocks"] if b["type"] == "paragraph"], "lists": [ {"ordered": b["ordered"], "items": [{"label": i["label"], "text": i["text"]} for i in b["items"]]} for b in s["blocks"] if b["type"] == "list" ], "images": [images_by_id.get(b["imageId"]) or {"src": b["src"], "alt": b["alt"]} for b in s["blocks"] if b["type"] == "image"], "blocks": s["blocks"], # everything, in order } for s in c["sections"] ], "links": c["links"], "call_to_action": c["callToAction"], # {"text", "url"} or None "social": c["social"], # social posts, else None "email": c["email"], # emails, else None "slides": c["slides"], "metrics": c["metrics"], "fields": c["fields"], # every other detail of the record "featured_image": images_by_id.get(body["featuredImageId"]) if body["featuredImageId"] else None, "images": body["images"], "image_files_to_expect": sum(1 for i in body["images"] if i["delivery"] == "file"), } def parse_cgenius_image(fields, file): """An image request (multipart/form-data): fields = the form fields, file = the uploaded file.""" if fields.get("event") != "content.image": raise ValueError("Not a cgenius image request") return { "delivery_id": fields["deliveryId"], "content_id": fields["contentId"], "image_id": fields["imageId"], # matches images[].id of the content request "role": fields["role"], # featured | illustration | gallery | inline "index": int(fields["index"]), "total": int(fields["total"]), "alt": fields.get("alt"), "original_src": fields.get("originalSrc"), # inline images: replace this src in the HTML "file": file, } # Example: Flask, one URL for both requests. pip install flask # import os # from flask import Flask, request, jsonify # app = Flask(__name__) # @app.post("/cgenius") # def cgenius(): # if request.headers.get("Authorization") != "Bearer " + os.environ["CGENIUS_ENDPOINT_TOKEN"]: # return "", 401 # event = request.headers.get("X-Publish-Event") # if event == "content.publish": # post = parse_cgenius_content(request.get_json()) # # ...create or update the post with id post["id"]... # return jsonify(url="https://your-site.example/blog/" + post["slug"]), 201 # if event == "content.image": # image = parse_cgenius_image(request.form, request.files["file"]) # # ...image["file"].save(...), attach it to the post image["content_id"]... # return jsonify(ok=True) # return jsonify(error="Unknown event"), 400 ``` ### JSON Schema ```json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://app.cgenius.app/schemas/content.publish.v1.json", "title": "cgenius content.publish (schemaVersion 1)", "type": "object", "properties": { "event": { "type": "string", "const": "content.publish", "description": "Always \"content.publish\" (the images come as \"content.image\" requests)" }, "schemaVersion": { "type": "integer", "const": 1, "description": "1. A new version is announced before it changes how a key is read" }, "deliveryId": { "type": "string", "description": "The id of this send; the image requests carry it too" }, "sentAt": { "type": "string", "format": "date-time", "description": "When it was sent (ISO 8601)" }, "status": { "type": "string", "enum": [ "publish", "draft" ], "description": "What the user asks your site to do: publish it, or keep it as a draft" }, "endpoint": { "type": "object", "properties": { "id": { "type": "string", "description": "Endpoint id" }, "name": { "type": "string", "description": "Endpoint name" } }, "required": [ "id", "name" ], "description": "Your endpoint, as named in cgenius" }, "imageDelivery": { "type": "string", "enum": [ "separate", "inline", "link", "none" ], "description": "How the images come: link (download links in this request, the default), separate (links, then each file in its own request), inline (links and base64), or none" }, "content": { "type": "object", "properties": { "id": { "type": "string", "description": "cgenius content id (stable: use it to update the same post on a new send)" }, "type": { "type": "string", "description": "Stored type: blog, social_post, email, research_report, commercial_offer, presentation…" }, "kind": { "type": "string", "description": "Normalized kind: blog, social (or the network: linkedin, twitter…), email, presentation…" }, "title": { "type": "string", "description": "The title of the content" }, "headline": { "type": [ "string", "null" ], "description": "The h1 the body opens with (the displayed title); not repeated in sections" }, "slug": { "type": "string", "description": "A URL slug of the title" }, "subtitle": { "type": [ "string", "null" ], "description": "Subtitle" }, "excerpt": { "type": "string", "description": "A short summary (about 300 characters)" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "Tags" }, "topic": { "type": [ "string", "null" ], "description": "Topic" }, "tone": { "type": [ "string", "null" ], "description": "Tone (professional, friendly…)" }, "audience": { "type": [ "string", "null" ], "description": "Target audience" }, "source": { "type": [ "string", "null" ], "description": "Where it was written (canvas, presentation-editor)" }, "threadId": { "type": [ "string", "null" ], "description": "Canvas thread id" }, "createdAt": { "type": [ "string", "null" ], "description": "Created (ISO 8601)" }, "updatedAt": { "type": [ "string", "null" ], "description": "Last changed (ISO 8601)" }, "body": { "type": "object", "properties": { "html": { "type": [ "string", "null" ], "description": "HTML" }, "markdown": { "type": [ "string", "null" ], "description": "Markdown (content written in the Canvas)" }, "text": { "type": [ "string", "null" ], "description": "Plain text" } }, "required": [ "html", "markdown", "text" ], "description": "The whole body; a format not chosen in the send options is null" }, "sections": { "type": "array", "items": { "type": "object", "properties": { "index": { "type": "integer", "description": "0, 1, 2… in reading order" }, "heading": { "type": [ "string", "null" ], "description": "The heading text; null for the text before the first heading" }, "level": { "type": "integer", "description": "Heading level 1 to 3; 0 for the text before the first heading" }, "anchor": { "type": [ "string", "null" ], "description": "A slug of the heading, for in-page links; null without a heading" }, "text": { "type": "string", "description": "The section as plain text (one line per paragraph or list item)" }, "html": { "type": "string", "description": "The section as HTML, without its heading" }, "blocks": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "paragraph", "list", "heading", "quote", "code", "image", "table", "divider", "html" ], "description": "paragraph, list, heading (h4–h6), quote, code, image, table, divider, or html (anything else, kept as is)" }, "text": { "type": "string", "description": "Plain text (list: one line per item; code: the code)" }, "html": { "type": "string", "description": "The block as HTML" }, "level": { "type": [ "integer", "null" ], "description": "heading: 4 to 6; else null" }, "ordered": { "type": [ "boolean", "null" ], "description": "list: true when numbered; else null" }, "items": { "type": "array", "items": { "type": "object", "properties": { "label": { "type": [ "string", "null" ], "description": "The item’s leading bold text (\"Name the owner\"), without a trailing colon; null when the item has none" }, "text": { "type": "string", "description": "The item as plain text" }, "html": { "type": "string", "description": "The item as HTML" } }, "required": [ "label", "text", "html" ], "description": "A list item" }, "description": "list: its items; else []" }, "imageId": { "type": [ "string", "null" ], "description": "image: its id in images[]; else null" }, "src": { "type": [ "string", "null" ], "description": "image: its src in the HTML; else null" }, "alt": { "type": [ "string", "null" ], "description": "image: its alt text; else null" }, "language": { "type": [ "string", "null" ], "description": "code: its language when known; else null" }, "rows": { "type": "array", "items": { "type": "array", "items": { "type": "string" } }, "description": "table: the cells’ text, row by row, header row first; else []" } }, "required": [ "type", "text", "html", "level", "ordered", "items", "imageId", "src", "alt", "language", "rows" ], "description": "A block of a section; every block has every key (null or [] when it does not apply)" }, "description": "The section, block by block" } }, "required": [ "index", "heading", "level", "anchor", "text", "html", "blocks" ], "description": "A part of the body, split at its h1–h3 headings" }, "description": "The body split at its headings, each with its blocks" }, "links": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string", "description": "Link text" }, "url": { "type": "string", "description": "URL" } }, "required": [ "text", "url" ], "description": "A link" }, "description": "Every link of the body, in order" }, "callToAction": { "type": [ "object", "null" ], "properties": { "text": { "type": "string", "description": "Text" }, "url": { "type": [ "string", "null" ], "description": "URL" } }, "required": [ "text", "url" ], "description": "The call to action: the post’s own, else the last link of the last section; null when there is none" }, "seo": { "type": "object", "properties": { "metaTitle": { "type": "string", "description": "Title for <title> (70 characters at most)" }, "metaDescription": { "type": "string", "description": "Meta description (160 characters at most)" }, "keywords": { "type": "array", "items": { "type": "string" }, "description": "Keywords" } }, "required": [ "metaTitle", "metaDescription", "keywords" ], "description": "Search details" }, "social": { "type": [ "object", "null" ], "properties": { "platform": { "type": [ "string", "null" ], "description": "linkedin, twitter, facebook, instagram, threads" }, "hashtags": { "type": "array", "items": { "type": "string" }, "description": "Hashtags, with #" }, "callToAction": { "type": [ "string", "null" ], "description": "Call to action text" }, "length": { "type": [ "string", "null" ], "description": "short, medium or long" } }, "required": [ "platform", "hashtags", "callToAction", "length" ], "description": "Social posts; null for other content" }, "email": { "type": [ "object", "null" ], "properties": { "subject": { "type": [ "string", "null" ], "description": "Subject" }, "recipient": { "type": [ "string", "null" ], "description": "Recipient" } }, "required": [ "subject", "recipient" ], "description": "Emails; null for other content" }, "slides": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string", "description": "Title" }, "content": { "type": "string", "description": "Text" }, "notes": { "type": "string", "description": "Speaker notes" }, "imageUrl": { "type": [ "string", "null" ], "description": "Download link of the slide image (also in images[], id \"slide-1\", \"slide-2\"…); null when it has none" } }, "required": [ "title", "content", "notes", "imageUrl" ], "description": "A slide" }, "description": "Presentations: the slides; else []" }, "metrics": { "type": "object", "properties": { "wordCount": { "type": "integer", "description": "Words" }, "characterCount": { "type": "integer", "description": "Characters of the plain text" }, "readingTimeMinutes": { "type": "integer", "description": "Reading time at 200 words a minute" }, "sectionCount": { "type": "integer", "description": "Sections" }, "imageCount": { "type": "integer", "description": "Images in images[]" } }, "required": [ "wordCount", "characterCount", "readingTimeMinutes", "sectionCount", "imageCount" ], "description": "Counts" }, "fields": { "type": "object", "description": "Every other field of the record (research, ideas…); {} when the user left them out" } }, "required": [ "id", "type", "kind", "title", "headline", "slug", "subtitle", "excerpt", "tags", "topic", "tone", "audience", "source", "threadId", "createdAt", "updatedAt", "body", "sections", "links", "callToAction", "seo", "social", "email", "slides", "metrics", "fields" ], "description": "The content" }, "featuredImageId": { "type": [ "string", "null" ], "description": "The id in images[] of the main image; null when there is none" }, "images": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Its id: featured and gallery images \"linked-…\", the saved illustration \"illustration\", body images \"inline-1\", \"inline-2\"…, slide images \"slide-1\", \"slide-2\"…" }, "role": { "type": "string", "enum": [ "featured", "illustration", "gallery", "inline" ], "description": "featured (the main image), illustration, gallery, or inline (in the body)" }, "alt": { "type": [ "string", "null" ], "description": "Alt text" }, "caption": { "type": [ "string", "null" ], "description": "Caption" }, "originalSrc": { "type": [ "string", "null" ], "description": "inline images: the src used in body.html and blocks, to replace with your own URL" }, "filename": { "type": [ "string", "null" ], "description": "A file name for it (\"my-post-featured-1.png\")" }, "contentType": { "type": [ "string", "null" ], "description": "image/png, image/jpeg, image/webp or image/gif" }, "size": { "type": [ "integer", "null" ], "description": "Bytes" }, "delivery": { "type": "string", "enum": [ "file", "inline", "link", "unavailable" ], "description": "link: download it from url; file: url too, and the file comes next in its own request (content.image); inline: url too, and the bytes in data; unavailable: not sent (see note)" }, "url": { "type": [ "string", "null" ], "description": "A download link, no sign-in needed (the app’s own images: valid 30 days); null when not sent" }, "data": { "type": [ "string", "null" ], "description": "inline: the image bytes in base64; else null" }, "note": { "type": [ "string", "null" ], "description": "Why the image went another way or was not sent" } }, "required": [ "id", "role", "alt", "caption", "originalSrc", "filename", "contentType", "size", "delivery", "url", "data", "note" ], "description": "An image of the content" }, "description": "Every image of the content" }, "videos": { "type": "array", "items": { "type": "object", "properties": { "format": { "type": "string", "description": "9:16, 1:1, 4:5 or 16:9" }, "url": { "type": "string", "description": "Public download link of the MP4" }, "width": { "type": [ "integer", "null" ], "description": "Width in pixels" }, "height": { "type": [ "integer", "null" ], "description": "Height in pixels" }, "durationSeconds": { "type": [ "number", "null" ], "description": "Length in seconds" }, "sizeInBytes": { "type": [ "integer", "null" ], "description": "File size" } }, "required": [ "format", "url", "width", "height", "durationSeconds", "sizeInBytes" ], "description": "A video" }, "description": "Rendered videos (video ads); [] for other content" } }, "required": [ "event", "schemaVersion", "deliveryId", "sentAt", "status", "endpoint", "imageDelivery", "content", "featuredImageId", "images", "videos" ], "description": "The structured content cgenius sends to your endpoint (Content-Type: application/json)" } ``` ## Publish through Buffer The user connects their own Buffer account once (in the app, **Settings → Integrations → Buffer**, or with `PUT /api/v1/connections/buffer` and their Buffer personal API key). Then an agent can send posts. **Ask the user before sending**: publishing is visible outside the app. Scopes: `publish:read` (status, channels), `publish:write` (send), `connections:manage` (connect, disconnect). 1. Check the connection and list the channels. ```bash curl -sS "$CGENIUS_API_URL/api/v1/connections/buffer" -H "Authorization: Bearer $CGENIUS_API_TOKEN" curl -sS "$CGENIUS_API_URL/api/v1/connections/buffer/channels" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ | jq '.channels[] | select(.usable) | {id, service, name: (.displayName // .name), notificationOnly}' ``` `409 conflict` means no Buffer account is connected: ask the user to connect one. `notificationOnly` channels (Instagram personal profiles, Facebook groups) get a reminder in the Buffer app and the user publishes by hand. 2. Send. `mode`: `addToQueue` (next free slot), `shareNow`, `customScheduled` (with `dueAt`, at least a minute ahead and within a year) or `draft`. Give a channel its own text in `versions`, or a thread (X, Threads, Bluesky, Mastodon) as `versions.<channelId>.thread`; the first thread post must equal `versions.<channelId>.text`. ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/publish/buffer" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \ -d '{"text":"<LinkedIn post>","channelIds":["<linkedin channel id>","<x channel id>"], "mode":"customScheduled","dueAt":"2026-12-02T09:00:00+01:00", "imageUrl":"https://…/image.png","contentId":"<content id>", "versions":{"<x channel id>":{"text":"First post 1/2","thread":["First post 1/2","Second post 2/2"]}}}' # {"results":[{"channelId":"…","ok":true,"postId":"…","status":"scheduled","dueAt":"…"},…],"recorded":true} ``` Each channel has its own result: report the ones with `ok: false` and their `error`; the others were sent. `contentId` records the posts on the content item. Instagram needs an image or a video: a post without one is refused for that channel (`ok: false`) before it reaches Buffer. Instagram and Facebook posts are a feed post by default, or a reel with a video; choose with `versions.<channelId>.postType` (`post`, `reel` or `story`). YouTube needs a video; the title comes from the first line of the text. Pinterest needs a board, which the API can't choose yet. `imageUrl` is a public https URL, or the `s3://` path of one of the user's saved images (sent to Buffer as a 30-day download link). `provider_limit_reached` (429) means Buffer's rate limit: wait `Retry-After`. `connection_needs_reauth` means Buffer refused the stored key: ask the user to reconnect. ## Keep a generated image Images an agent generates in EpsimoAgents live at a temporary URL (about an hour). Copy one to ContentGenius storage to keep it. Scopes: `media:write` (import), `media:read` (read). ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/media/generated-images" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -d '{"url":"https://<EpsimoAgents host>/generated-images/<file>.png"}' # 201 {"path":"s3://…/pdfFile/<user>/generated-images-….png","key":"pdfFile/…"} curl -sS "$CGENIUS_API_URL/api/v1/media/images?path=s3://…/pdfFile/<user>/generated-images-….png" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" -o image.png ``` Only URLs on the EpsimoAgents host under `/generated-images/` are accepted (`422 url_not_allowed` otherwise). Store `path` on the content; read it back with `media.images.get`. ## Read and change settings Settings are per user: `epsimoagents` (publish module preferences: project, image agent, image style), `integrations` (publishing endpoints; their tokens are stored encrypted and returned decrypted to the owner) and `ideation` (lead ideas defaults: company, agent, mode, filters, focus). Scopes: `settings:read`, `settings:write`. ```bash curl -sS "$CGENIUS_API_URL/api/v1/settings/ideation" -H "Authorization: Bearer $CGENIUS_API_TOKEN" curl -sS -X PUT "$CGENIUS_API_URL/api/v1/settings/ideation" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -d '{"data":{"mode":"quick","ideaCount":6,"focus":"Cloud security for manufacturers"}}' ``` `PUT` replaces the whole setting: read it first and send it back with your change. Invalid fields answer `400 validation_failed` with `error.fields`. ## Cancel or resume a Job ```bash curl -sS -X POST "$CGENIUS_API_URL/api/v1/jobs/<jobId>/cancel" -H "Authorization: Bearer $CGENIUS_API_TOKEN" curl -sS -X POST "$CGENIUS_API_URL/api/v1/jobs/<jobId>/resume" -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## Manage tokens Needs `tokens:manage`. A token can create a narrower **child token** (never with more Scopes than itself, and never with AI access); revoking a token revokes its children. ```bash curl -sS "$CGENIUS_API_URL/api/v1/tokens" -H "Authorization: Bearer $CGENIUS_API_TOKEN" curl -sS -X POST "$CGENIUS_API_URL/api/v1/tokens" -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" -d '{"name":"read-only report bot","scopes":["content:read","jobs:read"]}' curl -sS -X DELETE "$CGENIUS_API_URL/api/v1/tokens/<id>" -H "Authorization: Bearer $CGENIUS_API_TOKEN" curl -sS "$CGENIUS_API_URL/api/v1/audit-events?limit=50" -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## CLI login How a CLI or agent gets a token without the user copying one (a device-style flow): 1. `POST /api/v1/auth/cli-sessions` (no auth) with `{"scopes":[…],"aiAccess":true,"clientInfo":"my-agent/1.0"}` answers `{sessionId, userCode, pollSecret, approveUrl, expiresIn: 600, interval: 2}`. 2. Show the user `userCode` and ask them to open `approveUrl`. They sign in, compare the code, choose the Scopes and approve (with AI access, they sign in once more on the Cognito page). 3. Every `interval` seconds, `POST /api/v1/auth/cli-sessions/{sessionId}/exchange` with `{"pollSecret":"…"}`: `202` while pending, then `200 {"token":"cg_…","tokenId":"…"}` once. `410 session_expired` means expired or denied: start again. 4. Store the token where the user expects (for the CLI: its config file, readable only by the user). Never show `pollSecret` or the token. # API reference ## assistants ### GET /api/v1/assistants `assistants.list`: The caller's EpsimoAgents assistants (the agents generations and lead ideation use) - Scopes: `content:read` - needs AI access - CLI: `cgenius assistants list` - Responses: 200 AssistantList, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/assistants" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## auditEvents ### GET /api/v1/audit-events `auditEvents.list`: List the caller's audit events (kept 90 days) - Scopes: `tokens:manage` - CLI: `cgenius audit list` - Query: - `limit` integer: Page size, 1 to 100 - `cursor` string: Opaque cursor from the previous page - `from` string (date-time): Default: 30 days ago - `to` string (date-time): Default: now - `operation` string - `tokenId` string - Responses: 200 AuditEventPage, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/audit-events" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## auth ### POST /api/v1/auth/cli-sessions `auth.cliSessions.create`: Start a CLI login; the user approves it in the browser - Scopes: none - public (no token) - CLI: `cgenius auth login` - Body (CreateCliSessionRequest): - `name` string - `scopes` "content:read" | "content:write" | "publish:read" | "publish:write" | "connections:manage" | "media:read" | "media:write" | "settings:read" | "settings:write" | "jobs:read" | "jobs:write" | "tokens:manage" | "maintenance:read" | "maintenance:write"[] (required) - `aiAccess` boolean - `expiresInDays` integer - `clientInfo` string: For example the host name and CLI version, shown on the approve page - Responses: 201 CreatedCliSession, 400 ErrorEnvelope, 413 ErrorEnvelope, 429, 500 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/auth/cli-sessions" \ -H "Content-Type: application/json" \ -d '{"scopes":"content:read"}' ``` ### GET /api/v1/auth/cli-sessions/{id} `auth.cliSessions.get`: What the CLI approve page shows for a login session - Scopes: `tokens:manage` - Path: - `id` string (required) - Responses: 200 CliSession, 400 ErrorEnvelope, 401 ErrorEnvelope, 403, 410, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/auth/cli-sessions/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/auth/cli-sessions/{id}/deny `auth.cliSessions.deny`: Deny a CLI login session - Scopes: `tokens:manage` - Path: - `id` string (required) - Responses: 204, 400 ErrorEnvelope, 401 ErrorEnvelope, 403, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/auth/cli-sessions/<id>/deny" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/auth/cli-sessions/{id}/exchange `auth.cliSessions.exchange`: Poll a CLI login: 202 while pending, then the token once - Scopes: none - public (no token) - CLI: `cgenius auth login` - Path: - `id` string (required) - Body (ExchangeCliSessionRequest): - `pollSecret` string (required) - Responses: 200 ApprovedCliSession, 202 PendingCliSession, 400 ErrorEnvelope, 410, 413 ErrorEnvelope, 429, 500 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/auth/cli-sessions/<id>/exchange" \ -H "Content-Type: application/json" \ -d '{"pollSecret":"…"}' ``` ### GET /api/v1/auth/delegation/callback `auth.delegation.callback`: Cognito hosted UI redirect target; creates the approved token and returns the browser to the app - Scopes: none - public (no token) - Query: - `code` string - `state` string - `error` string - `error_description` string - Responses: 302, 400 ErrorEnvelope, 500 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/auth/delegation/callback" ``` ### GET /api/v1/auth/delegation/start `auth.delegation.start`: Redirect the browser to the Cognito hosted UI to grant AI access to an approval - Scopes: `tokens:manage` - Query: - `approval` string (required) - Responses: 302, 400 ErrorEnvelope, 401 ErrorEnvelope, 403, 404, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/auth/delegation/start" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## billing ### GET /api/v1/billing `billing.get`: Your credits (plan remaining, packs), plan, purchases, and the plans and packs for sale - Scopes: `settings:read` - needs AI access - CLI: `cgenius billing status` - Responses: 200 Billing, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/billing" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/billing/checkout `billing.checkout`: Start a Stripe Checkout for a credit pack (pay as you go) or a monthly plan; answers the URL the user pays at - Scopes: `settings:write` - needs AI access - CLI: `cgenius billing buy` - Body (BillingCheckoutRequest): - `kind` "pack" | "plan" (required) - `itemId` string (required): A pack or plan id from billing.get, for example pack_100 or pro - `returnUrl` string (uri): Where Stripe returns (an allowed https origin of ContentGenius); default the Credits & Billing page - Responses: 200 BillingCheckout, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/billing/checkout" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"kind":"pack","itemId":"…"}' ``` ### POST /api/v1/billing/portal `billing.portal`: Open the Stripe customer portal (change or cancel a plan, invoices, card) - Scopes: `settings:write` - needs AI access - CLI: `cgenius billing portal` - Body (BillingPortalRequest): - `returnUrl` string (uri): Where Stripe returns (an allowed https origin of ContentGenius); default the Credits & Billing page - Responses: 200 BillingPortal, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/billing/portal" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{}' ``` ## blogs ### POST /api/v1/blogs/v1/jobs `blogs.v1.create`: Write a blog with the v1 engine - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius blog create` - Body (CreateBlogV1Request): - `assistant_id` string (required) - `topic` string (required) - `blogSize` "single" | "small" | "medium" | "big" | "huge" (required) - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/blogs/v1/jobs" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"assistant_id":"…","topic":"…","blogSize":"single"}' ``` ### GET /api/v1/blogs/v1/jobs/{id} `blogs.v1.get`: Read a v1 blog Job - Scopes: `content:read` - needs a Workspace - CLI: `cgenius blog get` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/blogs/v1/jobs/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/blogs/v2/tasks `blogs.v2.create`: Write a blog with the v2 engine - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius blog create` - Body (CreateBlogV2Request): - `requestData` object (required) - `requestData.topic` string (required) - `requestData.wordCount` integer (required) - `requestData.blogSize` "single" | "small" | "medium" | "big" | "huge" (required) - `requestData.assistantId` string (required) - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/blogs/v2/tasks" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"requestData":{"topic":"…","wordCount":1,"blogSize":"single","assistantId":"…"}}' ``` ### GET /api/v1/blogs/v2/tasks/{id} `blogs.v2.get`: Read a v2 blog task and its Job - Scopes: `content:read` - needs a Workspace - CLI: `cgenius blog get` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/blogs/v2/tasks/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/blogs/v2/tasks/{id}/resume `blogs.v2.resume`: Resume a failed v2 blog task - Scopes: `content:write`, `jobs:write` - starts a Job (202), needs AI access, needs a Workspace - CLI: `cgenius blog resume` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/blogs/v2/tasks/<id>/resume" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/blogs/v3/pipelines `blogs.v3.create`: Write a blog with the v3 engine (research, outline, sections, assembly) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius blog create` - Body (CreateBlogV3Request): - `requestData` object (required) - `requestData.topic` string (required) - `requestData.title` string - `requestData.keywords` string | string[] - `requestData.tone` string - `requestData.wordCount` integer - `requestData.blogSize` string - `requestData.includeFAQ` boolean - `requestData.brandVoice` any - `requestData.templateId` string - `agentConfiguration` object (required) - `agentConfiguration.defaultAgentId` string (required) - `agentConfiguration.researchAgentId` string - `agentConfiguration.outlineAgentId` string - `agentConfiguration.writingAgentId` string - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/blogs/v3/pipelines" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"requestData":{"topic":"…"},"agentConfiguration":{"defaultAgentId":"…"}}' ``` ### GET /api/v1/blogs/v3/pipelines/{id} `blogs.v3.get`: Read a v3 blog pipeline and its Job - Scopes: `content:read` - needs a Workspace - CLI: `cgenius blog get` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/blogs/v3/pipelines/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/blogs/v3/pipelines/{id}/resume `blogs.v3.resume`: Resume a failed v3 blog from its resume point - Scopes: `content:write`, `jobs:write` - starts a Job (202), needs AI access, needs a Workspace - CLI: `cgenius blog resume` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/blogs/v3/pipelines/<id>/resume" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/blogs/v3/pipelines/{id}/sections/{index}/regenerate `blogs.v3.regenerateSection`: Regenerate one section of a completed v3 blog (then reassemble) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius blog regenerate-section` - Path: - `id` string (required) - `index` integer (required) - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/blogs/v3/pipelines/<id>/sections/<index>/regenerate" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" ``` ## connections ### DELETE /api/v1/connections/buffer `connections.buffer.disconnect`: Remove the stored Buffer API key - Scopes: `connections:manage` - CLI: `cgenius buffer disconnect` - Responses: 200 BufferConnection, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X DELETE "https://app.cgenius.app/api/v1/connections/buffer" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### GET /api/v1/connections/buffer `connections.buffer.get`: The caller's Buffer connection, checked with Buffer - Scopes: `publish:read` - CLI: `cgenius buffer status` - Responses: 200 BufferConnection, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/connections/buffer" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### PUT /api/v1/connections/buffer `connections.buffer.connect`: Connect a Buffer account with a Buffer personal API key (verified with Buffer, then stored encrypted) - Scopes: `connections:manage` - CLI: `cgenius buffer connect` - Body (ConnectBufferRequest): - `apiKey` string (required): Buffer › Settings › API - Responses: 200 BufferConnection, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X PUT "https://app.cgenius.app/api/v1/connections/buffer" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"apiKey":"…"}' ``` ### GET /api/v1/connections/buffer/channels `connections.buffer.channels`: The channels of the caller's Buffer account - Scopes: `publish:read` - CLI: `cgenius buffer channels` - Responses: 200 BufferChannels, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/connections/buffer/channels" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## contentItems ### GET /api/v1/content `contentItems.list`: List your saved content, newest first - Scopes: `content:read` - CLI: `cgenius content list` - Query: - `limit` integer: Page size, 1 to 100 - `cursor` string: Opaque cursor from the previous page - `type` string: Only this content type, for example social_post - Responses: 200 ContentPage, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/content" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### GET /api/v1/content/{id} `contentItems.get`: Read one of your saved content records: its body, fields and send history - Scopes: `content:read` - CLI: `cgenius content get` - Path: - `id` string (required) - Responses: 200 ContentItemEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/content/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/content/{id}/send `contentItems.send`: Send saved content to one of your sites (a publishing endpoint) and record the send - Scopes: `publish:write` - Idempotency-Key - CLI: `cgenius content send` - Path: - `id` string (required) - Body (SendContentRequest): - `endpointId` string (required): From integrationEndpoints.list - `options` object - `options.format` "simple" | "full": simple (default): title, content, featured image; full: every section, block and field - `options.status` "publish" | "draft": What the receiving site should do: publish (default) or draft - `options.formats` "html" | "markdown" | "text"[]: Full format: the body formats to include (default all three) - `options.images` "link" | "inline" | "none": link (default): 30-day download links; inline: base64 inside the content (full format); none - `options.includeFields` boolean: Full format: include the type's own fields - Responses: 200 SendContentResult, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 409, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/content/<id>/send" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"endpointId":"…"}' ``` ## generate ### POST /api/v1/generate/emails `generate.email`: Write an email (email Job) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius email create` - Body (GenerateEmailRequest): - `assistantId` string (required): EpsimoAgents assistant that writes the email - `recipient` string (required): Who it is for, for example "a prospect who downloaded our guide" - `subject` string (required) - `context` string: What the email must say or achieve - `tone` string: For example "warm" or "formal" - `length` "100" | "200" | "400": About how many words (default 200) - `brandVoiceId` string: One of your brand voices; the writing follows it - `save` boolean: Save the result to your content (default true); `result.contentId` names the record - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 422, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/generate/emails" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"assistantId":"…","recipient":"…","subject":"…"}' ``` ### POST /api/v1/generate/offer `generate.offer`: Generate an offer (HTML and PDF) with the offer pipelines - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius offer create` - Body (GenerateOfferRequest): - `variant` "batch" | "basic" | "zero" | "mid" | "full" (required): batch: one section per subject (offer_batch); the others: the new-batch pipeline variants - `client_name` string (required) - `subjects` string[] - `offerRecord` any (required) - `assistantsId` any[] | object: batch: the assistant per subject (array or map); other variants: an object, `{assistantsId: "<assistant id>"}` for mid and full - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/generate/offer" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"variant":"batch","client_name":"…","offerRecord":{}}' ``` ### POST /api/v1/generate/presentations `generate.presentation`: Write a slide deck (presentation Job) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius presentation create` - Body (GeneratePresentationRequest): - `assistantId` string (required): EpsimoAgents assistant that writes the slides - `topic` string (required) - `audience` string: Who the presentation is for - `slideCount` integer (required) - `style` "professional" | "creative" | "minimal" | "bold": Default professional - `brandVoiceId` string: One of your brand voices; the writing follows it - `save` boolean: Save the result to your content (default true); `result.contentId` names the record - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 422, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/generate/presentations" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"assistantId":"…","topic":"…","slideCount":1}' ``` ### POST /api/v1/generate/research `generate.research`: Research the web and write a cited report (research Job) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius research create` - Body (GenerateResearchRequest): - `assistantId` string (required): EpsimoAgents assistant that plans and researches; give it a web search tool (Tavily or DuckDuckGo) - `writerAssistantId` string: Assistant that writes the report; default `assistantId` - `query` string (required): The research task - `reportType` "research_report" | "outline_report" | "resource_report" | "custom_report": Default research_report (a summary report of about 1,200 words) - `customPrompt` string: How to write a custom_report (required for it) - `tone` "objective" | "formal" | "analytical" | "persuasive" | "informative" | "explanatory" | "descriptive" | "critical" | "comparative" | "speculative" | "reflective" | "narrative" | "humorous" | "optimistic" | "pessimistic" | "simple" | "casual": Default objective - `language` string: For example "French"; default: the language of the query - `domains` string[]: Only search and cite these sites, for example ["europa.eu"] - `questionCount` integer: Search questions to plan (default 4); the query itself is researched too - `brandVoiceId` string: One of your brand voices; the writing follows it - `save` boolean: Save the result to your content (default true); `result.contentId` names the record - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 422, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/generate/research" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"assistantId":"…","query":"…"}' ``` ### POST /api/v1/generate/social-posts `generate.socialPost`: Write a social post sized for its platform, with an optional illustration (social_post Job) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius social create` - Body (GenerateSocialPostRequest): - `assistantId` string (required): EpsimoAgents assistant that writes the post - `topic` string (required): What the post is about - `platform` "linkedin" | "twitter" | "facebook" | "instagram" | "threads" (required) - `length` "short" | "medium" | "long": Default medium; `social.channels.list` gives the character range of each length - `tone` string: For example "friendly" or "expert" - `hashtags` string: Hashtags to use - `callToAction` string: What the reader should do - `brandVoiceId` string: One of your brand voices; the writing follows it - `illustration` boolean: Also draw an illustration (needs `imageAssistantId`) - `imageAssistantId` string: An assistant with the DALL-E tool, for the illustration - `imageIdea` string: What the illustration should show; default: drawn from the post - `save` boolean: Save the result to your content (default true); `result.contentId` names the record - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 422, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/generate/social-posts" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"assistantId":"…","topic":"…","platform":"linkedin"}' ``` ### POST /api/v1/generate/video-ads `generate.videoAd`: Make a short video ad from a content idea and render it in social formats (video_ad Job) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius video ad` - Body (GenerateVideoAdRequest): - `assistantId` string: EpsimoAgents assistant that writes the script and the caption (not needed with `script`) - `ideationId` string: One of your saved ideas (from ideation.leadIdeas or ideation.analyze); it is linked to the saved ad - `idea` object: The idea itself, instead of `ideationId` (for example a suggestion from ideation.leadIdeas) - `idea.topic` string (required) - `idea.description` string - `idea.targetAudience` string - `idea.angles` string[] - `idea.keywords` string[] - `formats` "9:16" | "1:1" | "4:5" | "16:9"[]: One render per format; default ["9:16"] (Reels, TikTok, Shorts, Stories) - `lengthSeconds` integer: About how long the ad lasts: 15, 30, 45, 60 (default 30) - `platform` string: The network the caption is written for (default instagram) - `url` string: Shown on the call-to-action scene, for example "acme.com/demo" - `brand` object: Colours as #rrggbb, and the name or logo shown in a corner - `brand.name` string - `brand.primary` string - `brand.accent` string - `brand.background` string - `brand.text` string - `brand.logoUrl` string - `brandVoiceId` string: One of your brand voices; the writing follows it - `language` string - `images` boolean: Draw a photo behind up to three scenes (needs `imageAssistantId`, an assistant with the DALL-E tool) - `imageAssistantId` string - `musicUrl` string: Background music (an https audio file you may use); it loops and fades out at the end - `musicVolume` number: Music volume, 0 to 1 (default 0.35) - `script` object: A script to render as is (`job.result.script` of an earlier Job with `render: false`, edited); the agent is not asked again - `script.scenes` object[] (required): Scenes as in job.result.script.scenes: {kind: hook|point|stat|cta, durationInSeconds, text, sub, title, body, value, label, button, url, imageUrl} - `script.caption` string - `script.hashtags` string[] - `render` boolean: Render the videos (default true); false stops after the script so it can be checked - `save` boolean: Save the result to your content (default true); `result.contentId` names the record - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 422, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/generate/video-ads" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"idea":{"topic":"…"},"script":{"scenes":[{}]}}' ``` ### GET /api/v1/generate/video-ads/{id} `generate.videoAd.get`: Read a video ad Job; a completed one has a 7-day link on each video - Scopes: `content:read` - needs a Workspace - CLI: `cgenius video ad get` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/generate/video-ads/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## health ### GET /api/v1/health `health.get`: Service health - Scopes: none - public (no token) - Responses: 200 Health, 400 ErrorEnvelope, 500 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/health" ``` ## ideation ### POST /api/v1/ideation/analyze `ideation.analyze`: Suggest content ideas from Lead App leads (content_analysis Job) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access + Lead App access, needs a Workspace - CLI: `cgenius ideas analyze` - Body (AnalyzeLeadsRequest): - `leadIds` string[] (required) - `assistantId` string: EpsimoAgents assistant that writes the ideas. Default: the configured content analysis assistant - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/ideation/analyze" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"leadIds":["…"]}' ``` ### POST /api/v1/ideation/lead-ideas `ideation.leadIdeas.create`: Content ideas from a LeadGenius company's leads, written by an agent (lead_ideation Job) - Scopes: `content:write`, `jobs:write` - starts a Job (202), Idempotency-Key, needs AI access, needs a Workspace - CLI: `cgenius ideas from-leads` - Body (LeadIdeasRequest): - `assistantId` string (required): The EpsimoAgents agent that writes the ideas (see assistants.list) - `companyId` string (required): A LeadGenius company of the caller (see leadApp.companies.list) - `mode` "deep" | "quick": deep: themes per group of 25 leads, then the ideas; quick: statistics and 40 leads - `leadIds` string[]: Hand-picked leads; without them, the newest leads of the company - `filters` object - `filters.minScore` number - `filters.statuses` string[] - `filters.keyword` string - `filters.since` string: ISO date: leads created on or after it - `maxLeads` integer - `ideaCount` integer - `focus` string: What the company offers or wants to be known for - Responses: 202 JobAccepted, 400 ErrorEnvelope, 401 ErrorEnvelope, 403, 409 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/ideation/lead-ideas" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"assistantId":"…","companyId":"…"}' ``` ## integrationEndpoints ### GET /api/v1/publish/endpoints `integrationEndpoints.list`: List your publishing endpoints (Settings › Integrations), without their tokens - Scopes: `publish:read` - CLI: `cgenius endpoints list` - Responses: 200 IntegrationEndpoints, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/publish/endpoints" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## jobs ### GET /api/v1/jobs `jobs.list`: List the caller's Jobs (offers, content analysis, PDF, blog v1), newest first - Scopes: `jobs:read` - needs a Workspace - CLI: `cgenius job list` - Query: - `limit` integer: Page size, 1 to 100 - `cursor` string: Opaque cursor from the previous page - `type` "blog_v3" | "blog_v2" | "blog_v1" | "offer_batch" | "offer_new_batch" | "content_analysis" | "lead_ideation" | "pdf_conversion" | "questionnaire" | "social_post" | "email" | "presentation" | "research" | "video_ad" - Responses: 200 JobPage, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/jobs" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### GET /api/v1/jobs/{id} `jobs.get`: Read a Job; also advances it a little when nothing else is (no browser needed) - Scopes: `jobs:read` - needs a Workspace - CLI: `cgenius job status` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/jobs/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/jobs/{id}/advance `jobs.advance`: Run the next Steps of a Job within one request (JSON, or SSE with Accept: text/event-stream) - Scopes: `jobs:write` - needs a Workspace - CLI: `cgenius job wait` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/jobs/<id>/advance" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/jobs/{id}/cancel `jobs.cancel`: Cancel a PENDING or RUNNING Job - Scopes: `jobs:write` - needs a Workspace - CLI: `cgenius job cancel` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/jobs/<id>/cancel" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/jobs/{id}/resume `jobs.resume`: Resume a FAILED Job from its failed Step - Scopes: `jobs:write` - needs a Workspace - CLI: `cgenius job resume` - Path: - `id` string (required) - Responses: 200 JobEnvelope, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/jobs/<id>/resume" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## leadApp ### GET /api/v1/lead-app/companies `leadApp.companies.list`: The LeadGenius companies the caller owns or is an active member of, and the one lead ideation uses - Scopes: `content:read` - CLI: `cgenius lead-app companies` - Responses: 200 LeadAppCompanies, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/lead-app/companies" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## me ### GET /api/v1/me `me.get`: The caller: identity, token Scopes and AI access, Workspaces, limits and credits - Scopes: `settings:read` - CLI: `cgenius me` - Responses: 200 Me, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/me" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## media ### POST /api/v1/media/generated-images `media.generatedImages.import`: Copy an image an EpsimoAgents agent generated (its temporary URL) to the publish bucket - Scopes: `media:write` - CLI: `cgenius media import-generated` - Body (ImportGeneratedImageRequest): - `url` string (required): https URL on the EpsimoAgents host under /generated-images/ - Responses: 201 StoredImage, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/media/generated-images" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"url":"…"}' ``` ### GET /api/v1/media/images `media.images.get`: The bytes of an image stored in the publish bucket, by its s3:// path - Scopes: `media:read` - CLI: `cgenius media get` - Query: - `path` string (required): `s3://bucket/pdfFile/...`, as returned by media.generatedImages.import - Responses: 200, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/media/images" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## openapi ### GET /api/v1/openapi.json `openapi.get`: The OpenAPI 3.1 document of this API - Scopes: none - public (no token) - Responses: 200 object, 400 ErrorEnvelope, 500 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/openapi.json" ``` ## projects ### GET /api/v1/projects `projects.list`: The caller's EpsimoAgents projects - Scopes: `content:read` - needs AI access - CLI: `cgenius projects list` - Responses: 200 ProjectList, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/projects" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ## publish ### POST /api/v1/publish/buffer `publish.buffer`: Send a post to Buffer channels: publish now, queue, schedule or save as a draft - Scopes: `publish:write` - Idempotency-Key - CLI: `cgenius buffer send` - Body (PublishBufferRequest): - `text` string (required) - `channelIds` string[] (required) - `mode` "shareNow" | "addToQueue" | "customScheduled" | "draft" (required): shareNow, addToQueue, customScheduled (needs dueAt), draft - `dueAt` string (date-time) - `imageUrl` string: A public https URL, or the `s3://` path of one of your saved images (for example `job.result.image.path` of generate.socialPost, or media.generatedImages.import); a path is sent to Buffer as a 30-day download link - `videoUrl` string: A video instead of an image: an https URL, or the `s3://` path of one of your rendered videos (`job.result.videos[].path` of generate.videoAd), sent as a 7-day link - `contentId` string: GeneratedContent record; the posts are recorded on it - `versions` object: Channel id → its own text (see social.fit), or a thread on X, Threads, Bluesky and Mastodon - Responses: 200 PublishBufferResult, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/publish/buffer" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"text":"…","channelIds":["…"],"mode":"shareNow"}' ``` ## settings ### DELETE /api/v1/settings/{key} `settings.delete`: Remove one of the caller's settings - Scopes: `settings:write` - CLI: `cgenius settings unset` - Path: - `key` "epsimoagents" | "integrations" | "ideation" (required): epsimoagents: publish module preferences; integrations: publishing endpoints; ideation: lead ideation choices - Responses: 204, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X DELETE "https://app.cgenius.app/api/v1/settings/<key>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### GET /api/v1/settings/{key} `settings.get`: One of the caller's settings; `data` is null when nothing is saved - Scopes: `settings:read` - CLI: `cgenius settings get` - Path: - `key` "epsimoagents" | "integrations" | "ideation" (required): epsimoagents: publish module preferences; integrations: publishing endpoints; ideation: lead ideation choices - Responses: 200 Setting, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/settings/<key>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### PUT /api/v1/settings/{key} `settings.update`: Replace one of the caller's settings - Scopes: `settings:write` - CLI: `cgenius settings set` - Path: - `key` "epsimoagents" | "integrations" | "ideation" (required): epsimoagents: publish module preferences; integrations: publishing endpoints; ideation: lead ideation choices - Body (UpdateSettingRequest): - `data` object (required) - Responses: 200 SettingSaved, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X PUT "https://app.cgenius.app/api/v1/settings/<key>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"data":{}}' ``` ## social ### GET /api/v1/social/channels `social.channels.list`: Size and structure rules of each social channel (length, structure, hashtags, threads, image size) - Scopes: `content:read` - CLI: `cgenius social channels` - Responses: 200 ChannelProfiles, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/social/channels" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/social/fit `social.fit`: Check a post against a channel and get a version that fits it (and a thread where the channel has threads) - Scopes: `content:read` - CLI: `cgenius social fit` - Body (FitSocialPostRequest): - `text` string (required) - `channel` string (required): linkedin, twitter (or x), facebook, instagram, threads, or another Buffer service - Responses: 200 SocialFit, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/social/fit" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"text":"…","channel":"…"}' ``` ## tokens ### GET /api/v1/tokens `tokens.list`: List the caller's API tokens - Scopes: `tokens:manage` - CLI: `cgenius token list` - Responses: 200 TokenList, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/tokens" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/tokens `tokens.create`: Create an API token (without AI access; use the approval flow for AI access) - Scopes: `tokens:manage` - Idempotency-Key - CLI: `cgenius token create` - Body (CreateTokenRequest): - `name` string (required) - `scopes` "content:read" | "content:write" | "publish:read" | "publish:write" | "connections:manage" | "media:read" | "media:write" | "settings:read" | "settings:write" | "jobs:read" | "jobs:write" | "tokens:manage" | "maintenance:read" | "maintenance:write"[] (required): Scopes the token holds; at most those of the creating token - `expiresAt` string (date-time): Default 90 days, at most 365 days away - Responses: 201 CreatedToken, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 409 ErrorEnvelope, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/tokens" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"name":"…","scopes":"content:read"}' ``` ### DELETE /api/v1/tokens/{id} `tokens.delete`: Revoke an API token and every token it created - Scopes: `tokens:manage` - CLI: `cgenius token revoke` - Path: - `id` string (required) - Responses: 200 RevokedTokens, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X DELETE "https://app.cgenius.app/api/v1/tokens/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### GET /api/v1/tokens/{id} `tokens.get`: Read one API token - Scopes: `tokens:manage` - CLI: `cgenius token get` - Path: - `id` string (required) - Responses: 200 ApiToken, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X GET "https://app.cgenius.app/api/v1/tokens/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### PATCH /api/v1/tokens/{id} `tokens.update`: Rename an API token - Scopes: `tokens:manage` - CLI: `cgenius token rename` - Path: - `id` string (required) - Body (UpdateTokenRequest): - `name` string (required) - Responses: 200 ApiToken, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X PATCH "https://app.cgenius.app/api/v1/tokens/<id>" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"…"}' ``` ### DELETE /api/v1/tokens/{id}/ai-access `tokens.removeAiAccess`: Remove AI access from an API token without revoking it - Scopes: `tokens:manage` - CLI: `cgenius token ai-access remove` - Path: - `id` string (required) - Responses: 204, 400 ErrorEnvelope, 401 ErrorEnvelope, 403 ErrorEnvelope, 404, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X DELETE "https://app.cgenius.app/api/v1/tokens/<id>/ai-access" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/tokens/approvals `tokens.approvals.create`: Start a token approval in the signed-in browser (the way to create a token with AI access) - Scopes: `tokens:manage` - Body (CreateTokenApprovalRequest): - `name` string (required) - `scopes` "content:read" | "content:write" | "publish:read" | "publish:write" | "connections:manage" | "media:read" | "media:write" | "settings:read" | "settings:write" | "jobs:read" | "jobs:write" | "tokens:manage" | "maintenance:read" | "maintenance:write"[] (required) - `expiresAt` string (date-time): Default 90 days, at most 365 days away - `aiAccess` boolean: Ask for AI access (a Delegated_Credential); needs a Cognito sign-in - `via` "ui" | "cli" - `cliSessionId` string: Required when via is cli - Responses: 201 CreatedTokenApproval, 400 ErrorEnvelope, 401 ErrorEnvelope, 403, 410, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/tokens/approvals" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"…","scopes":"content:read"}' ``` ### POST /api/v1/tokens/approvals/{id}/complete `tokens.approvals.complete`: Finish an approval without AI access and create the token - Scopes: `tokens:manage` - Path: - `id` string (required) - Responses: 200 TokenApprovalResult, 400 ErrorEnvelope, 401 ErrorEnvelope, 403, 404, 409, 410, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/tokens/approvals/<id>/complete" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/tokens/approvals/{id}/result `tokens.approvals.result`: The token an approval created; the secret is returned only on the first call - Scopes: `tokens:manage` - Path: - `id` string (required) - Responses: 200 TokenApprovalResult, 400 ErrorEnvelope, 401 ErrorEnvelope, 403, 404, 409, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/tokens/approvals/<id>/result" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" ``` ### POST /api/v1/tokens/approvals/{id}/session `tokens.approvals.session`: Grant AI access from the signed-in browser session (no second sign-in) and create the token - Scopes: `tokens:manage` - Path: - `id` string (required) - Body (SessionDelegationRequest): - `refreshToken` string (required): The browser session's Cognito refresh token - Responses: 200 TokenApprovalResult, 400, 401 ErrorEnvelope, 403, 404, 409, 413 ErrorEnvelope, 429 ErrorEnvelope, 500 ErrorEnvelope, 503 ErrorEnvelope ```bash curl -sS -X POST "https://app.cgenius.app/api/v1/tokens/approvals/<id>/session" \ -H "Authorization: Bearer $CGENIUS_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"refreshToken":"…"}' ``` # CLI > **Status: not released.** The `cgenius` command-line tool (npm package `@cgenius/cli`) is being built. This page describes its planned design; details can change before release. Every command maps to one API Operation (the table below comes from the Capability Catalog), so anything the CLI will do already works over HTTP ([Recipes](/documentation/recipes)). ## Install (when released) ```bash npm install -g @cgenius/cli # Node 20 or later cgenius --version ``` ## Sign in ```bash cgenius auth login # opens the approve page and shows a code to compare cgenius auth login --scopes content:read,content:write,jobs:read,jobs:write --no-ai --expires 90d --name ci echo "$CG_TOKEN" | cgenius auth login --with-token # use an existing token (read from stdin) cgenius auth status # GET /api/v1/me; prints the token as cg_xxxxxxxx… cgenius auth logout # revokes the token (DELETE /api/v1/tokens/{id}) and removes it locally ``` `auth login` uses the [CLI login flow](/documentation/recipes#cli-login). The token is kept in `$XDG_CONFIG_HOME/cgenius/config.json` (else `~/.config/cgenius/config.json`; on Windows `%APPDATA%\cgenius\config.json`), written with mode 600, as `{ currentProfile, profiles: { name: { apiUrl, token, workspace? } } }`. Precedence: flag, then environment (`CGENIUS_API_TOKEN`, `CGENIUS_API_URL`), then profile, then the default `https://app.cgenius.app`. ## Behaviour - Every request sends a new `X-Request-Id` and `User-Agent: cgenius-cli/<version>`; create and start requests send an `Idempotency-Key`, reused on retry. - Network errors, `429` and `5xx` are retried up to 3 times (1, 2, 4 s with jitter, or `Retry-After`). - Commands that start a Job wait by default, following `POST /api/v1/jobs/{id}/advance` as a stream; `--stream` prints the text as it is written, progress goes to stderr. `--no-wait` prints `{jobId}` and exits; `--timeout` (default 30 min) exits with code 1 and the Job id for `cgenius job wait`. - `--output <path>` downloads file results (PDF, PPTX, image, video) after completion. - `--json` prints exactly one JSON document on stdout (the API answer), for scripts and agents. - Errors go to stderr as `error: <message> (code <code>, request <correlationId>)`. - Once a day the CLI compares its version with `info.version` of the API and prints an upgrade notice when the API is newer. | Exit code | Meaning | |---|---| | 0 | ok | | 1 | API or Job error | | 2 | usage error | | 3 | `unauthenticated`, `insufficient_scope` or `ai_access_unavailable` | | 4 | `not_found` | | 5 | `rate_limited` after retries | | 6 | `network_rules_violation` | ## Global options | Option | Meaning | |---|---| | `--profile <name>` | Use another profile | | `--api-url <url>` | Another server | | `--workspace <id>` | Sent as `X-Workspace-Id` | | `--json` | Machine-readable output | ## Commands | Command | Operation | State | |---|---|---| | `cgenius articles list` | `blogArticles.list` | planned | | `cgenius assistants list` | `assistants.list` | API ready | | `cgenius audit list` | `auditEvents.list` | API ready | | `cgenius auth login` | `auth.cliSessions.create` | API ready | | `cgenius auth login` | `auth.cliSessions.exchange` | API ready | | `cgenius billing buy` | `billing.checkout` | API ready | | `cgenius billing portal` | `billing.portal` | API ready | | `cgenius billing status` | `billing.get` | API ready | | `cgenius blog create` | `blogs.v3.create` | API ready | | `cgenius blog create` | `blogs.v2.create` | API ready | | `cgenius blog create` | `blogs.v1.create` | API ready | | `cgenius blog delete` | `blogs.v3.delete` | planned | | `cgenius blog get` | `blogs.v3.get` | API ready | | `cgenius blog get` | `blogs.v2.get` | API ready | | `cgenius blog get` | `blogs.v1.get` | API ready | | `cgenius blog list` | `blogs.v3.list` | planned | | `cgenius blog list` | `blogs.v2.list` | planned | | `cgenius blog regenerate-section` | `blogs.v3.regenerateSection` | API ready | | `cgenius blog regenerate-section` | `blogs.v2.regenerateSection` | planned | | `cgenius blog research` | `generate.researchBlog` | planned | | `cgenius blog resume` | `blogs.v3.resume` | API ready | | `cgenius blog resume` | `blogs.v2.resume` | API ready | | `cgenius blog update` | `blogs.v3.updateContent` | planned | | `cgenius brand-voice create` | `brandVoices.create` | planned | | `cgenius brand-voice delete` | `brandVoices.delete` | planned | | `cgenius brand-voice get` | `brandVoices.get` | planned | | `cgenius brand-voice list` | `brandVoices.list` | planned | | `cgenius brand-voice update` | `brandVoices.update` | planned | | `cgenius brief create` | `customerBriefs.create` | planned | | `cgenius brief list` | `customerBriefs.list` | planned | | `cgenius buffer channels` | `connections.buffer.channels` | API ready | | `cgenius buffer connect` | `connections.buffer.connect` | API ready | | `cgenius buffer disconnect` | `connections.buffer.disconnect` | API ready | | `cgenius buffer send` | `publish.buffer` | API ready | | `cgenius buffer status` | `connections.buffer.get` | API ready | | `cgenius chat send` | `chat.send` | planned | | `cgenius connections add` | `connections.start` | planned | | `cgenius connections get` | `connections.get` | planned | | `cgenius connections list` | `connections.list` | planned | | `cgenius connections remove` | `connections.delete` | planned | | `cgenius connections targets` | `connections.targets` | planned | | `cgenius content delete` | `contentItems.delete` | planned | | `cgenius content export` | `contentItems.export` | planned | | `cgenius content get` | `contentItems.get` | API ready | | `cgenius content list` | `contentItems.list` | API ready | | `cgenius content pdf` | `contentItems.pdf` | planned | | `cgenius content send` | `contentItems.send` | API ready | | `cgenius content update` | `contentItems.update` | planned | | `cgenius dashboard` | `dashboard.get` | planned | | `cgenius document create` | `generate.document` | planned | | `cgenius email create` | `generate.email` | API ready | | `cgenius endpoints add` | `integrationEndpoints.create` | planned | | `cgenius endpoints list` | `integrationEndpoints.list` | API ready | | `cgenius endpoints remove` | `integrationEndpoints.delete` | planned | | `cgenius endpoints test` | `integrationEndpoints.test` | planned | | `cgenius endpoints update` | `integrationEndpoints.update` | planned | | `cgenius ideas analyze` | `ideation.analyze` | API ready | | `cgenius ideas create` | `ideation.ideas.create` | planned | | `cgenius ideas delete` | `ideation.ideas.delete` | planned | | `cgenius ideas from-leads` | `ideation.leadIdeas.create` | API ready | | `cgenius ideas generate` | `ideation.ideas.generate` | planned | | `cgenius ideas get` | `ideation.ideas.get` | planned | | `cgenius ideas list` | `ideation.ideas.list` | planned | | `cgenius ideas update` | `ideation.ideas.update` | planned | | `cgenius image create` | `generate.image` | planned | | `cgenius job cancel` | `jobs.cancel` | API ready | | `cgenius job list` | `jobs.list` | API ready | | `cgenius job resume` | `jobs.resume` | API ready | | `cgenius job status` | `jobs.get` | API ready | | `cgenius job wait` | `jobs.advance` | API ready | | `cgenius knowledge upload` | `knowledge.upload` | planned | | `cgenius lead-app companies` | `leadApp.companies.list` | API ready | | `cgenius lead-app leads` | `leadApp.leads.list` | planned | | `cgenius lead-app list` | `leadApp.entities.list` | planned | | `cgenius maintenance create-bug` | `maintenance.tickets.create` | planned | | `cgenius maintenance delete` | `maintenance.tickets.delete` | planned | | `cgenius maintenance get` | `maintenance.tickets.get` | planned | | `cgenius maintenance list` | `maintenance.tickets.list` | planned | | `cgenius maintenance update` | `maintenance.tickets.update` | planned | | `cgenius me` | `me.get` | API ready | | `cgenius media delete` | `media.delete` | planned | | `cgenius media get` | `media.images.get` | API ready | | `cgenius media import` | `media.import` | planned | | `cgenius media import-generated` | `media.generatedImages.import` | API ready | | `cgenius media list` | `media.list` | planned | | `cgenius media update` | `media.update` | planned | | `cgenius media upload` | `media.upload` | planned | | `cgenius newsletter list` | `newsletterFeeds.list` | planned | | `cgenius offer create` | `generate.offer` | API ready | | `cgenius offer delete` | `offers.delete` | planned | | `cgenius offer get` | `offers.get` | planned | | `cgenius offer list` | `offers.list` | planned | | `cgenius offer research` | `offerResearch.create` | planned | | `cgenius onboarding setup` | `onboarding.setup` | planned | | `cgenius presentation create` | `generate.presentation` | API ready | | `cgenius presentation list` | `presentations.list` | planned | | `cgenius projects create` | `projects.create` | planned | | `cgenius projects list` | `projects.list` | API ready | | `cgenius projects use` | `projects.activate` | planned | | `cgenius proposal create` | `generate.proposal` | planned | | `cgenius proposal list` | `proposals.list` | planned | | `cgenius proposal update` | `proposals.update` | planned | | `cgenius publications list` | `publications.list` | planned | | `cgenius publish now` | `publish.start` | planned | | `cgenius publish preview` | `publish.preview` | planned | | `cgenius questionnaire cancel` | `questionnaires.cancel` | planned | | `cgenius questionnaire create` | `questionnaires.create` | planned | | `cgenius questionnaire list` | `questionnaires.list` | planned | | `cgenius questionnaire status` | `questionnaires.get` | planned | | `cgenius research create` | `generate.research` | API ready | | `cgenius schedule cancel` | `schedules.delete` | planned | | `cgenius schedule create` | `schedules.create` | planned | | `cgenius schedule get` | `schedules.get` | planned | | `cgenius schedule list` | `schedules.list` | planned | | `cgenius schedule update` | `schedules.update` | planned | | `cgenius settings get` | `settings.get` | API ready | | `cgenius settings set` | `settings.update` | API ready | | `cgenius settings unset` | `settings.delete` | API ready | | `cgenius social channels` | `social.channels.list` | API ready | | `cgenius social create` | `generate.socialPost` | API ready | | `cgenius social fit` | `social.fit` | API ready | | `cgenius token ai-access remove` | `tokens.removeAiAccess` | API ready | | `cgenius token create` | `tokens.create` | API ready | | `cgenius token get` | `tokens.get` | API ready | | `cgenius token list` | `tokens.list` | API ready | | `cgenius token rename` | `tokens.update` | API ready | | `cgenius token revoke` | `tokens.delete` | API ready | | `cgenius video ad` | `generate.videoAd` | API ready | | `cgenius video ad get` | `generate.videoAd.get` | API ready | | `cgenius video list` | `videos.list` | planned | | `cgenius video render` | `generate.video` | planned | ## Use from an agent Prefer `--json` and read `.job.status` / `.error.code` rather than the human output. Until the CLI ships, call the API directly: each row above names the Operation to use (see the [reference](/documentation/api)). # Agent skill An **agent skill** is a short instruction file (`SKILL.md`) that teaches an AI agent when and how to use a tool. The ContentGenius skill teaches an agent to create content through the Public API (and the CLI once released). ## Get the skill - **Current version (v1 API):** [/documentation/skill.md](/documentation/skill.md). It is generated from the same API description as this site, so it lists the Operations of this build. - **In the repository:** `.agents/skills/cgenius/SKILL.md` is the same file, written by `npm run skill:write` (and checked by `npm run skill:check`), with an `examples/` folder of complete calls. - The older v2 package (`npx skills add thierryteisseire/cgenius-skill`) used the app's internal routes and `CGENIUS_EPSIMO_TOKEN`. It no longer works with API tokens; replace it with this one. ## Install it Save `skill.md` as `SKILL.md` in the agent's skills folder: | Agent | Location | |---|---| | Claude Code | `.claude/skills/cgenius/SKILL.md` (project) or `~/.claude/skills/cgenius/SKILL.md` | | Kiro | `.kiro/skills/cgenius/SKILL.md` (workspace) or `~/.kiro/skills/cgenius/SKILL.md` | | Agents that read `.agents/skills` (Codex, Gemini CLI, …) | `.agents/skills/cgenius/SKILL.md` | | Other agents | any folder the agent reads skills or rules from; or paste it into the system prompt | ```bash mkdir -p .claude/skills/cgenius curl -sS https://app.cgenius.app/documentation/skill.md -o .claude/skills/cgenius/SKILL.md ``` Then give the agent a token through the environment, never in the chat: ```bash export CGENIUS_API_URL="https://app.cgenius.app" export CGENIUS_API_TOKEN="cg_…" ``` ## Which token to give an agent Create it in **Settings → API Tokens** with only the Scopes the agent needs, and an expiry you are comfortable with. | Agent's job | Scopes | AI access | |---|---|---| | Write blogs, ideas, offers | `content:read` `content:write` `jobs:read` `jobs:write` `settings:read` | yes | | Also size and publish social posts through Buffer | add `publish:read` `publish:write` | yes | | Also keep generated images | add `media:read` `media:write` | yes | | Read-only reporting | `content:read` `jobs:read` `settings:read` | no | The agent can create a narrower child token for a sub-task (`POST /api/v1/tokens`, needs `tokens:manage`); a child never has more Scopes than its parent, nor AI access. Revoke the token when the agent no longer needs it. ## What the skill tells the agent 1. Check the setup with `GET /api/v1/me` (token valid, Scopes, AI access, Workspaces, credits) and find the assistants with `GET /api/v1/assistants`. 2. Map the user's request to an Operation (blog engine, lead ideas, offer, social sizing, Buffer…). 3. Start the Job with a new `Idempotency-Key`, then poll it, reporting progress now and then. 4. Handle errors by `error.code` (missing Scope → ask for a token with it; no AI access → ask for a token with AI access; no credits → stop). 5. Confirm with the user before publishing, deleting or anything that leaves the app, and never reveal the token. ## Workflows ### From leads to a blog 1. `GET /api/v1/lead-app/companies`: use `selectedCompanyId`, or ask the user when they have several companies. 2. `GET /api/v1/assistants`: the writing agent (ask the user, or use the one they named). 3. `POST /api/v1/ideation/lead-ideas` with `assistantId`, `companyId`, `mode: "quick"` for a fast answer or `"deep"` for a thorough one; poll the Job. 4. Show the user the ideas (`topic`, `targetAudience`, `rationale`), and let them pick one. 5. `POST /api/v1/blogs/v3/pipelines` with the idea's `topic` as `requestData.topic` and its `keywords` and `agentConfiguration.defaultAgentId`; poll the Job; give the user `result.resources`. ### One message, sized for each channel ContentGenius has no social-post generation Operation yet, so the agent writes the text itself: 1. `GET /api/v1/social/channels`: the length, structure, hashtag count and image size of each channel the user wants. 2. Write one version per channel following those rules (for example a hook in the first line on LinkedIn, at most 280 characters on X). 3. `POST /api/v1/social/fit` for each version: fix any `status: "over"` or `hashtagsOk: false`; for X or Threads, use `thread` when the message needs more than one post. 4. Show the user every version before going further. ### Publish through Buffer 1. `GET /api/v1/connections/buffer/channels`: the user's channels (on `409`, ask them to connect Buffer in **Settings → Integrations**). 2. Ask the user which channels, when (now, queue, a date, or a Buffer draft), and confirm the text of each. 3. `POST /api/v1/publish/buffer` with `versions` per channel (and `thread` for X or Threads), an `Idempotency-Key`, and `contentId` when the post comes from a saved content item. 4. Report each channel's result; retry only the failed ones, with a new key. ## Give an agent the whole documentation Point it at [/documentation/llms.txt](/documentation/llms.txt): one plain-text file with these pages, every Operation with its Scopes, fields and a curl example, and the error codes.