Endpoints
Exports
Package a chapter's file and download it.
A chapter's file is packaged, then downloaded. What each format holds and which projects have it is in downloading files.
Prepare a file
POST/api/v1/chapters/:id/export/prepare
Packages one file. Called again until it answers done: true: each call renders what it can in its time budget, and keeps it for the next. Preparing is free, and so is a file prepared again.
| JSON field | Type | What it is |
|---|---|---|
language | string | Required. A target language's code. |
format | string | Required. zip, clean, txt, docx or source. |
budgetMs | integer | How long one call may work before it answers, 0 to 30,000 milliseconds. 8,000 when left out. Each call renders at least a few pages, whatever the budget. |
curl https://tinypica.com/api/v1/chapters/$CHAPTER/export/prepare \
-H "Authorization: Bearer $TINYPICA_KEY" \
-H "Content-Type: application/json" \
-d '{"language": "en", "format": "docx"}'{ "done": false, "rendered": 9, "total": 24 }{
"done": true,
"languageCode": "en",
"format": "docx",
"filename": "chapter-1-en.docx",
"byteSize": 991,
"pageCount": 24,
"preparedAt": "2026-09-28T12:46:52.102Z"
}type PrepareAnswer = PrepareProgress | PreparedFile
interface PrepareProgress {
done: false
rendered: number
total: number
}
interface PreparedFile {
done: true
languageCode: string
format: 'zip' | 'clean' | 'txt' | 'docx' | 'source'
filename: string
byteSize: number
pageCount: number
preparedAt: string
} A file that is done is announced with export.ready.
| Status | When |
|---|---|
400 | The API exports zip, clean, txt, docx, source; A novel chapter exports as text only; a format the project stops before; Validation Error for a missing field. |
404 | Chapter not found. |
413 | The file would be over 90 MB. |
425 | Nothing is translated into that language yet. clean and source are not held up by it. |
Download a file
GET/api/v1/chapters/:id/export/download
The prepared file, as an attachment. For zip, the file the run packaged when none was prepared since.
| Query | What it is |
|---|---|
language | Required. A target language's code. |
format | Required. zip, clean, txt, docx or source. |
curl -OJ "https://tinypica.com/api/v1/chapters/$CHAPTER/export/download?language=en&format=docx" \
-H "Authorization: Bearer $TINYPICA_KEY"HTTP/1.1 200 OK
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Length: 991
Content-Disposition: attachment; filename="chapter-1-en.docx"| format | Content-Type | File name |
|---|---|---|
zip | application/zip | chapter-1-en.zip |
clean | application/zip | chapter-1-clean.zip |
txt | text/plain; charset=utf-8 | chapter-1-en.txt |
docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | chapter-1-en.docx |
source | text/plain; charset=utf-8 | chapter-1-source.txt |
The number in a name is the chapter's, and the code its language's.
| Status | When |
|---|---|
400 | A format the API does not hand out, or a missing query field. |
404 | Chapter not found. |
409 | This export has not been prepared yet; This chapter changed since the export was prepared, prepare it again; The prepared file is no longer available, prepare it again. |