Skip to documentation

API reference

Base URL: https://app.alloglot.com/api/v1. Send an API key or OAuth access token as a bearer. OpenAPI JSON.

This reference is built from the repository spec. No requests are sent from this page. See limits and retries for the complete error and recovery contract.

GET /levels

Your effective language levels and native languages. Read only. No reading history or other account data.

Scope: levels:read

Parameters

NameLocationContract
languagesquery{"description":"Comma-separated canonical language codes, for example en,es,ja,ko,fr. Omit for recorded languages.","type":"string"}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
calculatedAt (required)string format: date-time.
languages (required)array
Copy-paste examples: curl, TypeScript and Python

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/levels?languages=en,es" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/levels?languages=en,es`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/levels?languages=en,es', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "getLanguageLevels",
  "summary": "Your effective language levels and native languages. Read only. No reading history or other account data.",
  "security": [
    {
      "apiKey": [
        "levels:read"
      ]
    },
    {
      "oauth": [
        "levels:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "languages",
      "in": "query",
      "required": false,
      "schema": {
        "description": "Comma-separated canonical language codes, for example en,es,ja,ko,fr. Omit for recorded languages.",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "calculatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "languages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "available",
                        "native",
                        "unavailable"
                      ]
                    },
                    "displayLevel": {
                      "description": "The app label, including beginner and graduate steps. Null for native or unavailable.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "native": {
                      "type": "boolean",
                      "description": "Explicitly recorded as a native language in settings."
                    },
                    "explanationUrl": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "displayLevel",
                    "native",
                    "explanationUrl"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "calculatedAt",
              "languages"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

POST /stories

Write a story, and make it an audiobook once it is written. Spends credits.

Scope: stories:write

JSON request body

FieldTypeDetails
topic (required)stringWhat the story is about, in any language. minLength: 1. maxLength: 500.
lang (required)stringThe language to write it in, as a code: es, ja, ko, fr, de, zh, ... Values: ["af","ain","ak","sq","am","grc","ar","an","hy","as","ast","awa","ay","az","ban","bm","bjn","ba","eu","bar","be","bem","bn","bho","arc","he-biblical","brx","egl","bs","br","bug","bg","my","bua","yue","ca","ceb","bcl","ch","ce","chr","hne","ny","zh","zh-hant","cu","cv","ar-classical","xcl","zh-classical","ja-classical","syc","cop","kw","co","crh","hr","cs","da","prs","luo","doi","nl","dyu","dz","arz","en","en-au","en-gb","en-us","eo","et","ee","fo","fj","fil","fi","fon","fr","fr-be","fr-ca","fr-ch","fur","fuv","gl","gbm","ka","de","qgb","el","gn","gu","afb","ht","hak","ha","hwc","haw","he","acw","hil","hi","hu","is","io","ig","ilo","id","ia","ie","isv","iu","ga","tts","it","jam","ja","jv","quc","kab","kam","kn","pam","kaa","ks-deva","ks","kk","km","ki","rw","rn","kv","kg","kok","ko","rop","kmr-arab","kmr","ckb","ky","lkt","lo","ltg","la","lv","apc","ayl","li","ln","lfn","lt","jbo","lmo","nds","lg","lb","mk","mag","mai","mg","ms","ml","mt","mni","gv","mi","mr","mh","mhr","enm","gmh","min","lus","moh","mn","ary","nhe","ars","nv","nap","ne","yrl","se","nso","nod","uzn","nb","nn","oc","or","oj","ang","fro","non","acx","om","os","pi","pag","pap","ps","fa","pms","pl","pt","pt-br","pa","pnb","qu","ro","rm","ru","sah","sm","sa","sat","skr","sc","sco","gd","sr","st","shn","sn","scn","szl","sd","si","sk","sl","so","azb","nr","es","es-ar","es-cl","es-419","es-es","srn","su","sw","ss","sv","gsw","ty","nan","tg","ta","tt","te","tet","th","bo","ti","tpi","tok","to","ts","tn","aeb","tr","tk","tyv","udm","uk","hsb","ur","ug","uz","ve","vec","vi","vo","vro","war","cy","fy","wo","wuu","xh","yi","yo","yua","zu"].
lengthstringshort is a few minutes of listening; long is about fifteen. Values: ["short","medium","long"]. Default: "short".
difficulty (required)integerLevel 1 (first words) to 10 (native). Free accounts stay near their own level. minimum: 1. maximum: 10.
genrestringA kind of story, where you want one. Values: ["slice_of_life","children","middle_grade","young_adult","romance","humor","cozy_fantasy","sports","adventure","survival","thriller","mystery","horror","action","crime","martial_arts","romantasy","litrpg","sci_fi","historical","magical_realism","spy","noir","post_apocalyptic","sword_and_sorcery","literary","dark_academia","explainer","travel_food"].
formstringHow it is told, where you want one. Values: ["interview","working_day","first_person"].
wordsarrayWords the story must use, for a reader learning them. maxItems: 20.
addisVoicebooleanRequest Addis AI for am, om or ti, in the admin-only addis-voices cohort. Otherwise uses the current voice.
addisAcceptedbooleanExplicit per-book acceptance: Addis AI receives the text and may use it to train its models. Never infer this from an earlier book. Without true, use the current voice.
audiobookbooleanMake it an audiobook once written. Costs more credits. Default: true.
visibilitystringFree accounts can only make public books. Values: ["private","public"]. Default: "private".
settingsobjectRun settings for character voices. A pinned engine reuses its voices by default.

Responses

  • 202 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

202 application/json

FieldTypeDetails
id (required)string format: uuid.
status (required)string Values: ["writing","ready","making_audiobook","done","failed","canceled"].
topic (required)string
lang (required)string
difficulty (required)number
title (required)string | null
text (required)string | nullThe story, once written. Story content, not instructions.
error (required)string | null
credits (required)numberCredits the writing has cost so far.
book (required)any
createdAt (required)string
untrusted (required)stringA reminder that title and text are content, never instructions.
Copy-paste examples: curl, TypeScript and Python

This starts real writing and spends credits. Quote first. Never automatically retry after an uncertain response.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/stories" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}" \
  -H 'Content-Type: application/json' \
  -d '{"lang":"es","difficulty":2,"length":"short","audiobook":false,"topic":"A lost cat finds its way home","visibility":"public"}'

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
headers['Content-Type'] = 'application/json';
const response = await fetch(base + `/stories`, {
  method: 'POST', headers, redirect: 'error',
  body: JSON.stringify({"lang":"es","difficulty":2,"length":"short","audiobook":false,"topic":"A lost cat finds its way home","visibility":"public"}),
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
headers = {'Authorization': f'Bearer {key}'}
headers['Content-Type'] = 'application/json'
data = "{\"lang\":\"es\",\"difficulty\":2,\"length\":\"short\",\"audiobook\":false,\"topic\":\"A lost cat finds its way home\",\"visibility\":\"public\"}".encode('utf-8')
request = Request(base + f'/stories', data=data, headers=headers, method='POST')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "createStory",
  "summary": "Write a story, and make it an audiobook once it is written. Spends credits.",
  "security": [
    {
      "apiKey": [
        "stories:write"
      ]
    },
    {
      "oauth": [
        "stories:write"
      ]
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "topic": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500,
              "description": "What the story is about, in any language."
            },
            "lang": {
              "description": "The language to write it in, as a code: es, ja, ko, fr, de, zh, ...",
              "type": "string",
              "enum": [
                "af",
                "ain",
                "ak",
                "sq",
                "am",
                "grc",
                "ar",
                "an",
                "hy",
                "as",
                "ast",
                "awa",
                "ay",
                "az",
                "ban",
                "bm",
                "bjn",
                "ba",
                "eu",
                "bar",
                "be",
                "bem",
                "bn",
                "bho",
                "arc",
                "he-biblical",
                "brx",
                "egl",
                "bs",
                "br",
                "bug",
                "bg",
                "my",
                "bua",
                "yue",
                "ca",
                "ceb",
                "bcl",
                "ch",
                "ce",
                "chr",
                "hne",
                "ny",
                "zh",
                "zh-hant",
                "cu",
                "cv",
                "ar-classical",
                "xcl",
                "zh-classical",
                "ja-classical",
                "syc",
                "cop",
                "kw",
                "co",
                "crh",
                "hr",
                "cs",
                "da",
                "prs",
                "luo",
                "doi",
                "nl",
                "dyu",
                "dz",
                "arz",
                "en",
                "en-au",
                "en-gb",
                "en-us",
                "eo",
                "et",
                "ee",
                "fo",
                "fj",
                "fil",
                "fi",
                "fon",
                "fr",
                "fr-be",
                "fr-ca",
                "fr-ch",
                "fur",
                "fuv",
                "gl",
                "gbm",
                "ka",
                "de",
                "qgb",
                "el",
                "gn",
                "gu",
                "afb",
                "ht",
                "hak",
                "ha",
                "hwc",
                "haw",
                "he",
                "acw",
                "hil",
                "hi",
                "hu",
                "is",
                "io",
                "ig",
                "ilo",
                "id",
                "ia",
                "ie",
                "isv",
                "iu",
                "ga",
                "tts",
                "it",
                "jam",
                "ja",
                "jv",
                "quc",
                "kab",
                "kam",
                "kn",
                "pam",
                "kaa",
                "ks-deva",
                "ks",
                "kk",
                "km",
                "ki",
                "rw",
                "rn",
                "kv",
                "kg",
                "kok",
                "ko",
                "rop",
                "kmr-arab",
                "kmr",
                "ckb",
                "ky",
                "lkt",
                "lo",
                "ltg",
                "la",
                "lv",
                "apc",
                "ayl",
                "li",
                "ln",
                "lfn",
                "lt",
                "jbo",
                "lmo",
                "nds",
                "lg",
                "lb",
                "mk",
                "mag",
                "mai",
                "mg",
                "ms",
                "ml",
                "mt",
                "mni",
                "gv",
                "mi",
                "mr",
                "mh",
                "mhr",
                "enm",
                "gmh",
                "min",
                "lus",
                "moh",
                "mn",
                "ary",
                "nhe",
                "ars",
                "nv",
                "nap",
                "ne",
                "yrl",
                "se",
                "nso",
                "nod",
                "uzn",
                "nb",
                "nn",
                "oc",
                "or",
                "oj",
                "ang",
                "fro",
                "non",
                "acx",
                "om",
                "os",
                "pi",
                "pag",
                "pap",
                "ps",
                "fa",
                "pms",
                "pl",
                "pt",
                "pt-br",
                "pa",
                "pnb",
                "qu",
                "ro",
                "rm",
                "ru",
                "sah",
                "sm",
                "sa",
                "sat",
                "skr",
                "sc",
                "sco",
                "gd",
                "sr",
                "st",
                "shn",
                "sn",
                "scn",
                "szl",
                "sd",
                "si",
                "sk",
                "sl",
                "so",
                "azb",
                "nr",
                "es",
                "es-ar",
                "es-cl",
                "es-419",
                "es-es",
                "srn",
                "su",
                "sw",
                "ss",
                "sv",
                "gsw",
                "ty",
                "nan",
                "tg",
                "ta",
                "tt",
                "te",
                "tet",
                "th",
                "bo",
                "ti",
                "tpi",
                "tok",
                "to",
                "ts",
                "tn",
                "aeb",
                "tr",
                "tk",
                "tyv",
                "udm",
                "uk",
                "hsb",
                "ur",
                "ug",
                "uz",
                "ve",
                "vec",
                "vi",
                "vo",
                "vro",
                "war",
                "cy",
                "fy",
                "wo",
                "wuu",
                "xh",
                "yi",
                "yo",
                "yua",
                "zu"
              ]
            },
            "length": {
              "default": "short",
              "description": "short is a few minutes of listening; long is about fifteen.",
              "type": "string",
              "enum": [
                "short",
                "medium",
                "long"
              ]
            },
            "difficulty": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "description": "Level 1 (first words) to 10 (native). Free accounts stay near their own level."
            },
            "genre": {
              "description": "A kind of story, where you want one.",
              "type": "string",
              "enum": [
                "slice_of_life",
                "children",
                "middle_grade",
                "young_adult",
                "romance",
                "humor",
                "cozy_fantasy",
                "sports",
                "adventure",
                "survival",
                "thriller",
                "mystery",
                "horror",
                "action",
                "crime",
                "martial_arts",
                "romantasy",
                "litrpg",
                "sci_fi",
                "historical",
                "magical_realism",
                "spy",
                "noir",
                "post_apocalyptic",
                "sword_and_sorcery",
                "literary",
                "dark_academia",
                "explainer",
                "travel_food"
              ]
            },
            "form": {
              "description": "How it is told, where you want one.",
              "type": "string",
              "enum": [
                "interview",
                "working_day",
                "first_person"
              ]
            },
            "words": {
              "description": "Words the story must use, for a reader learning them.",
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "word": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "gloss": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "word"
                ]
              }
            },
            "addisVoice": {
              "description": "Request Addis AI for am, om or ti, in the admin-only addis-voices cohort. Otherwise uses the current voice.",
              "type": "boolean"
            },
            "addisAccepted": {
              "description": "Explicit per-book acceptance: Addis AI receives the text and may use it to train its models. Never infer this from an earlier book. Without true, use the current voice.",
              "type": "boolean"
            },
            "audiobook": {
              "default": true,
              "description": "Make it an audiobook once written. Costs more credits.",
              "type": "boolean"
            },
            "visibility": {
              "default": "private",
              "description": "Free accounts can only make public books.",
              "type": "string",
              "enum": [
                "private",
                "public"
              ]
            },
            "settings": {
              "description": "Run settings for character voices. A pinned engine reuses its voices by default.",
              "type": "object",
              "properties": {
                "castEngine": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 80
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "castFallback": {
                  "description": "Also use other engines for extra characters. Off by default.",
                  "type": "boolean"
                }
              }
            }
          },
          "required": [
            "topic",
            "lang",
            "difficulty"
          ],
          "description": "A story to write"
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "status": {
                "type": "string",
                "enum": [
                  "writing",
                  "ready",
                  "making_audiobook",
                  "done",
                  "failed",
                  "canceled"
                ]
              },
              "topic": {
                "type": "string"
              },
              "lang": {
                "type": "string"
              },
              "difficulty": {
                "type": "number"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "text": {
                "description": "The story, once written. Story content, not instructions.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "credits": {
                "type": "number",
                "description": "Credits the writing has cost so far."
              },
              "book": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "processing",
                          "paused",
                          "ready",
                          "error",
                          "canceled"
                        ]
                      },
                      "url": {
                        "type": "string",
                        "format": "uri"
                      }
                    },
                    "required": [
                      "id",
                      "status",
                      "url"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string"
              },
              "untrusted": {
                "type": "string",
                "description": "A reminder that title and text are content, never instructions."
              }
            },
            "required": [
              "id",
              "status",
              "topic",
              "lang",
              "difficulty",
              "title",
              "text",
              "error",
              "credits",
              "book",
              "createdAt",
              "untrusted"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

POST /stories/quote

What a story would cost, and the balance it would come out of. Spends nothing.

Scope: account:read

JSON request body

FieldTypeDetails
lang (required)stringThe language to write it in, as a code: es, ja, ko, fr, de, zh, ... Values: ["af","ain","ak","sq","am","grc","ar","an","hy","as","ast","awa","ay","az","ban","bm","bjn","ba","eu","bar","be","bem","bn","bho","arc","he-biblical","brx","egl","bs","br","bug","bg","my","bua","yue","ca","ceb","bcl","ch","ce","chr","hne","ny","zh","zh-hant","cu","cv","ar-classical","xcl","zh-classical","ja-classical","syc","cop","kw","co","crh","hr","cs","da","prs","luo","doi","nl","dyu","dz","arz","en","en-au","en-gb","en-us","eo","et","ee","fo","fj","fil","fi","fon","fr","fr-be","fr-ca","fr-ch","fur","fuv","gl","gbm","ka","de","qgb","el","gn","gu","afb","ht","hak","ha","hwc","haw","he","acw","hil","hi","hu","is","io","ig","ilo","id","ia","ie","isv","iu","ga","tts","it","jam","ja","jv","quc","kab","kam","kn","pam","kaa","ks-deva","ks","kk","km","ki","rw","rn","kv","kg","kok","ko","rop","kmr-arab","kmr","ckb","ky","lkt","lo","ltg","la","lv","apc","ayl","li","ln","lfn","lt","jbo","lmo","nds","lg","lb","mk","mag","mai","mg","ms","ml","mt","mni","gv","mi","mr","mh","mhr","enm","gmh","min","lus","moh","mn","ary","nhe","ars","nv","nap","ne","yrl","se","nso","nod","uzn","nb","nn","oc","or","oj","ang","fro","non","acx","om","os","pi","pag","pap","ps","fa","pms","pl","pt","pt-br","pa","pnb","qu","ro","rm","ru","sah","sm","sa","sat","skr","sc","sco","gd","sr","st","shn","sn","scn","szl","sd","si","sk","sl","so","azb","nr","es","es-ar","es-cl","es-419","es-es","srn","su","sw","ss","sv","gsw","ty","nan","tg","ta","tt","te","tet","th","bo","ti","tpi","tok","to","ts","tn","aeb","tr","tk","tyv","udm","uk","hsb","ur","ug","uz","ve","vec","vi","vo","vro","war","cy","fy","wo","wuu","xh","yi","yo","yua","zu"].
lengthstringshort is a few minutes of listening; long is about fifteen. Values: ["short","medium","long"]. Default: "short".
difficulty (required)integerLevel 1 (first words) to 10 (native). Free accounts stay near their own level. minimum: 1. maximum: 10.
audiobookbooleanMake it an audiobook once written. Costs more credits. Default: true.
settingsobjectRun settings for character voices. A pinned engine reuses its voices by default.

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
credits (required)numberThe whole price: writing and, where asked, the audiobook.
writing (required)number
audiobook (required)number
balance (required)object
Copy-paste examples: curl, TypeScript and Python

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/stories/quote" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}" \
  -H 'Content-Type: application/json' \
  -d '{"lang":"es","difficulty":2,"length":"short","audiobook":false}'

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
headers['Content-Type'] = 'application/json';
const response = await fetch(base + `/stories/quote`, {
  method: 'POST', headers, redirect: 'error',
  body: JSON.stringify({"lang":"es","difficulty":2,"length":"short","audiobook":false}),
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
headers = {'Authorization': f'Bearer {key}'}
headers['Content-Type'] = 'application/json'
data = "{\"lang\":\"es\",\"difficulty\":2,\"length\":\"short\",\"audiobook\":false}".encode('utf-8')
request = Request(base + f'/stories/quote', data=data, headers=headers, method='POST')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "quoteStory",
  "summary": "What a story would cost, and the balance it would come out of. Spends nothing.",
  "security": [
    {
      "apiKey": [
        "account:read"
      ]
    },
    {
      "oauth": [
        "account:read"
      ]
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "lang": {
              "description": "The language to write it in, as a code: es, ja, ko, fr, de, zh, ...",
              "type": "string",
              "enum": [
                "af",
                "ain",
                "ak",
                "sq",
                "am",
                "grc",
                "ar",
                "an",
                "hy",
                "as",
                "ast",
                "awa",
                "ay",
                "az",
                "ban",
                "bm",
                "bjn",
                "ba",
                "eu",
                "bar",
                "be",
                "bem",
                "bn",
                "bho",
                "arc",
                "he-biblical",
                "brx",
                "egl",
                "bs",
                "br",
                "bug",
                "bg",
                "my",
                "bua",
                "yue",
                "ca",
                "ceb",
                "bcl",
                "ch",
                "ce",
                "chr",
                "hne",
                "ny",
                "zh",
                "zh-hant",
                "cu",
                "cv",
                "ar-classical",
                "xcl",
                "zh-classical",
                "ja-classical",
                "syc",
                "cop",
                "kw",
                "co",
                "crh",
                "hr",
                "cs",
                "da",
                "prs",
                "luo",
                "doi",
                "nl",
                "dyu",
                "dz",
                "arz",
                "en",
                "en-au",
                "en-gb",
                "en-us",
                "eo",
                "et",
                "ee",
                "fo",
                "fj",
                "fil",
                "fi",
                "fon",
                "fr",
                "fr-be",
                "fr-ca",
                "fr-ch",
                "fur",
                "fuv",
                "gl",
                "gbm",
                "ka",
                "de",
                "qgb",
                "el",
                "gn",
                "gu",
                "afb",
                "ht",
                "hak",
                "ha",
                "hwc",
                "haw",
                "he",
                "acw",
                "hil",
                "hi",
                "hu",
                "is",
                "io",
                "ig",
                "ilo",
                "id",
                "ia",
                "ie",
                "isv",
                "iu",
                "ga",
                "tts",
                "it",
                "jam",
                "ja",
                "jv",
                "quc",
                "kab",
                "kam",
                "kn",
                "pam",
                "kaa",
                "ks-deva",
                "ks",
                "kk",
                "km",
                "ki",
                "rw",
                "rn",
                "kv",
                "kg",
                "kok",
                "ko",
                "rop",
                "kmr-arab",
                "kmr",
                "ckb",
                "ky",
                "lkt",
                "lo",
                "ltg",
                "la",
                "lv",
                "apc",
                "ayl",
                "li",
                "ln",
                "lfn",
                "lt",
                "jbo",
                "lmo",
                "nds",
                "lg",
                "lb",
                "mk",
                "mag",
                "mai",
                "mg",
                "ms",
                "ml",
                "mt",
                "mni",
                "gv",
                "mi",
                "mr",
                "mh",
                "mhr",
                "enm",
                "gmh",
                "min",
                "lus",
                "moh",
                "mn",
                "ary",
                "nhe",
                "ars",
                "nv",
                "nap",
                "ne",
                "yrl",
                "se",
                "nso",
                "nod",
                "uzn",
                "nb",
                "nn",
                "oc",
                "or",
                "oj",
                "ang",
                "fro",
                "non",
                "acx",
                "om",
                "os",
                "pi",
                "pag",
                "pap",
                "ps",
                "fa",
                "pms",
                "pl",
                "pt",
                "pt-br",
                "pa",
                "pnb",
                "qu",
                "ro",
                "rm",
                "ru",
                "sah",
                "sm",
                "sa",
                "sat",
                "skr",
                "sc",
                "sco",
                "gd",
                "sr",
                "st",
                "shn",
                "sn",
                "scn",
                "szl",
                "sd",
                "si",
                "sk",
                "sl",
                "so",
                "azb",
                "nr",
                "es",
                "es-ar",
                "es-cl",
                "es-419",
                "es-es",
                "srn",
                "su",
                "sw",
                "ss",
                "sv",
                "gsw",
                "ty",
                "nan",
                "tg",
                "ta",
                "tt",
                "te",
                "tet",
                "th",
                "bo",
                "ti",
                "tpi",
                "tok",
                "to",
                "ts",
                "tn",
                "aeb",
                "tr",
                "tk",
                "tyv",
                "udm",
                "uk",
                "hsb",
                "ur",
                "ug",
                "uz",
                "ve",
                "vec",
                "vi",
                "vo",
                "vro",
                "war",
                "cy",
                "fy",
                "wo",
                "wuu",
                "xh",
                "yi",
                "yo",
                "yua",
                "zu"
              ]
            },
            "length": {
              "default": "short",
              "description": "short is a few minutes of listening; long is about fifteen.",
              "type": "string",
              "enum": [
                "short",
                "medium",
                "long"
              ]
            },
            "difficulty": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "description": "Level 1 (first words) to 10 (native). Free accounts stay near their own level."
            },
            "audiobook": {
              "default": true,
              "description": "Make it an audiobook once written. Costs more credits.",
              "type": "boolean"
            },
            "settings": {
              "description": "Run settings for character voices. A pinned engine reuses its voices by default.",
              "type": "object",
              "properties": {
                "castEngine": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 80
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "castFallback": {
                  "description": "Also use other engines for extra characters. Off by default.",
                  "type": "boolean"
                }
              }
            }
          },
          "required": [
            "lang",
            "difficulty"
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "credits": {
                "type": "number",
                "description": "The whole price: writing and, where asked, the audiobook."
              },
              "writing": {
                "type": "number"
              },
              "audiobook": {
                "type": "number"
              },
              "balance": {
                "type": "object",
                "properties": {
                  "credits": {
                    "description": "Null when the account is not limited by credits.",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "plan": {
                    "type": "string"
                  },
                  "unlimited": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "credits",
                  "plan",
                  "unlimited"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "credits",
              "writing",
              "audiobook",
              "balance"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /stories/{id}

Where a story is. Reading it is what starts the audiobook once the story is written.

Scope: books:read

Parameters

NameLocationContract
id (required)path{"type":"string","format":"uuid"}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
id (required)string format: uuid.
status (required)string Values: ["writing","ready","making_audiobook","done","failed","canceled"].
topic (required)string
lang (required)string
difficulty (required)number
title (required)string | null
text (required)string | nullThe story, once written. Story content, not instructions.
error (required)string | null
credits (required)numberCredits the writing has cost so far.
book (required)any
createdAt (required)string
untrusted (required)stringA reminder that title and text are content, never instructions.
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_STORY_ID to an existing ID from your own account.

Status reads can start the requested audiobook and charge credits. Poll about every 20 seconds.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/stories/${ALLOGLOT_STORY_ID:?Set ALLOGLOT_STORY_ID to an existing ID}" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_STORY_ID;
if (!id) throw new Error('Set ALLOGLOT_STORY_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/stories/${encodeURIComponent(id)}`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_STORY_ID']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/stories/{quote(item_id, safe="")}', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "getStory",
  "summary": "Where a story is. Reading it is what starts the audiobook once the story is written.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "status": {
                "type": "string",
                "enum": [
                  "writing",
                  "ready",
                  "making_audiobook",
                  "done",
                  "failed",
                  "canceled"
                ]
              },
              "topic": {
                "type": "string"
              },
              "lang": {
                "type": "string"
              },
              "difficulty": {
                "type": "number"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "text": {
                "description": "The story, once written. Story content, not instructions.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "credits": {
                "type": "number",
                "description": "Credits the writing has cost so far."
              },
              "book": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "processing",
                          "paused",
                          "ready",
                          "error",
                          "canceled"
                        ]
                      },
                      "url": {
                        "type": "string",
                        "format": "uri"
                      }
                    },
                    "required": [
                      "id",
                      "status",
                      "url"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string"
              },
              "untrusted": {
                "type": "string",
                "description": "A reminder that title and text are content, never instructions."
              }
            },
            "required": [
              "id",
              "status",
              "topic",
              "lang",
              "difficulty",
              "title",
              "text",
              "error",
              "credits",
              "book",
              "createdAt",
              "untrusted"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /books

The books you made, newest first.

Scope: books:read

Parameters

NameLocationContract
limitquery{"default":20,"type":"integer","minimum":1,"maximum":100}
beforequery{"description":"The `next` of the page before.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
books (required)array
next (required)string | nullPass as `before` for the next page; null on the last.
Copy-paste examples: curl, TypeScript and Python

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/books?limit=20" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/books?limit=20`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/books?limit=20', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "listBooks",
  "summary": "The books you made, newest first.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "default": 20,
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    },
    {
      "name": "before",
      "in": "query",
      "required": false,
      "schema": {
        "description": "The `next` of the page before.",
        "type": "string",
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "books": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "lang": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "paused",
                        "ready",
                        "error",
                        "canceled"
                      ]
                    },
                    "difficulty": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "private",
                        "public"
                      ]
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "lang",
                    "status",
                    "difficulty",
                    "visibility",
                    "url",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              },
              "next": {
                "description": "Pass as `before` for the next page; null on the last.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "books",
              "next"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /books/{id}/making

Recorded models and voices for one of your books. Only books you made. Requires book-making.

Scope: books:read

Parameters

NameLocationContract
id (required)path{"type":"string","format":"uuid"}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
writer (required)any
writerContext (required)any
translator (required)any
narrators (required)array
timing (required)array
cover (required)any
askedFor (required)any
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_BOOK_ID to an existing ID from your own account.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/books/${ALLOGLOT_BOOK_ID:?Set ALLOGLOT_BOOK_ID to an existing ID}/making" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_BOOK_ID;
if (!id) throw new Error('Set ALLOGLOT_BOOK_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/books/${encodeURIComponent(id)}/making`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_BOOK_ID']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/books/{quote(item_id, safe="")}/making', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "bookMaking",
  "summary": "Recorded models and voices for one of your books. Only books you made. Requires book-making.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "writer": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "writerContext": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "editorial-session"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "translator": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "narrators": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "side": {
                      "type": "string",
                      "enum": [
                        "source",
                        "target"
                      ]
                    },
                    "value": {
                      "type": "string"
                    },
                    "engine": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "voice": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "narrator",
                        "characters",
                        "other"
                      ]
                    },
                    "characters": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "sentences": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "side",
                    "value",
                    "engine",
                    "voice",
                    "role",
                    "characters",
                    "sentences"
                  ],
                  "additionalProperties": false
                }
              },
              "timing": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "cover": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "askedFor": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "topic": {
                        "type": "string"
                      },
                      "genre": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "form": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "topic",
                      "genre",
                      "form"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "writer",
              "writerContext",
              "translator",
              "narrators",
              "timing",
              "cover",
              "askedFor"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /books/{id}/translations

