Public API v1

Add a chapter (or more script to a chapter not yet started)

Changed on

Segments are read in order: narration by the narrator, lines by the character named in speaker (add new characters in cast). The title is read first, then a short beat; a sceneBreak segment gets a longer silence. Up to 60,000 characters per chapter, or chapterCharsMax when the plan behind this key has a tighter daily or weekly cap. A long chapter is sent in several requests with appendTo and afterSegment.

post/api/v1/audiobooks/{bookId}/chapters

Request

  • Base URL
    https://api.vieneu.io
  • Auth
    • API key in header X-API-Key
    • or HTTP bearer

Path parameters

bookIdstring required

Request body

titlestring

Read by the narrator, then a short beat.

appendTonumber

Append these segments to an existing chapter that has not started (by index) instead of adding a new one — for chapters too long for one request.

afterSegmentnumber

With appendTo: how many segments the chapter has before these (the segments count of that chapter in the previous answer). A different count answers 409 segment_mismatch instead of adding, so a retried request cannot add its text twice and a lost one cannot leave a gap. Without it, a request repeating the chapter's last segments exactly answers 409 duplicate_segments.

Example request

{
  "title": "Chương 1: Tôi sống độc lập từ thuở bé",
  "segments": [
    {
      "speaker": "Lan",
      "text": "— Mẹ ơi, con đi học đây!"
    }
  ],
  "cast": [
    {
      "speaker": "Lan",
      "voiceId": "Ban Mai"
    }
  ]
}

Response

The book with the chapter added.

idstring required
titlestring required
authorstring nullable required
status'draft' | 'queued' | 'rendering' | 'completed' | 'partial' | 'failed' | 'cancelled' required
narratorVoicestring required
waitingReasonstring nullable required

gpu_busy: books render only while the GPU fleet is idle; quota: the plan hit a limit, retried automatically; queue_full.

errorstring nullable required
otherBooksWaitingnumber nullable required

While started: how many other books are waiting too. Books take turns, a chapter each.

chapterCharsMaxnumber required

The longest chapter (in characters) the plan behind this key can render: a chapter is billed in one go, so it must fit the plan's daily or weekly token cap. 60,000 when the plan has no tighter cap.

createdAtstring date-time required
completedAtstring date-time nullable required

Example response

{
  "cast": [
    {
      "speaker": "Lan",
      "voiceId": "Ban Mai"
    }
  ]
}

Changes

    • info

      added the new optional request property

    • info

      added the non-success response with the status

    • info

      added the required property to the response with the status

    • info

      endpoint added