developer docs

Guides

Uploading chapters

Comic pages one request at a time or all at once, and a novel's chapter as its text.

A chapter always goes into a project that exists. The project decides what happens to it: which languages it is translated into, with which model, and how far its pages are taken. An upload only brings the chapter.

Comic pages

One page is one image:

RuleLimit
FormatPNG, JPEG or WebP. SVG is refused.
Width700 to 1300 pixels. Narrower lettering cannot be read, and a wider image is two pages.
HeightUp to 15,000 pixels.
SizeUp to 25 MB.
Area10 megapixels. A larger page is scaled down to fit, and refused if that would leave it under 700 pixels wide: split a long strip into parts, and upload each part as a page.

Pages are kept as lossless WebP, whatever they arrived as. The type of each part has to say it is an image (image/png and so on); a part that does not is skipped.

Page by page

The way the dashboard uploads, and the one to use for anything longer than a few pages: every request stays small, and a page that fails is sent again on its own.

  1. Create the chapter with staged=1. It has no pages yet, and nothing runs.
  2. Send each page with hold=1 and its page number in position. A page number that is already there is replaced, so retrying is safe.
  3. Start the run with POST /chapters/:id/start. The credits for every page are checked here.
Shell
# The chapter, empty.
CHAPTER=$(curl -s -H "$AUTH" -F staged=1 https://tinypica.com/api/v1/projects/$PROJECT/chapters | jq -r .id)

# Page 1, kept without running. Sent again, it replaces itself.
curl -s -H "$AUTH" -F "[email protected]" -F hold=1 -F position=1 \
  https://tinypica.com/api/v1/chapters/$CHAPTER/pages

# …every other page, then the run.
curl -s -X POST -H "$AUTH" https://tinypica.com/api/v1/chapters/$CHAPTER/start

In one request

For a short chapter, every page can come with the chapter itself, as repeated pages parts in reading order. The run starts at once. One page that is refused refuses the whole request.

Shell
curl -s -H "$AUTH" \
  -F "[email protected]" -F "[email protected]" -F "[email protected]" \
  https://tinypica.com/api/v1/projects/$PROJECT/chapters

Novels

A novel's chapter is its text, in a text field. Paragraphs are split on blank lines (or on every line, when there are none), and gathered into pages of about 2,000 characters for the translation to work through. A chapter holds up to 200,000 characters. The run starts at once, and there are no pages to send.

Shell
# The field's value is the file's text: note the <, not @.
curl -s -H "$AUTH" -F "text=<chapter-12.txt" -F position=12 \
  https://tinypica.com/api/v1/projects/$PROJECT/chapters

Chapter numbers

A new chapter gets the number after the project's highest. Send position to choose it; a number that is taken is a 409, This project already has a chapter 12.

Credits

Every upload needs a balance of at least one credit. A run's full cost, for every page in every language, is checked before it starts: at start for a staged chapter, and with the upload otherwise. Short of it, the answer is a 402, Insufficient credits: please top up your balance, and nothing runs. A page through every step costs 10 credits in one language on the default model, and 3 more for each further language; see pricing for the rest.

Adding pages later

A page sent to a chapter that has already run goes after its last page, and runs by itself. A page number is refused then, since the pages before it have been translated as they stand.

Shell
# A page for a chapter that has already run: it goes after the last one,
# and runs by itself.
curl -s -H "$AUTH" -F "[email protected]" https://tinypica.com/api/v1/chapters/$CHAPTER/pages

Pages sent with hold=1 to such a chapter wait for a start that names them: {"pageIds": ["…"]}.

While a chapter runs

New pages and a new start are refused with a 409 until the run is over. Read where it stands with GET /chapters/:id, or let a webhook tell you.

Running a chapter again

A run that failed says so: failed is true and failureReason says why. POST /chapters/:id/rescan runs the chapter again from its art, which is also how a failure is retried.

A re-scan throws away every translation of the chapter, edits made in the editor included, and its prepared files. It costs the credits of a new run.