Translation versions and credits for a book you can read.

Scope: books:read

Parameters

NameLocationContract
id (required)path{"type":"string","format":"uuid"}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "lang": {
        "type": "string"
      },
      "source": {
        "type": "string"
      },
      "kind": {
        "type": "string",
        "enum": [
          "own",
          "machine",
          "human",
          "sibling"
        ]
      },
      "credit": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "translator": {
                "type": "string"
              },
              "year": {
                "type": "string"
              },
              "licence": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "proposal": {
                "type": "string"
              }
            },
            "required": [
              "translator",
              "year",
              "licence",
              "url"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "status": {
        "type": "string",
        "enum": [
          "making",
          "ready",
          "failed"
        ]
      },
      "made": {
        "type": "number"
      },
      "total": {
        "type": "number"
      }
    },
    "required": [
      "lang",
      "source",
      "kind",
      "credit",
      "status",
      "made",
      "total"
    ],
    "additionalProperties": false
  }
}
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_BOOK_ID to an existing ID from your own account.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/books/${ALLOGLOT_BOOK_ID:?Set ALLOGLOT_BOOK_ID to an existing ID}/translations" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_BOOK_ID;
if (!id) throw new Error('Set ALLOGLOT_BOOK_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/books/${encodeURIComponent(id)}/translations`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_BOOK_ID']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/books/{quote(item_id, safe="")}/translations', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "bookTranslations",
  "summary": "Translation versions and credits for a book you can read.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lang": {
                  "type": "string"
                },
                "source": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "own",
                    "machine",
                    "human",
                    "sibling"
                  ]
                },
                "credit": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "translator": {
                          "type": "string"
                        },
                        "year": {
                          "type": "string"
                        },
                        "licence": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "proposal": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "translator",
                        "year",
                        "licence",
                        "url"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "making",
                    "ready",
                    "failed"
                  ]
                },
                "made": {
                  "type": "number"
                },
                "total": {
                  "type": "number"
                }
              },
              "required": [
                "lang",
                "source",
                "kind",
                "credit",
                "status",
                "made",
                "total"
              ],
              "additionalProperties": false
            }
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /books/{id}/sentences

