API docs
Errors

More

Errors

Every Shiur Reader API error code, its HTTP status and what to do about it.

Every error, from every endpoint, has the same JSON shape and a stable code. Branch on code, never on message: messages are written for people and may change.

The error object#

400 Bad Request
{
  "error": {
    "code": "missing_title",
    "message": "Give the Build a title.",
    "field": "title"
  }
}
codestring
One of the codes below.
messagestring
What went wrong and what to do, in plain English. Fine to show to the people using your software.
fieldstring, optional
The request field the error is about, such as title or pdf_url.
problemsarray, optional
Present when an upload breaks more than one limit: every one of them, each with code, message and field. The top-level error is the first problem.
413 Content Too Large
{
  "error": {
    "code": "pdf_too_many_pages",
    "message": "The PDF has 30 pages. A PDF can have at most 25 pages.",
    "field": "pdf",
    "problems": [
      {
        "code": "pdf_too_many_pages",
        "message": "The PDF has 30 pages. A PDF can have at most 25 pages.",
        "field": "pdf"
      },
      {
        "code": "recording_too_long",
        "message": "The Recording is 4 hours 12 minutes long. A Recording can be at most 4 hours.",
        "field": "recording"
      }
    ]
  }
}

curl

curl -s https://app.shiurreader.com/api/v1/builds \
  -H "Authorization: Bearer $SHIUR_READER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}' | jq .error.code
# "missing_title"

Python

response = requests.post(f"{API}/builds", headers=HEADERS, json=payload)
if response.status_code >= 400:
    error = response.json()["error"]
    if error["code"] == "plan_required":
        ...  # ask an Owner to join the Plan
    elif error["code"] == "rate_limited":
        ...  # wait Retry-After seconds
    else:
        for problem in error.get("problems", [error]):
            print(problem.get("field"), problem["message"])

JavaScript

const response = await fetch(`${API}/builds`, { method: "POST", headers: HEADERS, body });
if (!response.ok) {
  const { error } = await response.json();
  if (error.code === "plan_required") {
    // ask an Owner to join the Plan
  } else {
    for (const problem of error.problems ?? [error]) console.log(problem.field, problem.message);
  }
}

Error codes#

invalid_recording_storage400
recording_storage is not stored or linked, or a Linked Recording was sent as a file.
invalid_request400
The request is malformed in a way no more specific code covers: the body is not valid JSON or not an object, the title is over 300 characters, a PDF and a Word List were both sent, or a Linked recording_url is not an http(s) address.
invalid_visibility400
visibility is not public or restricted.
invalid_webhook_url400
webhook_url is not a public http(s) address, or is over 2000 characters.
invalid_word_list400
word_list is not a non-empty array of non-empty strings, has more than 100,000 words, or has a word over 100 characters.
missing_recording400
No Recording: send recording or recording_url (a Linked Recording needs recording_url).
missing_source_text400
No Source Text: send pdf, pdf_url or word_list.
missing_title400
No title, or a blank one.
not_available_yet400
Reserved. A version 1 field whose feature is not built yet. No field returns it today.
unsupported_language400
The PDF or Word List is not in Hebrew script (Hebrew or Aramaic).
invalid_api_key401
The API Key is missing, unknown or revoked. The answer has WWW-Authenticate: Bearer.
payment_overdue402
A payment is overdue and the Grace Period is over: Readers are offline and new Builds are paused until an Owner pays.
plan_required402
The Free Trial is used up (or has too few Audio Hours left for this Recording) and the Organization is not on the Plan. An Owner can join the Plan on the Billing page.
spending_cap_reached402
Reserved. A Build over the Spending Cap is not refused: it is accepted (202) with status waiting and waiting_reason spending_cap_reached.
not_found404
No such Build or Reader in your Organization (or the Reader was deleted). Also: Timings asked for a PDF Build (use its Reader data instead).
not_ready409
Timings asked for before the Build is done.
file_too_large413
A PDF over 50 MB or a Recording over 300 MB (uploaded or linked).
pdf_too_many_pages413
A PDF over 25 pages.
recording_too_long413
A Recording over 4 hours.
rate_limited429
Too many requests with this API Key. Wait the Retry-After header's seconds.

A path that does not exist under /api/v1 answers 404 with {"detail": "Not Found"} instead of the error object; check the address.

HTTP statuses#

200, 202, 204
Success. 202: a Build was accepted and runs in the background. 204: deleted, no body.
400
The request was refused; nothing changed. Fix the input.
401
Check the API Key.
402
Billing: an Owner needs to join the Plan or pay.
404
Not in your Organization, or deleted.
409
Not ready yet; try again later.
413
A file is over a limit; see Limits.
429
Slow down; wait Retry-After seconds.