Create a book and download the PDF
Make one print-ready US Letter PDF with 15 black-and-white illustrations in scene order. The example costs 15 credits and includes no cover, introductory text, branding, or QR code.
1. Set up your terminal
Use Bash, curl and jq in a fresh directory for this order. Set your Business API key on your server. Replace the sample order ID with a unique value and keep it for retries. Get or manage an API key
export COLORINGBOOKIFY_API_KEY="cbf_your_api_key"
SITE="https://coloringbookify.com"
AUTH="Authorization: Bearer $COLORINGBOOKIFY_API_KEY"
ORDER_ID="garden-order-1001"
2. Choose your starting point
Use either example below to prepare book.json. Both use the same creation and download steps.
I have my own scenes
Download the complete request for “The Fox and the Seed”. Use it as written or edit the title, description and 15 scene prompts in book.json. Each item in the pages array becomes one illustration. Download book.json
curl -fsS "$SITE/api/examples/illustrations-only.json" -o book.json
View the complete 15-scene request
{
"book": {
"title": "The Fox and the Seed",
"description": "A fox grows a flower and shares its seeds with the forest.",
"aspect": "portrait",
"include_front_cover": false,
"include_welcome_page": false,
"include_back_cover": false,
"pages": [
{"title":"A fox finds a seed by the garden gate"},
{"title":"The fox clears a patch beneath a sunflower"},
{"title":"The fox digs a small hole with a trowel"},
{"title":"The fox plants the seed beside a stone"},
{"title":"The fox fills a watering can at the garden tap"},
{"title":"The fox waters the soil as a robin watches"},
{"title":"The fox shelters a sprout beneath a large leaf"},
{"title":"The fox ties the growing stem to a stake"},
{"title":"The fox guides a snail back to the lettuce patch"},
{"title":"The fox watches a bud open at sunrise"},
{"title":"The fox spots a bee visiting the flower"},
{"title":"The fox collects seeds from the dried flower head"},
{"title":"The fox folds paper packets for the seeds"},
{"title":"The fox shares packets with woodland neighbors"},
{"title":"The fox opens the gate to a garden full of blooms"}
]
}
}
I have a customer brief
Planning costs 0 credits. Replace the sample brief and review the proposed scenes and estimate. The last command writes the creation request only if it contains 15 scenes, costs 15 credits and fits your balance. If it stops, review plan.json before continuing.
curl -fsS "$SITE/api/v1/book_plans" \
-H "$AUTH" -H "Content-Type: application/json" \
-H "Idempotency-Key: plan-$ORDER_ID" \
-d '{
"book_plan": {
"title": "Woodland Plants",
"description": "Exactly 15 different woodland plants, one per page. Only black-and-white illustrations, without lettering or recurring characters.",
"aspect": "portrait",
"include_front_cover": false,
"include_welcome_page": false,
"include_back_cover": false,
"include_test_color_page": false
}
}' -o plan.json
jq '.data | {credits, scenes: .generation_request.book.pages}' plan.json
jq -e '.data | select(.credits.required == 15 and .credits.sufficient)
| .generation_request | select((.book.pages | length) == 15)' \
plan.json > book.json
The sample sets include_front_cover, include_welcome_page and include_back_cover to false. You can change each independently. Omitting them gives you the usual front cover, name page and an automatic back-cover collage when four illustrations are available.
3. Submit the book for generation
This request spends the credits. A 202 response includes the amount charged, a link to check progress and the PDF link. Retry the same order with the same key and unchanged book.json to avoid a second charge.
curl -fsS "$SITE/api/v1/books" \
-H "$AUTH" -H "Content-Type: application/json" \
-H "Idempotency-Key: book-$ORDER_ID" \
--data-binary @book.json -o created.json
jq '{status: .data.status, charged: .data.credits.charged,
operation: .data.links.self, pdf: .resource.links.pdf}' created.json
4. Wait for the illustrations and save the PDF
The loop checks progress every two seconds. On success it saves book.pdf. If any illustration fails, it prints the operation details and stops. An unfinished book returns 409 on download. For A4 paper, change us_letter to a4.
(
set -e
operation=$(jq -er '.data.links.self' created.json)
pdf=$(jq -er '.resource.links.pdf' created.json)
while true; do
curl -fsS -H "$AUTH" "$SITE$operation" -o progress.json
status=$(jq -er '.data.status' progress.json)
case "$status" in
succeeded) break ;;
queued|running) sleep 2 ;;
*) jq '.data | {status, progress, error}' progress.json; exit 1 ;;
esac
done
curl -fsS -H "$AUTH" "$SITE$pdf?page_size=us_letter" -o book.pdf
)
Create a book with consistent characters
Use reusable character references for recurring cast members and one style for the entire book. Here are two reference sheets and three example coloring pages featuring the same cast.
Character reference sheets
Example coloring pages
These images come from an earlier consistency test. They illustrate how recognizable features can carry across scenes, not the exact output of the request below. Review the results before delivering a book.
1. Create the references and wait until ready
Set your Business API key on your server, as shown above. In a fresh working directory, set a unique CAST_ID for this pair and keep the same keys and request bodies on retries. Each new character costs one credit. If you already have two ready characters, skip creation and use their IDs and handles from GET /api/v1/characters.
(
set -e
SITE="https://coloringbookify.com"
AUTH="Authorization: Bearer ${COLORINGBOOKIFY_API_KEY:?Set your Business API key}"
CAST_ID="mara-pip-cast-001"
create_character() {
curl -fsS "$SITE/api/v1/characters" \
-H "$AUTH" -H "Content-Type: application/json" \
-H "Idempotency-Key: $CAST_ID-$1" --data-binary "$2"
}
# If using your own Mara image, replace this first command with the upload example.
create_character mara '{"character":{"name":"Mara","description":"Curly bob, round glasses, star hair clip, and overalls with a heart patch."}}' > mara.json
create_character pip '{"character":{"name":"Pip","description":"An upright river otter with a broad muzzle, triangular neckerchief, two-button vest, and a long tapering tail."}}' > pip.json
)
To start from your own artwork, use a multipart source image instead of the JSON description-only request. Use a new key for a different request, and poll the returned operation just as above. This generates a reusable sheet from your source; it does not attach the original image unchanged to every page.
curl -fsS "https://coloringbookify.com/api/v1/characters" \
-H "Authorization: Bearer $COLORINGBOOKIFY_API_KEY" \
-H "Idempotency-Key: mara-upload-cast-001" \
-F 'character[name]=Mara' \
-F 'character[source_image][email protected]' -o mara.json
Once you have both creation responses, poll their operation links until both characters are ready.
(
set -e
SITE="https://coloringbookify.com"
AUTH="Authorization: Bearer ${COLORINGBOOKIFY_API_KEY:?Set your Business API key}"
for character in mara pip; do
operation=$(jq -er '.data.links.self' "$character.json")
ready=false
for (( attempt=0; attempt<120; attempt++ )); do
curl -fsS -H "$AUTH" "$SITE$operation" -o "$character-progress.json"
case "$(jq -er '.data.status' "$character-progress.json")" in
succeeded) ready=true; break ;;
queued|running) sleep 3 ;;
*) jq '.data | {status, error}' "$character-progress.json"; exit 1 ;;
esac
done
if [ "$ready" != true ]; then
printf 'Still pending: %s\n' "$operation" >&2
exit 1
fi
done
)
2. Use the returned IDs and handles in your scenes
The IDs select the book’s cast. In each scene, mention the returned @handle only for characters who should appear there. You can use up to two characters per scene. The example reads the creation responses above; if you reused existing characters, substitute their actual IDs and handles directly in the book request.
(
set -e
jq -e -s '
.[0].resource as $mara | .[1].resource as $pip
| if ($mara.id and $mara.handle and $pip.id and $pip.handle)
then {
book: {
title: "Mara and Pip in the Garden",
description: "Two friends explore a garden and share a picnic.",
aspect: "portrait",
level: "easy",
style_template_key: "custom",
style_prompt: "One black-and-white coloring page, crisp outlines, open areas to color, and no lettering. Scene: {{SUBJECT}}",
character_ids: [$mara.id, $pip.id],
include_front_cover: false,
include_welcome_page: false,
include_back_cover: false,
include_test_color_page: false,
pages: [
{title: "\($mara.handle) kneels and plants a seedling in a garden bed."},
{title: "\($mara.handle) and \($pip.handle) face each other and pass one apple across a picnic blanket."},
{title: "\($pip.handle) peeks around a tree trunk. Keep the head and tail visible."}
]
}
} else error("Expected two character creation responses with IDs and handles") end
' mara.json pip.json > book.json
)
For a shared custom style, retain {{SUBJECT}} so the renderer inserts each individual scene. Or omit the custom fields to use the default Classic style. A reference guides character identity; it does not force an exact copy.
This example costs three credits for the book, plus two if you created both characters. To test 15 illustration-only pages, supply 15 scene entries and keep the optional pages off. Then submit book.json, poll the operation, and download the PDF. Continue to book submission and PDF download
Quick start
Export your API key to an environment variable and verify it against the account endpoint.
Base URL
https://coloringbookify.com/api/v1
export COLORINGBOOKIFY_API_KEY="cbf_your_api_key"
curl --fail-with-body \
--header "Authorization: Bearer $COLORINGBOOKIFY_API_KEY" \
https://coloringbookify.com/api/v1/me
curl --fail-with-body \
--request POST \
--header "Authorization: Bearer $COLORINGBOOKIFY_API_KEY" \
--header "Content-Type: application/json" \
--header "Idempotency-Key: page-$(uuidgen)" \
--data '{"page":{"title":"A fox exploring a mushroom village"}}' \
https://coloringbookify.com/api/v1/pages
MCP for AI agents
MCPUse MCP when an AI agent should plan, generate, organize, and download a complete printable coloring book for the signed-in account. Use the REST API for direct application integrations.
MCP server URL
https://coloringbookify.com/mcp
Configure this as a Streamable HTTP server. Compatible clients discover ColoringBookify's OAuth metadata automatically.
Connect with Codex CLI
codex mcp add coloringbookify \
--url https://coloringbookify.com/mcp
codex mcp login coloringbookify
The browser opens ColoringBookify for sign-in and consent. MCP uses OAuth instead of API keys. All plans, including Free, can connect using their existing account credits.
Clients use tools/list to discover the current tool names, input schemas, and descriptions. The catalog covers accounts, print formats, book plans, books, characters, pages, operations, external artwork imports, images, and final PDFs.
Read-only tools cost 0 credits. Generation tools declare their exact cost and require the agent to confirm that amount before spending credits. MCP uses the same account balance as the REST API.
Image and PDF tools return short-lived, owner-authorized download URLs so agents can retrieve binary files without transporting large base64 payloads.
Reconnect ColoringBookify
If your connection has expired or cannot refresh, disconnect ColoringBookify in your client and connect it again. Complete sign-in and approve access in the browser. Retrying the old connection will not renew it. Your books and credits stay in your account.
For Codex CLI, run these commands using your configured server name, then complete sign-in:
codex mcp logout coloringbookify
codex mcp login coloringbookify
Example request for an agent
Create an 8.5 × 11 inch coloring book about ocean animals. Show me the proposed plan and exact credit cost before generating it, then build the book and download the final PDF.
Authentication
Create one account-level key from the API section in your account, then send it in the Authorization header as a Bearer token. Browser session cookies do not authenticate API requests.
Credits and response headers
Every authenticated response reports the balance after the request and the credits actually consumed by that HTTP call. The endpoint table and OpenAPI x-credit-cost field declare costs before use.
X-ColoringBookify-Credits-Available: 247
X-ColoringBookify-Credits-Consumed: 1
An idempotent replay reports zero consumed because it does not charge again, while the operation body retains its original charged amount.
Idea to printable book
Plans remain client-held. This avoids stale server drafts while keeping the user in control before any credit-changing generation.
- Create a stateless plan with POST /book_plans and display its page concepts and exact credit estimate.
- Let the user review or edit the returned generation_request, then submit it to POST /books with a new idempotency key.
- Poll the returned operation until terminal. Import or replace externally repaired artwork when needed.
- Call GET /print_formats, then download the complete book from GET /books/{id}/pdf.
Generation, retries, and operations
Send a unique Idempotency-Key header with every generation request. Retrying the same method, path, and payload with the same key returns the original response without generating or charging again; reusing it for a different request returns 409.
Generation returns 202 with a resource and an operation. Poll the operation URL until its status is succeeded, partially_succeeded, or failed. Nonterminal responses include Retry-After.
Page aspects and PDF sizes
Call GET /api/v1/print_formats rather than hard-coding sizes. PDF formats must match the book aspect; imported images are normalized without cropping when only a small adjustment is needed.
| Book aspect | Recommended image pixels | Recommended PDF formats |
|---|---|---|
square (1:1) | 1024 × 1024 | square, small_square |
portrait (3:4) | 1152 × 1536 | us_letter, a4 |
landscape (4:3) | 1536 × 1152 | us_letter_landscape, a4_landscape |
Endpoints
Read, create, update, generate, organize, and remove resources owned by the authenticated account.
| Method | Path | Credits | Description |
|---|---|---|---|
| GET | /api/v1/me |
0 | Get the account plan, credits, and API capabilities. |
| GET | /api/v1/print_formats |
0 | List supported PDF sizes, compatible aspects, and recommended image dimensions. |
| POST | /api/v1/book_plans |
0 | Create a stateless editable book plan, exact credit estimate, and ready-to-submit generation payload. |
| GET | /api/v1/operations |
0 | List asynchronous generation operations for the account. |
| GET | /api/v1/operations/{id} |
0 | Poll the current status, progress, and credit result of an operation. |
| GET | /api/v1/characters |
0 | List active reusable characters owned by the account. |
| POST | /api/v1/characters |
1 | Create and asynchronously generate a reusable character. |
| GET | /api/v1/characters/{id} |
0 | Get one owned active reusable character. |
| PATCH | /api/v1/characters/{id} |
0 | Update a character's name or public preview setting. |
| PUT | /api/v1/characters/{id} |
0 | Update a character's name or public preview setting. |
| DELETE | /api/v1/characters/{id} |
0 | Archive an owned reusable character. |
| GET | /api/v1/characters/{id}/reference_image |
0 | Download the character's authorized generated reference image. |
| POST | /api/v1/characters/{id}/regenerate |
1 | Asynchronously regenerate a reusable character. |
| POST | /api/v1/characters/{id}/restore |
0 | Restore an archived reusable character. |
| GET | /api/v1/books |
0 | List books owned by the account. |
| POST | /api/v1/books |
1 per generated content page | Create a book and generate its requested pages and covers asynchronously. |
| GET | /api/v1/books/{id} |
0 | Get one owned book with its ordered page summaries. |
| PATCH | /api/v1/books/{id} |
0 | Update book metadata and reusable characters. |
| PUT | /api/v1/books/{id} |
0 | Update book metadata and reusable characters. |
| DELETE | /api/v1/books/{id} |
0 | Delete an owned book. |
| GET | /api/v1/books/{id}/pdf |
0 | Generate and download a standard final PDF after every included page is ready. |
| POST | /api/v1/books/{book_id}/pages |
0 attach / 1 generate | Generate a new page or attach an existing ready page to a book. |
| DELETE | /api/v1/books/{book_id}/pages/{id} |
0 | Detach a page from a book without deleting the page. |
| PATCH | /api/v1/books/{id}/pages/order |
0 | Replace the ordered list of pages in a book. |
| GET | /api/v1/pages |
0 | List pages owned by the account. |
| POST | /api/v1/pages |
1 | Create and asynchronously generate a standalone page. |
| POST | /api/v1/pages/import |
0 | Import finished external artwork as a ready standalone page. |
| GET | /api/v1/pages/{id} |
0 | Get one owned page. |
| PATCH | /api/v1/pages/{id} |
0 | Update page metadata and reusable characters. |
| PUT | /api/v1/pages/{id} |
0 | Update page metadata and reusable characters. |
| DELETE | /api/v1/pages/{id} |
0 | Delete an owned page. |
| GET | /api/v1/pages/{id}/image |
0 | Download the page's authorized generated image. |
| PUT | /api/v1/pages/{id}/image |
0 | Replace a page image with finished external artwork without AI generation. |
| POST | /api/v1/pages/{id}/regenerate |
1 | Asynchronously regenerate an owned page. |
Pagination
List endpoints accept limit from 1 to 100, defaulting to 25, and an opaque after cursor returned as meta.next_cursor. Treat both resource IDs and cursors as opaque strings.
curl --get https://coloringbookify.com/api/v1/pages \
--header "Authorization: Bearer $COLORINGBOOKIFY_API_KEY" \
--data-urlencode "limit=25" \
--data-urlencode "after=next_cursor_value"
Responses and errors
JSON errors use a stable envelope with a machine-readable code, a safe message, and the request ID. Responses include the API version header and are never publicly cached.
{
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"request_id": "request-id"
}
}
- 400
- Invalid pagination or request parameters.
- 401
- The Bearer token is missing or invalid.
- 402
- The account does not have enough credits for the generation.
- 403
- The account does not currently have an active Business plan.
- 404
- The resource does not exist or is not owned by the account.
- 409
- The idempotency key conflicts with another request or generation is already active.
- 422
- The request failed validation or an account limit was reached.
- 429
- Too many planning requests were made in a short period.
- 503
- Book planning is temporarily unavailable.
Security and current scope
- All API responses use Cache-Control private, no-store.
- Image downloads recheck ownership on every request.
- Source images and permanent storage URLs are never exposed.
- Provider exception details and internal URLs are omitted from errors.
Generation endpoints require idempotency keys, record append-only credit transactions, and expose only safe operation errors.