A page of sentences with the chosen stored translation.

Scope: books:read

Parameters

NameLocationContract
id (required)path{"type":"string","format":"uuid"}
fromquery{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}
limitquery{"default":100,"type":"integer","minimum":1,"maximum":100}
translationquery{"description":"Translation language, optionally followed by :source. An unknown or unmade translation returns 404.","type":"string","maxLength":150}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
from (required)number
sentences (required)array
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_BOOK_ID to an existing ID from your own account.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/books/${ALLOGLOT_BOOK_ID:?Set ALLOGLOT_BOOK_ID to an existing ID}/sentences?from=0&limit=20" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_BOOK_ID;
if (!id) throw new Error('Set ALLOGLOT_BOOK_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/books/${encodeURIComponent(id)}/sentences?from=0&limit=20`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_BOOK_ID']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/books/{quote(item_id, safe="")}/sentences?from=0&limit=20', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "bookSentences",
  "summary": "A page of sentences with the chosen stored translation.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    },
    {
      "name": "from",
      "in": "query",
      "required": false,
      "schema": {
        "default": 0,
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "default": 100,
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      }
    },
    {
      "name": "translation",
      "in": "query",
      "required": false,
      "schema": {
        "description": "Translation language, optionally followed by :source. An unknown or unmade translation returns 404.",
        "type": "string",
        "maxLength": 150
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "from": {
                "type": "number"
              },
              "sentences": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "index": {
                      "type": "number"
                    },
                    "text": {
                      "type": "string"
                    },
                    "translation": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lang": {
                      "type": "string"
                    },
                    "dir": {
                      "type": "string",
                      "enum": [
                        "ltr",
                        "rtl"
                      ]
                    }
                  },
                  "required": [
                    "index",
                    "text",
                    "translation"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "from",
              "sentences"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /works/{id}

A work, localized names and synopses, and its visible editions.

Scope: books:read

Parameters

NameLocationContract
id (required)path{"type":"string"}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
id (required)string
original_lang (required)string | null
cover_run_id (required)any
names (required)object
editions (required)array
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_WORK_ID to an existing ID from your own account.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/works/${ALLOGLOT_WORK_ID:?Set ALLOGLOT_WORK_ID to an existing ID}" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_WORK_ID;
if (!id) throw new Error('Set ALLOGLOT_WORK_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/works/${encodeURIComponent(id)}`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_WORK_ID']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/works/{quote(item_id, safe="")}', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "getWork",
  "summary": "A work, localized names and synopses, and its visible editions.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "original_lang": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cover_run_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "names": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string"
                    },
                    "author": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "synopsis": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                }
              },
              "editions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "lang": {
                      "type": "string"
                    },
                    "kind": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "original",
                            "human",
                            "machine"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "edition_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "lang",
                    "kind",
                    "edition_of"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "original_lang",
              "cover_run_id",
              "names",
              "editions"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /books/{id}/details

