Citera home
Browse documentation

Content generation

Content generation

Start an idempotent content generation job.

Summarize with AIChatGPTClaudePerplexity

POST /v1/brands/{brand_id}/content/generations (content:generate)

Headers: Idempotency-Key (required), Content-Type: application/json.

Body

Rules

content_type

one of the 11 formats and in GENERATION_CONTENT_TYPES (default: blog_post, howto_article, comparison_article, case_study, linkedin_post)

source.recommendation_id

UUID of a content_topic recommendation in this brand

source.prompt_id

prompt_<24 hex> from this brand’s library

instructions

optional, ≤ 4,000 chars; treated as untrusted data and never placed in a system prompt

options.language

en, sv, de, fr, es, nl, da, no, fi

options.tone

expert, friendly, neutral, bold

options.target_length

short, standard, long

options.include_images

boolean (default false)

At least one source is required. There are no model, provider or URL fields.

Processing order: write capability (scope + api.generation.enabled) → brand authorization → content-type allowlist → source resolution in the brand → idempotency → atomic job admission (credits + concurrency + row) → audit → enqueue.

Response 202:

{ "data": { "job_id": "…", "object": "job", "job_type": "content_generation",
            "status": "queued", "brand_id": "…", "content_id": null,
            "estimated_operation_units": 5, "created_at": "…" },
  "request_id": "req_…" }
{ "data": { "job_id": "…", "object": "job", "job_type": "content_generation",
            "status": "queued", "brand_id": "…", "content_id": null,
            "estimated_operation_units": 5, "created_at": "…" },
  "request_id": "req_…" }
{ "data": { "job_id": "…", "object": "job", "job_type": "content_generation",
            "status": "queued", "brand_id": "…", "content_id": null,
            "estimated_operation_units": 5, "created_at": "…" },
  "request_id": "req_…" }
{ "data": { "job_id": "…", "object": "job", "job_type": "content_generation",
            "status": "queued", "brand_id": "…", "content_id": null,
            "estimated_operation_units": 5, "created_at": "…" },
  "request_id": "req_…" }

Poll GET /v1/jobs/{job_id}. When it succeeds, read GET …/content/{result.content_id}?include=body.

Request examples

Choose a language for each endpoint. Set your assigned HTTPS API origin and environment variables, then replace the <placeholders>. These examples do not run requests in your browser.

POST/v1/brands/{brand_id}/content/generations

Required scope: content:generate · Response: 202 · Idempotency-Key required

This is a write operation. Review the body and confirmation requirements before running it.

: "${CITERA_API_BASE_URL:?Set CITERA_API_BASE_URL}"
: "${CITERA_API_KEY:?Set CITERA_API_KEY}"
: "${BRAND_ID:?Set BRAND_ID}"
: "${CITERA_IDEMPOTENCY_KEY:?Set CITERA_IDEMPOTENCY_KEY}"
# Review this write and replace every <placeholder> before running.
curl --fail-with-body --connect-timeout 10 --max-time 30 -X POST "${CITERA_API_BASE_URL%/}/v1/brands/${BRAND_ID}/content/generations" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer ${CITERA_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${CITERA_IDEMPOTENCY_KEY}" \
  --data-raw '{"content_type":"blog_post","source":{"prompt_id":"<prompt_id>"},"options":{"language":"en","tone":"expert","target_length":"standard","include_images":false}}'