Skip to content
Developers // Content API

Content Generation API reference

Generate blog, product, ad, and email copy with one HTTPS call — DeepSeek by default for speed and cost, OpenAI on demand for quality. Server-to-server, framework-agnostic, prepaid by the word.

This is the full technical reference. New here? Start with the AI Content Writer API overview or the Molixa API platform.

Get access

The API is for approved B2B partners. Apply at /partners (or from your dashboard under Watermark API — the same partner account). Once approved you get a secret mlx_ key for server-side use. The Content API bills a shared credit balance — the same credits power the Watermark API. Enable the Content API from your partner dashboard to mint a content-scoped key.

Base URL & auth

All requests are HTTPS. Authenticate with your secret key in the X-Api-Key header (or Authorization: Bearer). Send X-Owns-Content: true to accept the Content Acceptable Use Policy for the generation (required).

POST https://molixa.app/api/v1/content/generate
X-Api-Key: mlx_your_secret_key
X-Owns-Content: true
Content-Type: application/json

The endpoint

POST /api/v1/content/generate with a JSON body:

  • prompt (required): the topic, instruction, or source text (≤ 8,000 chars).
  • task: what to write. One of freeform, blog-intro, blog-outline, blog-section, product-description, ad-copy, email, rewrite, summarize. Default freeform.
  • tone: e.g. friendly, formal. Optional.
  • language: output language. Default English.
  • maxWords: target length, clamped 1–2000. Default 400.
  • tier: fast (DeepSeek, default) or quality (OpenAI).

Send an Idempotency-Key header to make retries safe — a repeat with the same key replays the first result instead of generating (and charging) again.

curl -X POST https://molixa.app/api/v1/content/generate \
  -H "X-Api-Key: $MOLIXA_CONTENT_API_KEY" -H "X-Owns-Content: true" \
  -H "Content-Type: application/json" -H "Idempotency-Key: post-4821" \
  -d '{
    "task": "product-description",
    "prompt": "Noise-cancelling wireless earbuds, 40h battery",
    "tone": "confident", "maxWords": 120, "tier": "fast"
  }'

Response — 200 OK

{
  "ok": true,
  "text": "…the generated copy…",
  "jobId": "…",
  "task": "product-description",
  "tier": "fast",
  "model": "deepseek-chat",
  "provider": "deepseek",
  "wordsUsed": 118,
  "creditsRemaining": 499882
}

Billing — you pay for the words you get

One prepaid credit balance powers both this API and the Watermark API. Content costs 0.2 credits/word on the fast tier and 0.5/word on quality. We authorize the worst case (maxWords) up front, generate, then refund the unused remainder — so you are charged for the words you actually receive and never more. A failed or policy-blocked generation is fully refunded. When your balance runs out the API returns INSUFFICIENT_CREDITS until you top up.

Errors

All errors are JSON with a 4xx status and a stable code:

StatuscodeMeaning
422BLOCKEDPrompt or output refused by the content policy (not charged).
422GENERATION_FAILEDAll providers failed (credit refunded).
429RATE_LIMITEDToo many requests this minute — back off.
402INSUFFICIENT_CREDITSOut of credits — top up.
403SCOPE_FORBIDDENKey not enabled for the Content API.
401 / 403NO_KEY · INVALID_KEY · PARTNER_NOT_APPROVEDAuth.
400AFFIRMATION_REQUIRED · BAD_INPUTMissing X-Owns-Content / bad field.

Node / TypeScript

const res = await fetch("https://molixa.app/api/v1/content/generate", {
  method: "POST",
  headers: {
    "X-Api-Key": process.env.MOLIXA_CONTENT_API_KEY!, // server-side only
    "X-Owns-Content": "true",
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({ task: "blog-intro", prompt: "How to sleep better", maxWords: 150 }),
});
const data = await res.json();
if (data.ok) {
  // data.text is the generated copy; data.wordsUsed was billed
}

Compliance

Your terms must bind users to an Acceptable Use Policy that forbids generating spam, deceptive or illegal content, disinformation, harassment, or unauthorized impersonation. Only send X-Owns-Content: true for users who accepted it. Every prompt and output is run through moderation; flagged text is blocked and not charged. You remain responsible for reviewing and publishing generated content.

Pricing

Prepaid credits — one balance for both APIs. At 0.2 credits/word (fast), a pack of credits translates to a lot of copy. Bigger packs cost less per credit:

PackPriceCreditsWords (fast)
Starter$5050,000250,000
Growth$9099,000495,000
Scale$230276,0001,380,000
Enterprisecustom

Ready to integrate? Apply for API access →