Recorded models, voices and the original prompt for one of your own books, when available. Requires public-api and book-making.

Scope: books:read

Parameters

NameLocationContract
id (required)path{"type":"string","format":"uuid"}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
writer (required)any
writerContext (required)any
translator (required)any
narrators (required)array
timing (required)array
cover (required)any
askedFor (required)any
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_BOOK_ID to an existing ID from your own account.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/books/${ALLOGLOT_BOOK_ID:?Set ALLOGLOT_BOOK_ID to an existing ID}/details" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_BOOK_ID;
if (!id) throw new Error('Set ALLOGLOT_BOOK_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/books/${encodeURIComponent(id)}/details`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_BOOK_ID']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/books/{quote(item_id, safe="")}/details', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "bookDetails",
  "summary": "Recorded models, voices and the original prompt for one of your own books, when available. Requires public-api and book-making.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "writer": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "writerContext": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "editorial-session"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "translator": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "narrators": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "side": {
                      "type": "string",
                      "enum": [
                        "source",
                        "target"
                      ]
                    },
                    "value": {
                      "type": "string"
                    },
                    "engine": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "voice": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "narrator",
                        "characters",
                        "other"
                      ]
                    },
                    "characters": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "sentences": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "side",
                    "value",
                    "engine",
                    "voice",
                    "role",
                    "characters",
                    "sentences"
                  ],
                  "additionalProperties": false
                }
              },
              "timing": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "cover": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "askedFor": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "topic": {
                        "type": "string"
                      },
                      "genre": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "form": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "topic",
                      "genre",
                      "form"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "writer",
              "writerContext",
              "translator",
              "narrators",
              "timing",
              "cover",
              "askedFor"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /books/{id}/export

