update_chapter
Edit a chapter (name, description, prose, cover).
/v1/chapters/{collectionId}body is a full replacement of the prose paragraphs ([] clears). coverStorageId comes from a photo upload with target=blob; clearCover removes it.
curl -X PATCH "https://sceniq.earth/api/v1/chapters/kn7e5r9t3y7v1j5p9p3a7s1d5f9g3h7j" \
-H "Authorization: Bearer $SCENIQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"coverStorageId": "kg2a8c4e0g6j2k8m4p0q6s2v8w4y0a6c"
}'Path parameters
- collectionIdstring · chapter idrequired
Id of the chapter or collection (from
list_chapters).
Body parameters
- bodyarray of stringsoptional
Ordered prose paragraphs, chapters only, full replacement ([] clears): at most 100, each at most 10,000 characters; empty paragraphs are dropped.
- clearCoverbooleanoptional
true removes the cover image.
- coverStorageIdstring · stored file idoptional
Storage id returned by the upload endpoint with target=blob.
- descriptionstringoptional
One-line summary shown on the chapter card. Empty string clears.
- expectedUpdatedAtnumberoptional
Optional staleness guard: the chapter's
updatedAtyou last read (list_chapters). The write is refused withstale_editorwhen the chapter changed since. - kindstringoptional
chapter or collection. Turning a chapter into a collection clears its body and its front matter (intro), intro photos included.
chaptercollection - namestringoptional
Chapter title, e.g. Yellowstone or Bernese Oberland. Cannot be empty.
- slugstringoptional
Optional URL slug, unique in the guide: 1 to 63 lowercase letters, digits or hyphens, a letter or digit first (stored lower case). Empty string clears.
Returns
200 OK with this object.
- okbooleanrequired
Always true: the write went through.
Always
true - collectionIdstring · chapter idrequired
The chapter's or collection's id.
{
"ok": true,
"collectionId": "kn7e5r9t3y7v1j5p9p3a7s1d5f9g3h7j"
}Errors
Every error is { error: { code, message } }. Act on the code.
- 400invalid_argumentA required field is missing, a field is unknown, or a value does not match its type (the Convex validator's path and value are in the message).
- 400invalid_requestA writer refused a value: a map link on a host that is not allowed, a title that is too long, a date that does not exist, too many items in a list. The message is the writer's own sentence.
- 409stale_editorThe row changed after the expectedUpdatedAt you sent (update_chapter, save_sales_page_draft).
- 401unauthenticatedThe request carries no key. Send it as Authorization: Bearer sk_sceniq_... (or X-Api-Key).
- 401invalid_api_keyThe key is unknown, revoked or expired.
- 403api_scope_requiredA read-only key called a write operation, or a key without the publish option called publish_changes.
- 403forbiddenThe key belongs to a creator account that is no longer active.
- 404not_foundThe id does not exist or belongs to another creator. The two answers are identical on purpose, so ids never reveal what exists.
- 413payload_too_largeA JSON body over 2 MB, an image over 6 MB, a batch upload over 19 MB, or an MCP message over 2 MB.
- 429rate_limitedOver a limit: requests per key per minute, per creator per hour, uploads per key per minute, or check_links per guide per hour.
- 500internal_errorAn unexpected failure. The message is hidden on purpose.