Skip to main content

Developers

The Childbook API

Use the same illustration engine as the Childbook app from your own tools, or put personalized books in your own storefront.

Included with Business

Illustration API

https://api.childbook.ai/api/v1

Generate illustrations with your own characters, edit existing images (replace a character, swap a face, or edit by prompt), get masks for parts of an image, and caption images. Create a token on your account page and start calling it today.

Onboarding with our team

Partner Personalization API

https://api.childbook.ai/partner/v1

Sell personalized books in your storefront. Your customers fill in a hosted personalization wizard, approve a preview, and after checkout you receive print-ready cover and interior PDFs, with signed webhooks for every step.

Illustration API quickstart

Tokens are available to accounts with an active Business subscription. Send them as Authorization: Bearer cbai_… from your server; never put them in a browser or app.

  1. 1. Create a token

    On your account page, open API tokens and create one. Copy it right away: it is shown only once.

  2. 2. Upload a reference photo

    Use a face close-up for people: one unobstructed face with the hair visible.

    curl -X POST 'https://api.childbook.ai/api/v1/illustration-assets' \
      -H 'Authorization: Bearer cbai_…' \
      -F '[email protected]'
    # {"assetId":"…","expiresAt":"…"}
  3. 3. Request an illustration

    Every create request needs an Idempotency-Key. Repeating it with the same body returns the same job without a second charge.

    curl -X POST 'https://api.childbook.ai/api/v1/illustrations' \
      -H 'Authorization: Bearer cbai_…' \
      -H 'Idempotency-Key: scene-001' \
      -H 'Content-Type: application/json' \
      -d '{
        "prompt": "Maya reads beneath an oak tree",
        "promptMode": "scene",
        "characters": [{
          "name": "Maya", "type": "human",
          "attributes": { "age": 8, "gender": "female" },
          "referenceImage": { "assetId": "YOUR_ASSET_ID" }
        }]
      }'
    # 202 {"id":"…","status":"pending"}
  4. 4. Poll or stream the result

    Poll the job until it is completed, partial, or failed, or stream status updates with server-sent events from /events.

    curl -H 'Authorization: Bearer cbai_…' \
      'https://api.childbook.ai/api/v1/illustrations/YOUR_JOB_ID'

Edits (/api/v1/illustration-edits), segmentation (/api/v1/image-segmentations), captions, background removal, outfits, and style guides are described with every field in the API reference.

Pricing, limits, and retention

Generation or edit
1 illustration credit per accepted job. Refunded automatically if the job fails without a result.
Segmentation and captions
Free; limited to 60 requests per hour each.
Credits
The Business plan includes 1,000 illustration credits a month, shared with the app. Top-up packs are on your account page.
Default limits
60 generation and edit requests per hour and 5 concurrent jobs per account. Write to us if you need more.
Retention
Results and uploaded files expire 30 days after their last use. Job records are kept for 90 days. You can delete either at any time.
Errors
JSON { error: { code, message } } with stable codes. 429 responses include Retry-After.
Versioning
Breaking changes ship under a new major path (/api/v2, /partner/v2) with advance notice.

Partner Personalization API

We configure your products, templates, branding, and callback addresses, then issue an organization secret key. Your backend lists your catalog, creates a personalization for each customer, sends them to the hosted wizard (or your own frontend), and requests the book render after payment. Previews use illustration credits; a sandbox mode lets you test the whole flow without charges.

[email protected]