Write from a brief
POST /v1/write writes something new in a voice from a brief: post, thread, newsletter, article, reply, captions, carousel, week. Letra checks every post, part and caption and fixes what the check flags.
It answers the text, the checks, a write_id and letra_writes: one per started 1,000 words returned.
Request
curl https://letralayer.com/api/v1/write \ -H "Authorization: Bearer $LETRA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"voice_ref":"user-42","format":"thread","brief":"Why we bake through the night, for the second bakery's opening.","channel":"x","char_limit":280}'| Field | What it holds |
|---|---|
voice_ref or voice_id | Required. The voice: your own ref, or Letra's id. |
format | Required. What to write: post, thread, newsletter, article, reply, captions, carousel, week. |
brief | Required. What to write about: the theme, the angle and the facts. Up to 20,000 characters, never a draft. |
context | Optional. Facts, links or research for this write, up to 12,000 characters. Used for the call, never stored. |
instruction | Optional. How to write it, up to 6,000 characters. |
channel | Optional. A channel slug of the voice, for how they write there. Left out: the base voice. |
channels | Optional. For captions and week: up to 10 channels, each with its own char_limit. |
count | Optional. How many takes, 1 to 6, none alike. |
char_limit | Optional. The most characters a post may have. 0 or left out: no limit. |
slides | Optional. For carousel: 2 to 12 slides. |
images | Optional. Up to 4 images, each an https url or inline data with its media_type. Read for the write, never stored. |
revise | Optional. false skips the fix after the check. The check still runs. |
Answer
{ "format": "thread", "written": { "shape": "takes", "takes": [ { "angle": "...", "parts": [ "...", "..." ] } ] }, "checks": [ { "path": [ "takes", 0, "parts", 0 ], "clean": true, "tells": [], "revised": false } ], "write_id": "4f0c...", "ai_generated": true, "letra_writes": 1, "channel": "x"}writtenholds the takes in the shape the format asks for:takes,captions,carouselorweek.checkshas one entry per post, part and caption, andpathsays where it sits inwritten.tellslists what the check still flags.write_idis the write's receipt. Send it inwrite_idswith any learn event about these texts, with the texts exactly as returned.ai_generatedistrue: Letra's model wrote every text inwritten. Store it with the texts and carry it on where you publish. Check a text against its receipt.letra_writesis what the call cost.
Errors
404 voice_not_found for a voice that isn't yours, 400 image_refused or 422 image_unreadable for an image, and 503 when Letra can't write this time; nothing is counted then. Every code: Limits and errors.