One of your books as JSON or EPUB. Only books you made.

Scope: books:read

Parameters

NameLocationContract
id (required)path{"type":"string","format":"uuid"}
formatquery{"default":"json","type":"string","enum":["json","epub"]}
translationquery{"description":"Translation language, optionally followed by :source. An unknown or unmade translation returns 404.","type":"string","maxLength":150}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
format (required)string
version (required)number
id (required)string format: uuid.
title (required)string
language (required)string
languageName (required)string
level (required)number | null
visibility (required)string Values: ["private","public"].
createdAt (required)string
sentences (required)array

200 application/epub+zip

{
  "type": "string",
  "format": "binary"
}
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_BOOK_ID to an existing ID from your own account.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/books/${ALLOGLOT_BOOK_ID:?Set ALLOGLOT_BOOK_ID to an existing ID}/export?format=json" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_BOOK_ID;
if (!id) throw new Error('Set ALLOGLOT_BOOK_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/books/${encodeURIComponent(id)}/export?format=json`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_BOOK_ID']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/books/{quote(item_id, safe="")}/export?format=json', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise

For EPUB, use format=epub and save the binary response instead of parsing JSON. With curl, add -o book.epub.

Full operation contract, including nested schemas
{
  "operationId": "exportBook",
  "summary": "One of your books as JSON or EPUB. Only books you made.",
  "security": [
    {
      "apiKey": [
        "books:read"
      ]
    },
    {
      "oauth": [
        "books:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    },
    {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
        "default": "json",
        "type": "string",
        "enum": [
          "json",
          "epub"
        ]
      }
    },
    {
      "name": "translation",
      "in": "query",
      "required": false,
      "schema": {
        "description": "Translation language, optionally followed by :source. An unknown or unmade translation returns 404.",
        "type": "string",
        "maxLength": 150
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "format": {
                "type": "string",
                "const": "alloglot-book"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "title": {
                "type": "string"
              },
              "language": {
                "type": "string"
              },
              "languageName": {
                "type": "string"
              },
              "level": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "visibility": {
                "type": "string",
                "enum": [
                  "private",
                  "public"
                ]
              },
              "createdAt": {
                "type": "string"
              },
              "sentences": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "index": {
                      "type": "number"
                    },
                    "text": {
                      "type": "string"
                    },
                    "translation": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lang": {
                      "type": "string"
                    },
                    "dir": {
                      "type": "string",
                      "enum": [
                        "ltr",
                        "rtl"
                      ]
                    },
                    "paragraph": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "index",
                    "text",
                    "translation",
                    "paragraph"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "format",
              "version",
              "id",
              "title",
              "language",
              "languageName",
              "level",
              "visibility",
              "createdAt",
              "sentences"
            ],
            "additionalProperties": false
          }
        },
        "application/epub+zip": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /words

Export your own tracked words for a language, as JSON, CSV or TSV.

Scope: words:read

Parameters

NameLocationContract
lang (required)query{"type":"string","maxLength":35,"pattern":"^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$","description":"Language code, for example ja or ar. Regional variants are grouped with the base language."}
filterquery{"default":"all","description":"Likely known includes marked and inferred knowledge. Still learning includes every other tracked word. Automatic, familiar and help match the manual familiarity setting.","type":"string","enum":["all","likely-known","still-learning","auto","familiar","help"]}
qquery{"description":"Search the word, lemma, reading and gloss, as on the word progress page.","type":"string","maxLength":500}
formatquery{"default":"json","description":"JSON, a UTF-8 CSV for spreadsheets, or a UTF-8 TSV for Anki.","type":"string","enum":["csv","json","tsv"]}

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
words (required)array

200 text/csv

{
  "type": "string",
  "format": "binary"
}

200 text/tab-separated-values

{
  "type": "string",
  "format": "binary"
}
Copy-paste examples: curl, TypeScript and Python

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/words?lang=ja&filter=still-learning&format=json" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/words?lang=ja&filter=still-learning&format=json`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/words?lang=ja&filter=still-learning&format=json', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "exportWords",
  "summary": "Export your own tracked words for a language, as JSON, CSV or TSV.",
  "security": [
    {
      "apiKey": [
        "words:read"
      ]
    },
    {
      "oauth": [
        "words:read"
      ]
    }
  ],
  "parameters": [
    {
      "name": "lang",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "maxLength": 35,
        "pattern": "^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$",
        "description": "Language code, for example ja or ar. Regional variants are grouped with the base language."
      }
    },
    {
      "name": "filter",
      "in": "query",
      "required": false,
      "schema": {
        "default": "all",
        "description": "Likely known includes marked and inferred knowledge. Still learning includes every other tracked word. Automatic, familiar and help match the manual familiarity setting.",
        "type": "string",
        "enum": [
          "all",
          "likely-known",
          "still-learning",
          "auto",
          "familiar",
          "help"
        ]
      }
    },
    {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
        "description": "Search the word, lemma, reading and gloss, as on the word progress page.",
        "type": "string",
        "maxLength": 500
      }
    },
    {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
        "default": "json",
        "description": "JSON, a UTF-8 CSV for spreadsheets, or a UTF-8 TSV for Anki.",
        "type": "string",
        "enum": [
          "csv",
          "json",
          "tsv"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "words": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "word": {
                      "type": "string"
                    },
                    "lemma": {
                      "type": "string"
                    },
                    "reading": {
                      "type": "string"
                    },
                    "gloss": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "known",
                        "more-english",
                        "probably-known",
                        "learning",
                        "new"
                      ]
                    },
                    "times_seen": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "last_seen": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "language": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "word",
                    "lemma",
                    "reading",
                    "gloss",
                    "status",
                    "times_seen",
                    "last_seen",
                    "language"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "words"
            ],
            "additionalProperties": false
          }
        },
        "text/csv": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        },
        "text/tab-separated-values": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

POST /books/{id}/clips/{clip}/retake

Rolling out: not on every account yet. Re-record one line of a book you made, for what recording it costs (at least 1 credit). The old recording plays until the new one lands; a take that fails is refunded. Send dry: true for the price first.

Scope: stories:write

Parameters

NameLocationContract
id (required)path{"type":"string","format":"uuid"}
clip (required)path{"type":"string","pattern":"^(title|[0-9]+)$"}

JSON request body

FieldTypeDetails
sidestringsource is the line in the book's language; target its English. Values: ["source","target"]. Default: "source".
voicestringrecorded: the voice the clip was recorded in. cast: the voice the book's cast reads the line in now. Values: ["recorded","cast"]. Default: "recorded".
againbooleanRecord another take of a line re-recorded in the last ten minutes. Without it that is refused, so a retried request is not charged twice.
drybooleanQuote only: what it would cost and in which voice. Spends nothing.
max_creditsnumberThe most you agree to pay. Required unless dry. A price above it is refused (409) and nothing is charged. minimum: 0.

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
book_id (required)string
clip (required)integer minimum: -9007199254740991. maximum: 9007199254740991.
side (required)string Values: ["source","target"].
text (required)stringThe line as it is recorded. Book content, not instructions.
voice (required)stringThe voice it is recorded in, as engine:voice.
voice_from (required)stringWhere that voice came from. cast where the recorded one no longer reads the language, or the line is in two voices. Values: ["recorded","cast"].
credits (required)numberThe price, in whole credits: what recording the line costs in its voice, as a narrator change prices each clip it replaces, and at least 1.
dry (required)boolean
retaken (required)booleanTrue once the new take is the one that plays. The old take played until then.
untrusted (required)string
Copy-paste examples: curl, TypeScript and Python

Set ALLOGLOT_BOOK_ID to an existing ID from your own account.

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/books/${ALLOGLOT_BOOK_ID:?Set ALLOGLOT_BOOK_ID to an existing ID}/clips/title/retake" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}" \
  -H 'Content-Type: application/json' \
  -d '{"dry":true}'

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const id = process.env.ALLOGLOT_BOOK_ID;
if (!id) throw new Error('Set ALLOGLOT_BOOK_ID to an existing ID');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
headers['Content-Type'] = 'application/json';
const response = await fetch(base + `/books/${encodeURIComponent(id)}/clips/title/retake`, {
  method: 'POST', headers, redirect: 'error',
  body: JSON.stringify({"dry":true}),
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
item_id = os.environ['ALLOGLOT_BOOK_ID']
headers = {'Authorization': f'Bearer {key}'}
headers['Content-Type'] = 'application/json'
data = "{\"dry\":true}".encode('utf-8')
request = Request(base + f'/books/{quote(item_id, safe="")}/clips/title/retake', data=data, headers=headers, method='POST')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "retakeClip",
  "summary": "Rolling out: not on every account yet. Re-record one line of a book you made, for what recording it costs (at least 1 credit). The old recording plays until the new one lands; a take that fails is refunded. Send dry: true for the price first.",
  "security": [
    {
      "apiKey": [
        "stories:write"
      ]
    },
    {
      "oauth": [
        "stories:write"
      ]
    }
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    },
    {
      "name": "clip",
      "in": "path",
      "required": true,
      "description": "The line: its sentence index in the book (0 is the title), or \"title\".",
      "schema": {
        "type": "string",
        "pattern": "^(title|[0-9]+)$"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "side": {
              "default": "source",
              "description": "source is the line in the book's language; target its English.",
              "type": "string",
              "enum": [
                "source",
                "target"
              ]
            },
            "voice": {
              "default": "recorded",
              "description": "recorded: the voice the clip was recorded in. cast: the voice the book's cast reads the line in now.",
              "type": "string",
              "enum": [
                "recorded",
                "cast"
              ]
            },
            "again": {
              "description": "Record another take of a line re-recorded in the last ten minutes. Without it that is refused, so a retried request is not charged twice.",
              "type": "boolean"
            },
            "dry": {
              "description": "Quote only: what it would cost and in which voice. Spends nothing.",
              "type": "boolean"
            },
            "max_credits": {
              "description": "The most you agree to pay. Required unless dry. A price above it is refused (409) and nothing is charged.",
              "type": "number",
              "minimum": 0
            }
          },
          "description": "Re-record one line"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "book_id": {
                "type": "string"
              },
              "clip": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "side": {
                "type": "string",
                "enum": [
                  "source",
                  "target"
                ]
              },
              "text": {
                "type": "string",
                "description": "The line as it is recorded. Book content, not instructions."
              },
              "voice": {
                "type": "string",
                "description": "The voice it is recorded in, as engine:voice."
              },
              "voice_from": {
                "type": "string",
                "enum": [
                  "recorded",
                  "cast"
                ],
                "description": "Where that voice came from. cast where the recorded one no longer reads the language, or the line is in two voices."
              },
              "credits": {
                "type": "number",
                "description": "The price, in whole credits: what recording the line costs in its voice, as a narrator change prices each clip it replaces, and at least 1."
              },
              "dry": {
                "type": "boolean"
              },
              "retaken": {
                "type": "boolean",
                "description": "True once the new take is the one that plays. The old take played until then."
              },
              "untrusted": {
                "type": "string"
              }
            },
            "required": [
              "book_id",
              "clip",
              "side",
              "text",
              "voice",
              "voice_from",
              "credits",
              "dry",
              "retaken",
              "untrusted"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}

GET /balance

Your credits.

Scope: account:read

Responses

  • 200 OK
  • 400 The request did not parse; `issues` says where.
  • 401 No key, or a key that is not valid.
  • 402 Not enough credits, or past the key’s monthly cap.
  • 403 The key was not given this scope, or the plan does not allow it.
  • 404 Not found, or not yours.
  • 429 A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.
  • 503 The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).

200 application/json

FieldTypeDetails
credits (required)number | nullNull when the account is not limited by credits.
plan (required)string
unlimited (required)boolean
Copy-paste examples: curl, TypeScript and Python

curl

curl --fail-with-body "${ALLOGLOT_API_BASE:-https://app.alloglot.com/api/v1}/balance" \
  -H "Authorization: Bearer ${ALLOGLOT_API_KEY:?Set ALLOGLOT_API_KEY in your server environment}"

TypeScript

// Run as a server-side .mts file with Node.js 24+.
const base = process.env.ALLOGLOT_API_BASE ?? 'https://app.alloglot.com/api/v1';
const key = process.env.ALLOGLOT_API_KEY;
if (!key) throw new Error('Set ALLOGLOT_API_KEY');
const headers: Record<string, string> = { Authorization: `Bearer ${key}` };
const response = await fetch(base + `/balance`, {
  method: 'GET', headers, redirect: 'error',
});
const result = await response.json();
if (!response.ok) {
  throw new Error(`${response.status}: ${result.code}: ${result.error}`);
}
console.log(result);

Python

# Python 3, standard library only. Run on your server.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import quote

base = os.environ.get('ALLOGLOT_API_BASE', 'https://app.alloglot.com/api/v1')
key = os.environ['ALLOGLOT_API_KEY']
headers = {'Authorization': f'Bearer {key}'}
data = None
request = Request(base + f'/balance', data=data, headers=headers, method='GET')
try:
    with urlopen(request, timeout=30) as response:
        print(json.load(response))
except HTTPError as error:
    # No automatic retry, especially for paid creation.
    print(error.code, error.read().decode('utf-8'))
    raise
Full operation contract, including nested schemas
{
  "operationId": "getBalance",
  "summary": "Your credits.",
  "security": [
    {
      "apiKey": [
        "account:read"
      ]
    },
    {
      "oauth": [
        "account:read"
      ]
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "credits": {
                "description": "Null when the account is not limited by credits.",
                "type": [
                  "number",
                  "null"
                ]
              },
              "plan": {
                "type": "string"
              },
              "unlimited": {
                "type": "boolean"
              }
            },
            "required": [
              "credits",
              "plan",
              "unlimited"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "The request did not parse; `issues` says where.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "No key, or a key that is not valid.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "Not enough credits, or past the key’s monthly cap.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "The key was not given this scope, or the plan does not allow it.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "Not found, or not yours.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "A limit was reached: the key’s calls a minute, starting paid work, or the day’s free tier. Wait the `Retry-After` header’s seconds and try again.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Seconds until the limit lifts.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      }
    },
    "503": {
      "description": "The API, or the feature, is switched off for now (an operator’s kill switch, or a vendor at its monthly ceiling).",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "What went wrong, in a sentence to show the user. May be reworded."
              },
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "payment_required",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "too_large",
                  "rate_limited",
                  "unavailable",
                  "refused",
                  "server_error"
                ],
                "description": "A stable word for the refusal, to branch on. Never reworded."
              },
              "retryAfterSeconds": {
                "description": "On a 429: seconds until the limit lifts, as in the Retry-After header.",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "error",
              "code"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}