Novo Translator Open API

中文文档

Novel translation API v1

Upload a manuscript, get a binding credit quote, translate it with a glossary and a style guide, and download the result. Everything is asynchronous and billed in credits. This page is the single reference for API v1; pilot users: see the migration section.

Base URL
https://xsfyj.com/api/b2b/v1
Developer console
/dashboard/developer

Quick start

  1. Sign in, make sure your credit balance is above zero, and create an API key in the developer console (Dashboard > Developer API).
  2. POST /sources: upload the manuscript (.txt, .epub, .docx). Wait until the source status is ready (use ?wait=30 or poll GET /sources/{id}).
  3. POST /quotes: get a free, binding quote valid for 30 minutes. Pass the quote_id to the next call to lock the price.
  4. POST /jobs: create the translation job. Credits are held immediately.
  5. Track the job with GET /jobs/{id} (honour poll_after_seconds) or receive job.* webhooks.
  6. GET /jobs/{id}/files/{file_id}: download the result once the job has succeeded.

The same flow with cURL (replace NOVO_API_KEY with your key, run it on your server):

export NOVO_API_KEY="<your key>"
BASE="https://xsfyj.com/api/b2b/v1"

# 1. Upload the manuscript (waits up to 30 s for analysis)
curl -X POST "$BASE/sources?wait=30" \
  -H "Authorization: Bearer $NOVO_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "[email protected]"
# -> {"id":"src_...","status":"ready","characters":120345,...}

# 2. Quote (free, valid 30 minutes)
curl -X POST "$BASE/quotes" \
  -H "Authorization: Bearer $NOVO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"source_id":"src_...","target_language":"en"}'
# -> {"id":"qte_...","total_credits":120345,...}

# 3. Create the translation job (credits are held)
curl -X POST "$BASE/jobs" \
  -H "Authorization: Bearer $NOVO_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"type":"translation","source_id":"src_...","target_language":"en","quote_id":"qte_...","glossary":{"mode":"auto"}}'
# -> 202 {"id":"job_...","status":"queued","poll_after_seconds":5,...}

# 4. Poll (or use webhooks)
curl "$BASE/jobs/job_..." -H "Authorization: Bearer $NOVO_API_KEY"

# 5. Download the result
curl -L "$BASE/jobs/job_.../files/file_..." -H "Authorization: Bearer $NOVO_API_KEY" -o translated.txt

Base URL

  • Use the Base URL shown above. Production endpoints: https://open.novotranslator.com/v1 (international) and https://open.xsfyj.com/v1 (China).
  • The path alias /api/b2b/v1 on the main site serves the same API and is kept for compatibility.
  • All requests and responses are JSON (UTF-8) except file uploads (multipart/form-data) and downloads. Timestamps are RFC 3339 in UTC.

Authentication and API keys

  • Send the key as a Bearer token: Authorization: Bearer <key>.
  • Call the API from your server only. Never embed a key in a browser, mobile app or public repository; requests carrying a browser Origin header are rejected (BROWSER_ORIGIN_FORBIDDEN).
  • A key is shown once when it is created. Only a hash is stored, so a lost key cannot be recovered: create a new one.
  • Keys carry scopes (sources:write, jobs:write, jobs:read, glossaries:write, series:write, webhooks:write, account:read), an optional IP allow-list, an optional monthly spend limit and an optional expiry.
  • Creating a key requires a verified email and a credit balance above zero. At most 10 active keys per account.
  • Rotate a key in the console: the new key works at once and the old key keeps working for 24 hours.

Billing in credits

Prices are quoted in credits; see POST /quotes for the exact figure before you spend anything.

ItemRule
Translation1 credit per character of the selected scope (the whole file, or start_percent to end_percent).
Style guide+30% of the full text length unless your plan includes it (Plus). Up to 500 characters of guidance.
Glossary extraction0.5 credit per character of the source.
Worldview0.1 credit per character of the source.
PreviewFree: 10 per day (UTC) per account, at most 10,000 characters each.
  • Credits are held when the job is created, consumed when it succeeds, and released in full when it fails or is cancelled.
  • If the balance is too short you get INSUFFICIENT_CREDITS with meta.top_up_url.

Glossary modes

The glossary object of a job selects how your terms interact with automatic extraction.

ModeBehaviour
autoNo glossary supplied: the system extracts terms itself.
mergeYour terms are applied and the system adds terms it finds; your terms win on conflicts.
strictOnly your terms are used; nothing is added automatically.

Series workflow

  1. POST /series: create a series (shared worldview and a cumulative glossary).
  2. POST /series/{id}/volumes: add each volume (an analysed source).
  3. POST /series/{id}/bootstrap: run worldview and glossary on the anchor volume.
  4. POST /series/{id}/volumes/{volume_id}/glossary: extract incremental terms for each next volume; they merge into the series glossary.
  5. POST /series/{id}/volumes/{volume_id}/translate: translate a volume with the series worldview and the frozen glossary version.

Idempotency

  • Every write (POST, PATCH) requires an Idempotency-Key header: 1-200 visible characters without whitespace, for example a UUID.
  • A repeated request with the same key and body within 24 hours replays the original response and creates nothing new.
  • The same key with a different body returns 409 IDEMPOTENCY_KEY_MISMATCH. A concurrent duplicate returns 409 IDEMPOTENCY_IN_PROGRESS; retry shortly.

Async jobs and cold start

  • Jobs are asynchronous. A job may stay queued for tens of seconds up to several minutes while workers wake up (cold start).
  • Poll GET /jobs/{id} no faster than the poll_after_seconds value in the response, or use webhooks instead of polling.
  • Statuses: queued, running, succeeded, failed, cancelled. Only queued jobs can be cancelled.

Examples

Copy-paste walkthroughs for every job type. Replace $KEY with your API key; responses are real codexdev outputs, trimmed.

Upload and pre-analyze a source

Every job starts from a source. Uploading is free: the server counts characters, detects the source language and checks input quality, then keeps the staged file for 7 days so you can quote and run several jobs on it without uploading again.

1. Upload a file and wait up to 30 seconds

Supported formats: .txt, .epub, .docx (≤ 50 MiB). `?wait=30` holds the request until analysis finishes (201) or the wait expires (202, status `analyzing`). `target_language` is optional and does not affect the analysis.

curl -X POST "https://xsfyj.com/api/b2b/v1/sources?wait=30" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "[email protected]" \
  -F "target_language=en"
{
  "id": "src_0mvri8g568XfrxRhqf6Az4C",
  "object": "source",
  "status": "ready",
  "filename": "novel.epub",
  "format": "epub",
  "size_bytes": 2794,
  "sha256": "74ce50caa62b3d258611dbd62d5a71ac6ad3044528b5ea97e3b2b829817bd1fd",
  "characters": 328,
  "words": null,
  "detected_language": { "code": "zh-CN", "confidence": 0.8333, "low_confidence": false },
  "input_quality": null,
  "error": null,
  "expires_at": "2026-11-04T02:37:55Z",
  "created_at": "2026-10-28T02:37:56Z"
}

2. Or send plain text as JSON

Without `wait` the call returns 202 immediately while the source is `analyzing`. `filename` is optional; `.txt` is appended when missing. Text sources are limited to 2,000,000 characters.

curl -X POST "https://xsfyj.com/api/b2b/v1/sources" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"text": "第一章 雾港\n\n雾港的钟声在黄昏时响了七下……", "filename": "chapter-01.txt"}'
{
  "id": "src_0mvri8s1fNYJdJ4MDpr8QxB",
  "object": "source",
  "status": "analyzing",
  "filename": "chapter-01.txt",
  "format": "txt",
  "size_bytes": 974,
  "sha256": null,
  "characters": null,
  "words": null,
  "detected_language": null,
  "input_quality": null,
  "error": null,
  "expires_at": null,
  "created_at": "2026-10-28T02:38:11Z"
}

3. Poll the source until it is ready

GET also accepts `?wait=` (max 30 s). Final states are `ready` or `failed` (see `error.code`, e.g. NO_TRANSLATABLE_CONTENT). `words` is only filled for space-delimited languages — an English source returns e.g. `"words": 41`.

curl "https://xsfyj.com/api/b2b/v1/sources/src_0mvri8s1fNYJdJ4MDpr8QxB?wait=20" \
  -H "Authorization: Bearer $KEY"
{
  "id": "src_0mvri8s1fNYJdJ4MDpr8QxB",
  "object": "source",
  "status": "ready",
  "filename": "chapter-01.txt",
  "format": "txt",
  "size_bytes": 974,
  "sha256": "9aeb9b5e0433de21778daf2b3bdae694cdf0c0fc320733b085b7ac0a6208b66d",
  "characters": 321,
  "words": null,
  "detected_language": { "code": "zh-CN", "confidence": 0.8333, "low_confidence": false },
  "input_quality": null,
  "error": null,
  "expires_at": "2026-11-04T02:38:11Z",
  "created_at": "2026-10-28T02:38:11Z"
}
  • Reuse the same source_id for quotes and jobs until expires_at (7 days); upload again only after it expires (SOURCE_EXPIRED).
  • `characters` is the authoritative count used for billing — quote and charge are computed from it, not from your local count.
  • Creating a job on an `analyzing` source returns SOURCE_NOT_READY with Retry-After: 2.

Quote several jobs at once

A quote prices up to 4 jobs on one source and shows your balance. It reserves nothing and is valid for 30 minutes. Rules: translation = 1 credit per character of the selected scope; a custom style guide adds 30% of the full text (waived on Plus); glossary = 0.5 credit/char; worldview = 0.1 credit/char; preview_translation is free (10 per day, ≤ 10,000 characters).

1. Quote glossary + translation (first half, with style guide) + worldview

Top-level `options` / `glossary` apply to every job; per-job values override them. Here the translation covers 0–50% (164 of 328 chars) but the style-guide surcharge is computed on the full text: ceil(328 × 0.3) = 99.

curl -X POST "https://xsfyj.com/api/b2b/v1/quotes" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "source_id": "src_0mvri8g568XfrxRhqf6Az4C",
    "source_language": "zh",
    "target_language": "en",
    "jobs": [
      { "type": "glossary" },
      { "type": "translation", "options": {
          "style_guide": "Keep a restrained literary tone; romanize names in pinyin.",
          "scope": { "start_percent": 0, "end_percent": 50 } } },
      { "type": "worldview" }
    ]
  }'
{
  "id": "quo_0mvri9ezlgx1T4CTCRglnh1",
  "object": "quote",
  "source_id": "src_0mvri8g568XfrxRhqf6Az4C",
  "target_language": "en",
  "items": [
    { "type": "glossary", "characters": 328, "credits": 164,
      "breakdown": { "base_credits": 164, "style_guide_credits": 0, "style_guide_waived": false, "scope": null } },
    { "type": "translation", "characters": 164, "credits": 263,
      "breakdown": { "base_credits": 164, "style_guide_credits": 99, "style_guide_waived": false,
                     "scope": { "start": 0, "end_exclusive": 164 } } },
    { "type": "worldview", "characters": 328, "credits": 33,
      "breakdown": { "base_credits": 33, "style_guide_credits": 0, "style_guide_waived": false, "scope": null } }
  ],
  "total_credits": 460,
  "balance": 199521,
  "sufficient": true,
  "warnings": [],
  "expires_at": "2026-10-28T03:08:41Z",
  "created_at": "2026-10-28T02:38:41Z"
}

2. Lock the price with quote_id

Pass `quote_id` when creating a job. If the job's price differs from the matching quote item (different options, expired quote, other source), the job is rejected instead of charging an unexpected amount — here the style guide was dropped:

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"type": "translation", "source_id": "src_0mvri8g568XfrxRhqf6Az4C", "source_language": "zh",
       "target_language": "en", "quote_id": "quo_0mvri9ezlgx1T4CTCRglnh1",
       "options": {"scope": {"start_percent": 0, "end_percent": 50}}}'
HTTP/1.1 409 Conflict
Content-Type: application/problem+json

{
  "type": "…/api-docs#error-QUOTE_EXPIRED_OR_CHANGED",
  "title": "Quote expired or changed",
  "status": 409,
  "code": "QUOTE_EXPIRED_OR_CHANGED",
  "detail": "The price changed since the quote; create a new quote.",
  "param": "quote_id",
  "request_id": "req_0mvribqvn2vUvxz5TCEPeuo",
  "doc_url": "…/api-docs#error-QUOTE_EXPIRED_OR_CHANGED",
  "meta": { "quoted_credits": 263, "current_credits": 164 }
}
  • Quotes are free and need no Idempotency-Key; create a fresh one whenever options change.
  • Check `sufficient` before creating jobs — a job is charged (held) when it is created and settled when it finishes.
  • `warnings` contains SOURCE_LANGUAGE_MISMATCH when the declared source_language differs from detection (see below).

Language codes and source-language confirmation

Use BCP 47 codes from GET /languages. Common aliases are accepted: zh and zh-Hans → zh-CN, zh-Hant → zh-TW. source_language defaults to auto.

1. List supported languages

curl "https://xsfyj.com/api/b2b/v1/languages" -H "Authorization: Bearer $KEY"
{
  "object": "languages",
  "source": [
    { "code": "auto", "name": "Auto Detect", "native_name": "Auto" },
    { "code": "zh-CN", "name": "Chinese (Simplified)", "native_name": "简体中文" },
    { "code": "en", "name": "English", "native_name": "English" },
    { "code": "ja", "name": "Japanese", "native_name": "日本語" },
    "…"
  ],
  "target": ["…"],
  "aliases": { "zh": "zh-CN", "zh-Hans": "zh-CN", "zh-Hant": "zh-TW" }
}

2. Declared language differs from detection: 409

A quote only warns; creating the job stops with SOURCE_LANGUAGE_CONFIRMATION_REQUIRED and nothing is charged. Usually you should fix source_language (or send auto).

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"type": "preview_translation", "source_id": "src_0mvri8g568XfrxRhqf6Az4C",
       "source_language": "ja", "target_language": "en"}'
HTTP/1.1 409 Conflict
Content-Type: application/problem+json

{
  "type": "…/api-docs#error-SOURCE_LANGUAGE_CONFIRMATION_REQUIRED",
  "title": "Confirm source language",
  "status": 409,
  "code": "SOURCE_LANGUAGE_CONFIRMATION_REQUIRED",
  "detail": "Detected zh-CN, but source_language is ja.",
  "param": "confirm_source_language",
  "request_id": "req_0mvria99sQa1g5ucnRnScBq",
  "doc_url": "…/api-docs#error-SOURCE_LANGUAGE_CONFIRMATION_REQUIRED",
  "meta": { "selected_language": "ja", "detected_language": "zh-CN" }
}

3. Keep your choice: resend with confirm_source_language

Only when you are sure the detection is wrong (e.g. mixed-language text). Use a new Idempotency-Key, since the body changed.

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"type": "preview_translation", "source_id": "src_0mvri8g568XfrxRhqf6Az4C",
       "source_language": "ja", "target_language": "en", "confirm_source_language": true}'
{
  "id": "job_0mvriafihuLX6Rxnycbt5k4",
  "object": "job",
  "type": "preview_translation",
  "status": "queued",
  "source_language": "ja",
  "target_language": "en",
  "credits": 0,
  "billing_state": "none",
  "poll_after_seconds": 5,
  "…": "…"
}

Extract a worldview and reuse it

A worldview job reads the whole source and writes a translator's brief: genre, setting, register, narrator identity, key names and terminology guidance. It costs 0.1 credit per character of the full text. Inject the result into later translation jobs (other volumes, re-translations) to keep names and tone consistent without paying for extraction again.

1. Create the worldview job

`target_language` is the language the brief's references are written for. The response is 202 with status `queued`; credits are held now and consumed on success.

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "worldview",
    "source_id": "src_0mvri8g568XfrxRhqf6Az4C",
    "source_language": "zh",
    "target_language": "en",
    "quote_id": "quo_0mvri9ezlgx1T4CTCRglnh1"
  }'
{
  "id": "job_0mvriardeM8hGujFyWfbGY0",
  "object": "job",
  "type": "worldview",
  "status": "queued",
  "source_id": "src_0mvri8g568XfrxRhqf6Az4C",
  "series_id": null,
  "target_language": "en",
  "source_language": "zh-CN",
  "options": { "output_format": "translation_only", "translate_filename": false },
  "glossary": null,
  "credits": 33,
  "billing_state": "held",
  "progress": { "stage": null, "percent": 0, "waiting_reason": null },
  "result": null,
  "error": null,
  "poll_after_seconds": 5,
  "created_at": "2026-10-28T02:39:44Z",
  "completed_at": null
}

2. Poll the job

Status moves queued → running → succeeded (or failed / cancelled). Wait `poll_after_seconds` between polls; it becomes null in a final state. `progress.stage` is a stable machine value and `progress.percent` runs 0–100. A running job looks like this:

curl "https://xsfyj.com/api/b2b/v1/jobs/job_0mvriardeM8hGujFyWfbGY0" \
  -H "Authorization: Bearer $KEY"
{
  "id": "job_0mvriardeM8hGujFyWfbGY0",
  "object": "job",
  "type": "worldview",
  "status": "running",
  "credits": 33,
  "billing_state": "held",
  "progress": { "stage": "LANGUAGE_DETECT", "percent": 22, "waiting_reason": null },
  "result": null,
  "error": null,
  "poll_after_seconds": 10,
  "…": "…"
}

// succeeded
{
  "id": "job_0mvriardeM8hGujFyWfbGY0",
  "object": "job",
  "type": "worldview",
  "status": "succeeded",
  "credits": 33,
  "billing_state": "consumed",
  "progress": { "stage": "COMPLETE", "percent": 100, "waiting_reason": null },
  "result": { "worldview": "Source Title: 雾港\nKnown Target Title: Fog Port (uncertain; Low)\n…" },
  "error": null,
  "poll_after_seconds": null,
  "created_at": "2026-10-28T02:39:44Z",
  "completed_at": "2026-10-28T02:39:57Z"
}

3. Fetch the worldview

The brief is plain text — store it on your side, show it to an editor, or edit it before reuse. To get a translated book title as the output filename, set `options.translate_filename: true` on the translation job.

curl "https://xsfyj.com/api/b2b/v1/jobs/job_0mvriardeM8hGujFyWfbGY0/worldview" \
  -H "Authorization: Bearer $KEY"
{
  "job_id": "job_0mvriardeM8hGujFyWfbGY0",
  "object": "worldview_result",
  "worldview": "Source Title: 雾港\nKnown Target Title: Fog Port (uncertain; Low)\nNarrative Identity:\n- Default narrator: identity: impersonal, scope: whole_book\n…\nGenre: Fantasy / Adventure / Mystery\nEra/Setting: Ancient China-like\nRegister: period-flavored\nTone: melancholic, atmospheric, journey-focused\n…\nTranslation References:\n- 雾港 -> Fog Port (work_title; Medium; common web usage)\n  Alternatives: Mist Port, Mist Harbor\n- 北境 -> the North (core_concept; High; common web usage)\n…\nRisk Notes: The text is very short; …"
}

4. Reuse it in a translation job

Pass the text (≤ 20,000 characters) as `options.worldview`. The job uses your brief as translation context; the price stays 1 credit per character of the selected scope — here 0–50% of 328 characters = 164 credits.

WORLDVIEW=$(curl -s "https://xsfyj.com/api/b2b/v1/jobs/job_0mvriardeM8hGujFyWfbGY0/worldview" \
  -H "Authorization: Bearer $KEY" | jq -r .worldview)

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --arg wv "$WORLDVIEW" '{
    type: "translation",
    source_id: "src_0mvri8g568XfrxRhqf6Az4C",
    source_language: "zh",
    target_language: "en",
    options: { scope: { start_percent: 0, end_percent: 50 }, worldview: $wv }
  }')"
{
  "id": "job_0mvribx53EiHALikS1yvzb8",
  "object": "job",
  "type": "translation",
  "status": "queued",
  "source_id": "src_0mvri8g568XfrxRhqf6Az4C",
  "target_language": "en",
  "source_language": "zh-CN",
  "options": {
    "scope": { "end_percent": 50, "start_percent": 0 },
    "worldview": { "injected": true, "characters": 1834 },
    "output_format": "translation_only",
    "translate_filename": false
  },
  "glossary": null,
  "credits": 164,
  "billing_state": "held",
  "poll_after_seconds": 5,
  "…": "…"
}

// succeeded → result.files
"result": {
  "files": [
    { "kind": "translated", "file_id": "NVMVRIBXC64Y_output_cfd974b74bfb4448",
      "filename": "novel.range-0-50_translated.epub", "size_bytes": 3028 }
  ]
}
  • Extract once per book (or per series) and reuse: a worldview costs 0.1 credit/char, so a 300,000-character novel costs 30,000 credits.
  • Edit the brief freely before injecting it — fix a name in “Translation References” and every later job follows it. Pair it with a glossary for hard term locks.
  • Job responses only echo the length of an injected worldview ({ injected, characters }), never the text itself.
  • Series (/series) store and inject the worldview automatically across volumes; use options.worldview for one-off jobs.

Extract a glossary from a source

A glossary job reads the whole source and returns character names, places, sects, titles and techniques with a suggested translation, alternatives, category, gender and frequency. It costs 0.5 credit per source character (399 characters → 200 credits).

1. Create the glossary job

Credits are held at creation (`billing_state: held`), consumed on success and released if the job fails or is cancelled.

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"type": "glossary", "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B", "target_language": "en"}'
{
  "id": "job_0mvri97fqVgsuxDwMqNrsCz",
  "object": "job",
  "type": "glossary",
  "status": "queued",
  "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
  "credits": 200,
  "billing_state": "held",
  "progress": { "stage": null, "percent": 0, "waiting_reason": null },
  "poll_after_seconds": 5,
  "created_at": "2026-10-28T02:38:31Z"
}

2. Poll until it succeeds, then read the terms

Poll `GET /jobs/{id}` at the `poll_after_seconds` interval (this sample finished in under a minute). `/glossary` returns terms in the public format; every extracted term is `authority: suggested` until you lock it in a glossary resource.

curl "https://xsfyj.com/api/b2b/v1/jobs/job_0mvri97fqVgsuxDwMqNrsCz/glossary" \
  -H "Authorization: Bearer $KEY"
{
  "job_id": "job_0mvri97fqVgsuxDwMqNrsCz",
  "object": "glossary_result",
  "term_count": 15,
  "terms": [
    { "source": "苏清寒", "target": "Su Qinghan", "category": "person_name", "gender": "female",
      "note": "Senior disciple of the sect leader…", "count": 4, "authority": "suggested" },
    { "source": "凌霄城", "target": "Lingxiao City", "category": "proper_noun", "gender": null,
      "note": "The city where Lin Yi grew up…", "alternatives": ["Sky-Soaring City"], "count": 3, "authority": "suggested" },
    { "source": "藏经阁", "target": "Scripture Pavilion", "category": "cultural_concept", "gender": null,
      "note": "The sect's repository of scriptures…", "alternatives": ["Sutra Pavilion", "Library Pavilion"], "count": 2, "authority": "suggested" },
    { "source": "血煞门", "target": "Blood Fiend Sect", "category": "proper_noun", "gender": null,
      "note": "A demonic sect recently active near Lingxiao City…", "alternatives": ["Blood Fiend Gate"], "count": 2, "authority": "suggested" },
    "…"
  ]
}
  • Review the extracted terms before translating: you can fix them in a glossary resource (next example) and pass it to the translation job.
  • The glossary job always reads the full source; `options.scope` only applies to translation jobs.

Versioned glossary resources

A glossary resource (`gls_…`) stores your approved terms. Every edit creates a new immutable version, and a translation job pins the exact version it used, so re-running a job is reproducible. Create one from a glossary job, from a CSV file, or from inline `terms`.

1. Create a glossary from a glossary job

Terms copied from the job become `authority: locked` (user-approved). The version-specific `origin` records where the version came from.

curl -X POST "https://xsfyj.com/api/b2b/v1/glossaries" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name": "Qingyun Saga", "from_job_id": "job_0mvri97fqVgsuxDwMqNrsCz"}'
{
  "id": "gls_0mvriazvx5MpABdP6aMqf95",
  "object": "glossary",
  "name": "Qingyun Saga",
  "version": 1,
  "current_version": 1,
  "term_count": 15,
  "terms": [
    { "source": "林逸", "target": "Lin Yi", "category": "person_name", "gender": null, "note": "Protagonist of the story…", "count": 4, "authority": "locked" },
    "…"
  ],
  "origin": { "kind": "job", "job_id": "job_0mvri97fqVgsuxDwMqNrsCz" },
  "created_at": "2026-10-28T02:39:55Z",
  "version_created_at": "2026-10-28T02:39:55Z"
}

2. Edit terms with optimistic locking

`upsert` replaces a term with the same `source` (or adds it); `remove` deletes by `source`. Send the version you edited in `If-Match`; the response carries the new version in the body and in `ETag`.

curl -X PATCH "https://xsfyj.com/api/b2b/v1/glossaries/gls_0mvriazvx5MpABdP6aMqf95" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H 'If-Match: "1"' \
  -H "Content-Type: application/json" \
  -d '{
    "upsert": [
      {"source": "林逸", "target": "Lin Yi", "category": "person_name", "gender": "male", "note": "Protagonist"},
      {"source": "青云宗", "target": "Azure Cloud Sect", "category": "proper_noun"}
    ],
    "remove": ["第一章 青云入门", "长老"]
  }'
HTTP/1.1 200 OK
ETag: "2"

{
  "id": "gls_0mvriazvx5MpABdP6aMqf95",
  "object": "glossary",
  "version": 2,
  "current_version": 2,
  "term_count": 13,
  "terms": [
    { "authority": "locked", "source": "林逸", "target": "Lin Yi", "category": "person_name", "gender": "male", "note": "Protagonist" },
    "…"
  ],
  "origin": { "kind": "patch" },
  "version_created_at": "2026-10-28T02:40:09Z"
}

3. Stale version → 409 VERSION_CONFLICT

If someone else saved a newer version, re-read the glossary (`GET /glossaries/{id}`), re-apply your change and retry with the current version.

curl -X PATCH "https://xsfyj.com/api/b2b/v1/glossaries/gls_0mvriazvx5MpABdP6aMqf95" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H 'If-Match: "1"' \
  -H "Content-Type: application/json" \
  -d '{"remove": ["魔道"]}'
{
  "type": "https://novotranslator.com/api-docs#error-VERSION_CONFLICT",
  "title": "Version conflict",
  "status": 409,
  "code": "VERSION_CONFLICT",
  "detail": "Glossary gls_0mvriazvx5MpABdP6aMqf95 changed; current version is 2.",
  "param": null,
  "request_id": "req_0mvribltqYesRZapdb2q2Yz",
  "meta": { "current_version": 2 }
}

4. Export as CSV

Returns JSON with the CSV text in `csv` (same columns as the web glossary workbench). Add `version=1` to export an older version. Save it with `jq -r .csv > terms.csv`.

curl "https://xsfyj.com/api/b2b/v1/glossaries/gls_0mvriazvx5MpABdP6aMqf95/export?format=csv" \
  -H "Authorization: Bearer $KEY" | jq -r .csv > terms.csv
{
  "object": "glossary_export",
  "format": "csv",
  "version": 2,
  "csv": "term,translation,category,gender,note,authority\n林逸,Lin Yi,person_name,male,Protagonist,locked\n苏清寒,Su Qinghan,person_name,female,Senior disciple of the sect leader…,locked\n…"
}

5. Import a CSV file

multipart/form-data with `file` and `name`. Required columns: `term`, `translation`; optional `category`, `note`. Imported terms are `locked`.

# terms.csv
# term,translation,category,note
# 林逸,Lin Yi,person_name,Protagonist
# 苏清寒,Su Qinghan,person_name,"Senior sister, cold tone"
# 青云宗,Azure Cloud Sect,proper_noun,
# 血煞门,Blood Fiend Sect,proper_noun,Demonic sect
# 太玄剑诀,Taixuan Sword Art,work_title,

curl -X POST "https://xsfyj.com/api/b2b/v1/glossaries" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "[email protected];type=text/csv" \
  -F "name=Publisher glossary"
{
  "id": "gls_0mvric0k0kq6EjO0gxRkPrD",
  "object": "glossary",
  "name": "Publisher glossary",
  "version": 1,
  "current_version": 1,
  "term_count": 5,
  "terms": [
    { "source": "林逸", "target": "Lin Yi", "category": "person_name", "note": "Protagonist", "authority": "locked" },
    { "source": "苏清寒", "target": "Su Qinghan", "category": "person_name", "note": "Senior sister, cold tone", "authority": "locked" },
    { "source": "青云宗", "target": "Azure Cloud Sect", "category": "proper_noun", "authority": "locked" },
    "…"
  ],
  "origin": { "kind": "csv", "filename": "terms.csv" },
  "version_created_at": "2026-10-28T02:40:42Z"
}
  • Fetch any older version with `GET /glossaries/{id}?version=1`; the `ETag` header always carries the returned version.
  • Duplicate `source` entries are collapsed: the last one wins. A glossary holds up to 5,000 terms.
  • Creating and editing glossaries is free; you only pay for the jobs that use them.

Glossary modes in a translation job

`glossary.mode` controls how a translation job uses terminology. `auto` (default, omit `glossary`): the pipeline maintains consistency by itself. `merge`: your terms win, and the pipeline still extracts and adds new terms. `strict`: only your terms are used, no automatic extraction — for authoritative publisher glossaries. Terms come from inline `glossary.terms`, a `glossary.glossary_id` (+ optional `version`, default current), or both. The mode does not change the price.

1. merge with inline terms

The translation used "Azure Cloud Sect" and "Crimson Blood Gate" from the request, and still kept auto-extracted names such as "Lingxiao City".

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "translation",
    "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
    "target_language": "en",
    "glossary": {
      "mode": "merge",
      "terms": [
        {"source": "林逸", "target": "Lin Yi", "category": "person_name", "gender": "male"},
        {"source": "青云宗", "target": "Azure Cloud Sect", "category": "proper_noun"},
        {"source": "血煞门", "target": "Crimson Blood Gate", "category": "proper_noun"}
      ]
    }
  }'
{
  "id": "job_0mvridrx9xs6YwBNBlcszRV",
  "object": "job",
  "type": "translation",
  "status": "queued",
  "credits": 399,
  "billing_state": "held",
  "…": "…"
}

2. strict with a pinned glossary version

The job records the glossary id and version it used in `glossary`. The output followed the imported glossary exactly ("Blood Fiend Sect", "Taixuan Sword Art").

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "translation",
    "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
    "target_language": "en",
    "glossary": {"mode": "strict", "glossary_id": "gls_0mvric0k0kq6EjO0gxRkPrD", "version": 1}
  }'
{
  "id": "job_0mvridxsxosPwA5dYyihn2U",
  "object": "job",
  "type": "translation",
  "status": "queued",
  "glossary": { "mode": "strict", "glossary_id": "gls_0mvric0k0kq6EjO0gxRkPrD", "version": 1, "inline_terms": 0 },
  "credits": 399,
  "billing_state": "held",
  "…": "…"
}
  • Typical workflow: glossary job → review → save as glossary resource → translate with `merge` (or `strict` for a finalized publisher glossary).
  • You can pass `glossary_id` and inline `terms` together: the inline terms are added on top of that glossary version (keep `source` values unique across both). Inline terms are capped at 5,000.
  • `merge`/`strict` without any terms returns 422 `GLOSSARY_INVALID`. Quotes are free: send the same `glossary` object to `POST /quotes` to validate it first.

Translate a source with options

A translation job costs 1 credit per character in the selected scope. A custom `style_guide` (≤ 500 characters) adds 30% of the full source's character count, waived for Plus members. Quote first (free, valid 30 minutes), then create the job with the same parameters plus `quote_id`: the server re-prices and rejects the job with `QUOTE_EXPIRED_OR_CHANGED` if the price moved.

1. Quote the job

Translating the first half (200 of 399 characters) costs 200 credits; the style guide adds ceil(399 × 0.3) = 120.

curl -X POST "https://xsfyj.com/api/b2b/v1/quotes" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
    "target_language": "en",
    "options": {
      "output_format": "original_above",
      "style_guide": "Keep a light, modern tone. Use pinyin for names; do not translate sect names literally unless the glossary says so.",
      "scope": {"start_percent": 0, "end_percent": 50},
      "translate_filename": true,
      "retention_days": 30
    },
    "jobs": [{"type": "translation"}]
  }'
{
  "id": "quo_0mvricmlthSrwls5txr5Kro",
  "object": "quote",
  "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
  "target_language": "en",
  "items": [{
    "type": "translation", "characters": 200, "credits": 320,
    "breakdown": { "base_credits": 200, "style_guide_credits": 120, "style_guide_waived": false,
                   "scope": { "start": 0, "end_exclusive": 200 } }
  }],
  "total_credits": 320,
  "balance": 199085,
  "sufficient": true,
  "warnings": [],
  "expires_at": "2026-10-28T03:11:11Z",
  "created_at": "2026-10-28T02:41:11Z"
}

2. Create the job with the quote

`output_format`: `translation_only` (default), `original_above` (bilingual, original paragraph first) or `translation_above`. `translate_filename` also translates the output file name. `retention_days` can shorten (not extend) how long files are kept: 90 days by default, 180 for Plus.

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "quote_id": "quo_0mvricmlthSrwls5txr5Kro",
    "type": "translation",
    "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
    "target_language": "en",
    "options": { …same options as the quote… }
  }'
{
  "id": "job_0mvrid2ce1Vv9nvcqbyUkw8",
  "object": "job",
  "type": "translation",
  "status": "queued",
  "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
  "target_language": "en",
  "options": {
    "scope": { "end_percent": 50, "start_percent": 0 },
    "style_guide": "Keep a light, modern tone. …",
    "output_format": "original_above",
    "retention_days": 30,
    "translate_filename": true
  },
  "glossary": null,
  "credits": 320,
  "billing_state": "held",
  "progress": { "stage": null, "percent": 0, "waiting_reason": null },
  "result": null,
  "error": null,
  "poll_after_seconds": 5,
  "created_at": "2026-10-28T02:41:31Z"
}

3. Poll until succeeded

Wait `poll_after_seconds` between polls. `status` goes `queued` → `running` (with `progress.stage` / `percent`) → `succeeded` | `failed` | `cancelled`. On success `billing_state` becomes `consumed` and `result.files` lists the outputs.

curl "https://xsfyj.com/api/b2b/v1/jobs/job_0mvrid2ce1Vv9nvcqbyUkw8" \
  -H "Authorization: Bearer $KEY"
{
  "id": "job_0mvrid2ce1Vv9nvcqbyUkw8",
  "object": "job",
  "status": "succeeded",
  "credits": 320,
  "billing_state": "consumed",
  "progress": { "stage": "COMPLETE", "percent": 100, "waiting_reason": null },
  "result": {
    "files": [{ "kind": "translated", "file_id": "NVMVRID2O4ZS_output_ec08cf5334ea43c9",
                "filename": "Chapter 1 Entering Qingyun (chapter-1).range-0-50_bilingual.txt", "size_bytes": 1983 }]
  },
  "poll_after_seconds": null,
  "completed_at": "2026-10-28T02:42:32Z",
  "…": "…"
}
  • A quote is a price check, not a reservation: credits are held only when the job is created.
  • If the quote carries a `SOURCE_LANGUAGE_MISMATCH` warning, add `"confirm_source_language": true` to the job, otherwise it fails with 409 `SOURCE_LANGUAGE_CONFIRMATION_REQUIRED`.
  • Jobs beyond your account's concurrent limit wait in `queued`; that is normal and the job starts automatically.

List and download output files

Files are available once the job has succeeded and until its retention period ends. Downloads go to a signed storage URL that is valid for at most 120 seconds, so request a fresh link each time instead of storing it.

1. List files

curl "https://xsfyj.com/api/b2b/v1/jobs/job_0mvrid2ce1Vv9nvcqbyUkw8/files" \
  -H "Authorization: Bearer $KEY"
{
  "object": "list",
  "data": [{
    "file_id": "NVMVRID2O4ZS_output_ec08cf5334ea43c9",
    "filename": "Chapter 1 Entering Qingyun (chapter-1).range-0-50_bilingual.txt",
    "size_bytes": 1983,
    "kind": "translated"
  }],
  "has_more": false,
  "next_cursor": null
}

2. Download (302 redirect)

`-L` follows the redirect. curl drops the `Authorization` header when redirected to another host, which is what you want.

curl -L -o out.txt \
  "https://xsfyj.com/api/b2b/v1/jobs/job_0mvrid2ce1Vv9nvcqbyUkw8/files/NVMVRID2O4ZS_output_ec08cf5334ea43c9" \
  -H "Authorization: Bearer $KEY"
HTTP/1.1 302 Found
Location: https://….r2.cloudflarestorage.com/…?X-Amz-Expires=120&X-Amz-Signature=…

# out.txt (original_above)
第一章 青云入门
Chapter 1: Entering Qingyun

林逸站在青云宗的山门前,抬头望着那块写着“青云”二字的巨石。…
Lin Yi stood before the mountain gate of the Qingyun Sect, looking up at the massive stone carved with the words "Qingyun." …

3. Get the link as JSON

curl "https://xsfyj.com/api/b2b/v1/jobs/job_0mvrid2ce1Vv9nvcqbyUkw8/files/NVMVRID2O4ZS_output_ec08cf5334ea43c9?redirect=false" \
  -H "Authorization: Bearer $KEY"
{
  "url": "https://….r2.cloudflarestorage.com/…?X-Amz-Expires=120&X-Amz-Signature=…",
  "filename": "Chapter 1 Entering Qingyun (chapter-1).range-0-50_bilingual.txt",
  "size_bytes": 1983,
  "expires_at": "2026-10-28T02:45:11Z"
}

Free preview translation

`preview_translation` translates the beginning of a source for free so you can check quality before paying: up to 10,000 characters (`options.char_limit`) and 10 previews per account per UTC day (`limits.free_previews_per_day` in `GET /account`). The output file contains the translated opening followed by the untranslated rest.

1. Create a preview

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"type": "preview_translation", "source_id": "src_0mvri8vl8f7PDVEwlqpkm5B",
       "target_language": "en", "options": {"char_limit": 300}}'
{
  "id": "job_0mvrig576CHCY8cT3q7Qg0a",
  "object": "job",
  "type": "preview_translation",
  "status": "queued",
  "options": { "char_limit": 300, "output_format": "translation_only", "translate_filename": false },
  "credits": 0,
  "billing_state": "none",
  "poll_after_seconds": 5,
  "…": "…"
}
  • Poll and download exactly like a translation job. After the daily allowance is used up, the API returns 429 `DAILY_QUOTA_EXCEEDED` until the UTC day resets.

Cancel jobs, list jobs and credits

Credits follow the job: held at creation (`billing_state: held`), consumed on success (`consumed`), and released in full on failure or cancellation (`released`). Only `queued` jobs can be cancelled.

1. Cancel a queued job

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs/job_0mvrie3t4wiz0fxr1IWp7yS/cancel" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)"
{
  "id": "job_0mvrie3t4wiz0fxr1IWp7yS",
  "object": "job",
  "type": "translation",
  "status": "cancelled",
  "credits": 399,
  "billing_state": "released",
  "completed_at": "2026-10-28T02:42:34Z",
  "…": "…"
}

2. A running job cannot be cancelled

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs/job_0mvrid2ce1Vv9nvcqbyUkw8/cancel" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)"
{
  "type": "https://novotranslator.com/api-docs#error-JOB_NOT_CANCELLABLE",
  "title": "Job not cancellable",
  "status": 409,
  "code": "JOB_NOT_CANCELLABLE",
  "detail": "Only queued jobs can be cancelled.",
  "param": null,
  "request_id": "req_0mvridezjBgGsAr5CxkbtHt"
}

3. List jobs with filters and a cursor

Filters: `type`, `status`, `series_id`, `created_after` (RFC 3339). Newest first. While `has_more` is true, pass `next_cursor` as `cursor` with the same filters. Jobs created on the website appear here too.

curl "https://xsfyj.com/api/b2b/v1/jobs?status=succeeded&limit=2" -H "Authorization: Bearer $KEY"
curl "https://xsfyj.com/api/b2b/v1/jobs?status=succeeded&limit=2&cursor=WyIyMDI2LTEwLTI4VDAyOjQyOjUzLjk5NVoiLCJqb2JfMG12cmlldG83UGlTM1g1a2FIZXVsS2siXQ" \
  -H "Authorization: Bearer $KEY"
{
  "object": "list",
  "data": [
    { "id": "job_0mvrig576CHCY8cT3q7Qg0a", "object": "job", "type": "preview_translation", "status": "succeeded", "…": "…" },
    { "id": "job_0mvrieto7PiS3X5kaHeulKk", "object": "job", "type": "translation", "status": "succeeded", "…": "…" }
  ],
  "has_more": true,
  "next_cursor": "WyIyMDI2LTEwLTI4VDAyOjQyOjUzLjk5NVoiLCJqb2JfMG12cmlldG83UGlTM1g1a2FIZXVsS2siXQ"
}

4. Not enough credits → 402

Check `sufficient` in the quote, or `balance.total_credits` in `GET /account`, before creating large jobs. Nothing is held when this error is returned.

curl -X POST "https://xsfyj.com/api/b2b/v1/jobs" … # same request as above
{
  "type": "https://novotranslator.com/api-docs#error-INSUFFICIENT_CREDITS",
  "title": "Insufficient credits",
  "status": 402,
  "code": "INSUFFICIENT_CREDITS",
  "detail": "This job needs 320 credits.",
  "param": null,
  "request_id": "req_…",
  "meta": { "required_credits": 320, "top_up_url": "https://novotranslator.com/pricing" }
}
  • Retrying `POST /jobs` with the same `Idempotency-Key` and body returns the original job instead of creating (and charging) a second one; keys are kept for 24 hours.
  • Write requests are rate limited per key (`X-RateLimit-*` headers); on 429, wait for `Retry-After` seconds.
  • `DELETE /jobs/{id}` removes a job's files early (privacy); the job record and its billing stay.

Translate a multi-volume series

A series keeps one worldview and one growing glossary for all volumes, so names and tone stay consistent from volume 1 to volume N. Flow: create the series → add volumes → bootstrap on the anchor volume (worldview 0.1 + glossary 0.5 credit per character of that volume) → for each later volume, optionally extract new terms (0.5 credit/char of that volume) and review them → translate the volume (1 credit/char, +30% when the series has a style_guide). Each job freezes the glossary version it used.

1. Create the series

`glossary_mode` decides how the series glossary is applied when translating: `merge` (default) lets the engine add terms it finds, `strict` only uses your glossary. `style_guide` (≤ 500 chars) and `output_format` apply to every volume translation.

curl -X POST "https://xsfyj.com/api/b2b/v1/series" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Azure Cloud Sect",
    "source_language": "zh-CN",
    "target_language": "en",
    "glossary_mode": "merge",
    "style_guide": "Keep Chinese names in pinyin; formal, slightly archaic tone for elders.",
    "output_format": "translation_only"
  }'
{
  "id": "ser_0mvri8igdU1ZBKpByrilHDc",
  "object": "series",
  "name": "Azure Cloud Sect",
  "source_language": "zh-CN",
  "target_language": "en",
  "settings": {
    "style_guide": "Keep Chinese names in pinyin; formal, slightly archaic tone for elders.",
    "glossary_mode": "merge",
    "output_format": "translation_only",
    "auto_accept_new_terms": true
  },
  "glossary_id": null,
  "worldview": null,
  "worldview_version": 0,
  "created_at": "2026-10-28T02:37:59Z"
}

2. Upload each volume and add it to the series

Upload every volume as a source (file or `text`), then attach it with its reading order. `position` defaults to the next number. Repeat for volume 2 (`src_0mvri8wtzFSbMncyV5GZvwu` → `vol_0mvri9b6q2tHTry6X2O5cSb`).

curl -X POST "https://xsfyj.com/api/b2b/v1/sources?wait=30" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "[email protected]"
# → { "id": "src_0mvri8q0pk5VSCNlpLs0k55", "status": "ready", "characters": 221, … }

curl -X POST "https://xsfyj.com/api/b2b/v1/series/ser_0mvri8igdU1ZBKpByrilHDc/volumes" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "source_id": "src_0mvri8q0pk5VSCNlpLs0k55", "position": 1, "title": "Volume 1: Azure Cloud Gate" }'
{
  "id": "vol_0mvri96244cG34JfpngJjzL",
  "object": "series_volume",
  "source_id": "src_0mvri8q0pk5VSCNlpLs0k55",
  "position": 1,
  "title": "Volume 1: Azure Cloud Gate"
}

3. Bootstrap the series on the anchor volume

Starts a worldview job and a glossary job on the anchor volume (default: position 1; pass `volume_id` to choose another). Returns 202 with both jobs. Here volume 1 has 221 characters: worldview ⌈221 × 0.1⌉ = 23, glossary ⌈221 × 0.5⌉ = 111 credits.

curl -X POST "https://xsfyj.com/api/b2b/v1/series/ser_0mvri8igdU1ZBKpByrilHDc/bootstrap" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
{
  "object": "list",
  "data": [
    {
      "id": "job_0mvri9glj2W6mt6fqgSikI2",
      "object": "job",
      "type": "worldview",
      "status": "queued",
      "source_id": "src_0mvri8q0pk5VSCNlpLs0k55",
      "series_id": "ser_0mvri8igdU1ZBKpByrilHDc",
      "credits": 23,
      "billing_state": "held",
      "poll_after_seconds": 5,
      …
    },
    {
      "id": "job_0mvri9h45o9tD37yT4cbPPw",
      "object": "job",
      "type": "glossary",
      "status": "queued",
      "credits": 111,
      "billing_state": "held",
      …
    }
  ],
  "has_more": false,
  "next_cursor": null
}

4. Read the series after bootstrap

When both jobs succeed, the series gets `worldview` (version 1) and `glossary_id` (glossary version 1, every term `suggested`), and a `series.glossary.updated` event is emitted. `volumes[].jobs` lists the latest jobs of each volume.

curl "https://xsfyj.com/api/b2b/v1/series/ser_0mvri8igdU1ZBKpByrilHDc" \
  -H "Authorization: Bearer $KEY"
{
  "id": "ser_0mvri8igdU1ZBKpByrilHDc",
  "object": "series",
  "name": "Azure Cloud Sect",
  "glossary_id": "gls_0mvriah1kudAgkROSl89vK9",
  "worldview": "Source Title: 青云门 / azure-cloud-vol1.txt\nGenre: Fantasy / Cultivation / Xianxia\nRegister: period-flavored\nTranslation References:\n- 筑基 -> Foundation Establishment …",
  "worldview_version": 1,
  "volumes": [
    {
      "id": "vol_0mvri96244cG34JfpngJjzL",
      "object": "series_volume",
      "source_id": "src_0mvri8q0pk5VSCNlpLs0k55",
      "position": 1,
      "title": "Volume 1: Azure Cloud Gate",
      "jobs": [
        { "id": "job_0mvri9h45o9tD37yT4cbPPw", "type": "glossary", "status": "succeeded", "credits": 111, "billing_state": "consumed", … },
        { "id": "job_0mvri9glj2W6mt6fqgSikI2", "type": "worldview", "status": "succeeded", "credits": 23, "billing_state": "consumed", … }
      ]
    },
    { "id": "vol_0mvri9b6q2tHTry6X2O5cSb", "object": "series_volume", "position": 2, "title": "Volume 2: Myriad Demon Valley", "jobs": [] }
  ],
  …
}

5. Review the glossary and lock the terms you approve

Glossaries are versioned. `upsert` replaces whole terms by `source`, `remove` deletes by `source`. Send the version you read as `If-Match`; if someone changed it meanwhile you get 409 `VERSION_CONFLICT` with `meta.current_version`. Locked terms are never overwritten by later extraction.

curl -X PATCH "https://xsfyj.com/api/b2b/v1/glossaries/gls_0mvriah1kudAgkROSl89vK9" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H 'If-Match: "1"' \
  -H "Content-Type: application/json" \
  -d '{
    "upsert": [
      { "source": "林逸", "target": "Lin Yi", "category": "person_name", "gender": "male", "authority": "locked" },
      { "source": "苏晴", "target": "Su Qing", "category": "person_name", "gender": "female", "authority": "locked" },
      { "source": "青云门", "target": "Azure Cloud Sect", "category": "proper_noun", "authority": "locked" },
      { "source": "玄冥玉佩", "target": "Xuanming Jade Pendant", "category": "proper_noun", "authority": "locked" }
    ],
    "remove": ["第一章 青云门"]
  }'
ETag: "2"

{
  "id": "gls_0mvriah1kudAgkROSl89vK9",
  "object": "glossary",
  "name": "Azure Cloud Sect glossary",
  "version": 2,
  "current_version": 2,
  "term_count": 10,
  "terms": [
    { "source": "青云门", "target": "Azure Cloud Sect", "category": "proper_noun", "gender": null, "authority": "locked" },
    { "source": "林逸", "target": "Lin Yi", "category": "person_name", "gender": "male", "authority": "locked" },
    { "source": "问心阶", "target": "Heart-Questioning Steps", "category": "cultural_concept", "gender": null, "note": "…", "alternatives": ["…"], "count": 2, "authority": "suggested" },
    …
  ],
  "origin": { "kind": "patch" },
  "version_created_at": "2026-10-28T02:40:26Z"
}

6. Extract new terms from volume 2

Runs a glossary job on this volume with the series glossary as input (0.5 credit/char of the volume: ⌈209 × 0.5⌉ = 105). On success, existing terms are kept unchanged and only new terms are appended as `suggested` — a new glossary version plus a `series.glossary.updated` event (`added_terms`, `glossary_version`).

curl -X POST "https://xsfyj.com/api/b2b/v1/series/ser_0mvri8igdU1ZBKpByrilHDc/volumes/vol_0mvri9b6q2tHTry6X2O5cSb/glossary" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'

# after the job succeeds:
curl "https://xsfyj.com/api/b2b/v1/glossaries/gls_0mvriah1kudAgkROSl89vK9" -H "Authorization: Bearer $KEY"
{
  "id": "gls_0mvriah1kudAgkROSl89vK9",
  "object": "glossary",
  "version": 3,
  "term_count": 17,
  "terms": [
    { "source": "林逸", "target": "Lin Yi", "gender": "male", "authority": "locked", … },
    { "source": "苏晴", "target": "Su Qing", "gender": "female", "authority": "locked", … },
    …
    { "source": "血煞宗", "target": "Blood Fiend Sect", "category": "proper_noun", "authority": "suggested", … },
    { "source": "万妖谷", "target": "Myriad Demon Valley", "category": "proper_noun", "authority": "suggested", … },
    { "source": "噬魂幡", "target": "soul-devouring banner", "category": "cultural_concept", "authority": "suggested", … }
  ],
  "origin": { "kind": "series_increment", "added": 7, "job_id": "job_0mvriby2od1mYMZ2wW0IWVC", "series_id": "ser_0mvri8igdU1ZBKpByrilHDc" }
}

7. Translate volume 2

Uses the series worldview and the glossary version current at submission time — frozen into the job (`glossary.version`), so later edits do not affect a running job. Credits: 209 chars × 1 + ⌈209 × 0.3⌉ style-guide surcharge = 272. Download the result via `GET /jobs/{id}/files/{file_id}`.

curl -X POST "https://xsfyj.com/api/b2b/v1/series/ser_0mvri8igdU1ZBKpByrilHDc/volumes/vol_0mvri9b6q2tHTry6X2O5cSb/translate" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
{
  "id": "job_0mvrieto7PiS3X5kaHeulKk",
  "object": "job",
  "type": "translation",
  "status": "queued",
  "source_id": "src_0mvri8wtzFSbMncyV5GZvwu",
  "series_id": "ser_0mvri8igdU1ZBKpByrilHDc",
  "target_language": "en",
  "source_language": "zh-CN",
  "options": {
    "style_guide": "Keep Chinese names in pinyin; formal, slightly archaic tone for elders.",
    "output_format": "translation_only",
    "translate_filename": false
  },
  "glossary": { "mode": "merge", "glossary_id": "gls_0mvriah1kudAgkROSl89vK9", "version": 4, "inline_terms": 0 },
  "credits": 272,
  "billing_state": "held",
  …
}

# succeeded → "result": { "files": [{ "kind": "translated", "file_id": "NVMVRIETV3HS_output_e657f246a7ff4dd0", "filename": "azure-cloud-vol2_translated.txt", "size_bytes": 969 }] }
# "Three months later, Lin Yi had broken through to Foundation Establishment. Yun Zhonghe ordered him to travel with Su Qing to Myriad Demon Valley to investigate the Blood Fiend Sect's traces. …"

8. Revise the series worldview

Replaces the worldview text and bumps `worldview_version`. Translations submitted afterwards use the new text; earlier jobs keep what they were given.

curl -X PATCH "https://xsfyj.com/api/b2b/v1/series/ser_0mvri8igdU1ZBKpByrilHDc/worldview" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "worldview": "Genre: Xianxia / cultivation.\nNames: pinyin (Lin Yi, Su Qing, Yun Zhonghe). Su Qing is female; address her as \"Senior Sister\".\nFactions: Azure Cloud Sect (orthodox) vs Blood Fiend Sect (demonic)." }'
{
  "id": "ser_0mvri8igdU1ZBKpByrilHDc",
  "object": "series",
  "glossary_id": "gls_0mvriah1kudAgkROSl89vK9",
  "worldview": "Genre: Xianxia / cultivation.\nNames: pinyin (Lin Yi, Su Qing, Yun Zhonghe). Su Qing is female; address her as \"Senior Sister\".\nFactions: …",
  "worldview_version": 2,
  …
}
  • Cost of this example: bootstrap 23 + 111, volume-2 terms 105, volume-2 translation 272 = 511 credits. Credits are held at submission and consumed only on success.
  • Your account runs a limited number of heavy jobs at once; extra jobs wait in `queued` (see `progress.waiting_reason`). Subscribe to `job.succeeded` and `series.glossary.updated` webhooks instead of polling.
  • Skip the per-volume term extraction if a volume introduces no new names — translation already applies the series glossary in `merge` mode.
  • Review new `suggested` terms (PATCH with `authority: "locked"`) before translating the volume, so the frozen glossary version contains your decisions.

Receive webhooks

Webhooks follow the Standard Webhooks spec. Events are thin: they carry ids and a status summary, never translated text — fetch the job (or glossary / series) afterwards. Event types: source.ready, source.failed, job.queued, job.running, job.succeeded, job.failed, job.cancelled, series.glossary.updated, account.credits_low.

1. Create an endpoint

The URL must be public https on port 443 (private, loopback and http URLs are rejected with 400 `INVALID_PARAMETER`). `events` defaults to `["*"]`. The signing `secret` is returned only in this response — store it now. Up to 10 endpoints per account.

curl -X POST "https://xsfyj.com/api/b2b/v1/webhook_endpoints" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/hooks/novo",
    "events": ["job.succeeded", "job.failed", "series.glossary.updated"],
    "description": "production worker"
  }'
{
  "id": "whe_0mvri9p5niB6qBCANjOEjQ4",
  "object": "webhook_endpoint",
  "url": "https://example.com/hooks/novo",
  "events": ["job.succeeded", "job.failed", "series.glossary.updated"],
  "status": "enabled",
  "description": "production worker",
  "consecutive_failures": 0,
  "disabled_at": null,
  "created_at": "2026-10-28T02:38:54Z",
  "secret": "whsec_…"
}

2. Send a test event and inspect deliveries

The test sends a `job.succeeded` event with `data.test: true`. `GET /webhook_endpoints/{id}` returns the 20 most recent deliveries with `status` (pending / succeeded / failed), `attempts`, `last_status_code`, `last_error` and `next_attempt_at`.

curl -X POST "https://xsfyj.com/api/b2b/v1/webhook_endpoints/whe_0mvri9p5niB6qBCANjOEjQ4/test" \
  -H "Authorization: Bearer $KEY"

curl "https://xsfyj.com/api/b2b/v1/webhook_endpoints/whe_0mvri9p5niB6qBCANjOEjQ4" \
  -H "Authorization: Bearer $KEY"
{
  "object": "webhook_test",
  "event_id": "evt_0mvri9zz6q8ZGNnz5y0MZKP",
  "endpoint": {
    "id": "whe_0mvri9p5niB6qBCANjOEjQ4",
    "object": "webhook_endpoint",
    "status": "enabled",
    "consecutive_failures": 0,
    "recent_deliveries": [
      {
        "id": "dc15bd0c-60e0-47bc-a105-120ce14798d3",
        "event_id": "evt_0mvri9zz6q8ZGNnz5y0MZKP",
        "event_type": "job.succeeded",
        "status": "succeeded",
        "attempts": 1,
        "last_status_code": 200,
        "last_error": null,
        "next_attempt_at": "2026-10-28T03:02:53Z"
      }
    ],
    …
  }
}

3. What your endpoint receives

A POST with JSON body and three signing headers. `webhook-id` equals the event id and stays the same on retries — use it to deduplicate. Respond 2xx within 5 seconds; anything else (or a redirect) counts as a failure.

POST /hooks/novo HTTP/1.1
content-type: application/json
user-agent: NovoTranslator-Webhooks/1.0
webhook-id: evt_0mvriah30unQ1UIWaJkCcDY
webhook-timestamp: 1793155171
webhook-signature: v1,<base64 HMAC-SHA256>
{
  "id": "evt_0mvriah30unQ1UIWaJkCcDY",
  "object": "event",
  "type": "job.succeeded",
  "created_at": "2026-10-28T02:39:31Z",
  "data": {
    "id": "job_0mvri9h45o9tD37yT4cbPPw",
    "object": "job",
    "type": "glossary",
    "status": "succeeded",
    "credits": 111,
    "series_id": "ser_0mvri8igdU1ZBKpByrilHDc",
    "source_id": "src_0mvri8q0pk5VSCNlpLs0k55"
  }
}

// series.glossary.updated
{ "id": "evt_0mvrid5lnlq9QtEYr35dZHF", "object": "event", "type": "series.glossary.updated", "created_at": "2026-10-28T02:41:36Z",
  "data": { "id": "ser_0mvri8igdU1ZBKpByrilHDc", "object": "series", "glossary_id": "gls_0mvriah1kudAgkROSl89vK9", "glossary_version": 3, "added_terms": 7, "job_id": "job_0mvriby2od1mYMZ2wW0IWVC" } }

4. Verify the signature — Node.js

Signed content is `{webhook-id}.{webhook-timestamp}.{raw body}`, HMAC-SHA256 with the base64-decoded part of the secret after `whsec_`. Compare in constant time and reject timestamps more than 5 minutes away.

// Node.js ≥ 18 — verify a Standard Webhooks signature (no dependencies)
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyWebhook(secret, headers, rawBody, nowSeconds = Math.floor(Date.now() / 1000)) {
  const id = headers["webhook-id"];
  const timestamp = Number(headers["webhook-timestamp"]);
  if (!id || !Number.isFinite(timestamp)) return false;
  if (Math.abs(nowSeconds - timestamp) > 5 * 60) return false; // reject replays / clock skew > 5 min

  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = createHmac("sha256", key).update(id + "." + timestamp + "." + rawBody).digest();

  // the header may carry several space-separated signatures, e.g. during secret rotation
  return String(headers["webhook-signature"] ?? "").split(" ").some((entry) => {
    const [version, value] = entry.split(",");
    if (version !== "v1" || !value) return false;
    const actual = Buffer.from(value, "base64");
    return actual.length === expected.length && timingSafeEqual(actual, expected);
  });
}

// Express: keep the raw body — re-serialised JSON will not match the signature
app.post("/hooks/novo", express.raw({ type: "application/json" }), async (req, res) => {
  if (!verifyWebhook(process.env.NOVO_WEBHOOK_SECRET, req.headers, req.body.toString("utf8"))) {
    return res.status(400).end();
  }
  const event = JSON.parse(req.body);
  res.status(204).end();                        // acknowledge fast (< 5 s), work async
  await queue.add(event.id, event);             // dedupe on event.id
});

// Test vector (standardwebhooks.com) → true:
// verifyWebhook("whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw",
//   { "webhook-id": "msg_p5jXN8AQM9LWM0D4loKWxJek", "webhook-timestamp": "1614265330",
//     "webhook-signature": "v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE=" },
//   '{"test": 2432232314}', 1614265330)

5. Verify the signature — Python

Same algorithm. Official Standard Webhooks libraries (npm `standardwebhooks`, PyPI `standardwebhooks`, and others) also work with these headers.

# Python ≥ 3.10 — verify a Standard Webhooks signature (standard library only)
import base64, hashlib, hmac, time

def verify_webhook(secret: str, headers: dict, raw_body: bytes, now: int | None = None) -> bool:
    msg_id = headers.get("webhook-id", "")
    timestamp = headers.get("webhook-timestamp", "")
    if not msg_id or not timestamp.isdigit():
        return False
    if abs((now or int(time.time())) - int(timestamp)) > 5 * 60:  # reject skew > 5 min
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    signed = f"{msg_id}.{timestamp}.".encode() + raw_body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
    return any(
        version == "v1" and hmac.compare_digest(value, expected)
        for version, _, value in (entry.partition(",") for entry in headers.get("webhook-signature", "").split(" "))
    )

# Flask: use request.get_data() (raw bytes), and lower-case header names
@app.post("/hooks/novo")
def novo_hook():
    headers = {k.lower(): v for k, v in request.headers.items()}
    if not verify_webhook(os.environ["NOVO_WEBHOOK_SECRET"], headers, request.get_data()):
        abort(400)
    enqueue(request.get_json())   # dedupe on event["id"]
    return "", 204

6. Retries, auto-disable and catching up

Failed deliveries are retried with backoff (30 s, 2 min, 10 min, 30 min, 1 h, 2 h, 4 h, 8 h, 12 h — roughly a day in total), then marked `failed`. An endpoint failing continuously for 3 days is set to `disabled`; fix it and re-enable with PATCH `status: "enabled"` (resets the failure counter). Events are kept 30 days — after an outage, page through `GET /events` and fetch each job.

curl -X PATCH "https://xsfyj.com/api/b2b/v1/webhook_endpoints/whe_0mvri9p5niB6qBCANjOEjQ4" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "enabled" }'

curl "https://xsfyj.com/api/b2b/v1/events?type=job.succeeded&limit=3" \
  -H "Authorization: Bearer $KEY"

# continue with ?cursor=<next_cursor>; delete an endpoint with DELETE /webhook_endpoints/{id} → 204
{
  "object": "list",
  "data": [
    {
      "id": "evt_0mvriah30unQ1UIWaJkCcDY",
      "object": "event",
      "type": "job.succeeded",
      "created_at": "2026-10-28T02:39:31Z",
      "data": { "id": "job_0mvri9h45o9tD37yT4cbPPw", "object": "job", "type": "glossary", "status": "succeeded", "credits": 111, "series_id": "ser_0mvri8igdU1ZBKpByrilHDc", "source_id": "src_0mvri8q0pk5VSCNlpLs0k55" }
    },
    …
  ],
  "has_more": true,
  "next_cursor": "WyIyMDI2LTEwLTI4VDAyOjM5OjA4Ljg4NVoiLCJldnRfMG12cmk5eno2cThaR05uejV5ME1aS1AiXQ"
}
  • Verify against the raw request bytes; parsing and re-serialising JSON changes whitespace and breaks the signature.
  • Delivery order is not guaranteed and an event may arrive more than once — dedupe on `webhook-id` and always re-read the job for its current state.
  • Never expose the endpoint secret; if it leaks, create a new endpoint and delete the old one.

Errors, idempotency and rate limits

Every error is RFC 9457 `application/problem+json` with a stable `code`, the offending `param` and a `request_id` to quote to support. Write requests need an `Idempotency-Key` (DELETE, quotes and webhook-endpoint PATCH / test calls are exempt), so a network retry never creates a second job or charges twice.

1. Error shape

Branch on `code` (see the error table), not on `title` or `detail`. `retryable` errors are 409 `IDEMPOTENCY_IN_PROGRESS`, `SOURCE_NOT_READY`, 429 and 5xx.

curl -X POST "https://xsfyj.com/api/b2b/v1/series" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Bad", "target_language": "en", "glossary_mode": "loose" }'
HTTP/1.1 400 Bad Request
Content-Type: application/problem+json

{
  "type": "https://novotranslator.com/api-docs#error-INVALID_PARAMETER",
  "title": "Invalid parameter",
  "status": 400,
  "code": "INVALID_PARAMETER",
  "detail": "Invalid enum value. Expected 'merge' | 'strict', received 'loose'",
  "param": "glossary_mode",
  "request_id": "req_0mvridxjxTehHd67LwkPNz7",
  "doc_url": "https://novotranslator.com/api-docs#error-INVALID_PARAMETER"
}

2. Safe retries with Idempotency-Key

Generate one key per logical operation and reuse it on every retry. The same key with the same body returns the stored response (same status and ids) plus `Idempotent-Replayed: true`. The same key with a different body is 409 `IDEMPOTENCY_KEY_MISMATCH`; a write without a key is 400 `IDEMPOTENCY_KEY_REQUIRED`.

IK=$(uuidgen)
curl -i -X POST "https://xsfyj.com/api/b2b/v1/series" -H "Authorization: Bearer $KEY" -H "Idempotency-Key: $IK" \
  -H "Content-Type: application/json" -d '{"name":"Idempotency demo","target_language":"en"}'
# retry (e.g. after a timeout) — same key, same body
curl -i -X POST "https://xsfyj.com/api/b2b/v1/series" -H "Authorization: Bearer $KEY" -H "Idempotency-Key: $IK" \
  -H "Content-Type: application/json" -d '{"name":"Idempotency demo","target_language":"en"}'
# same key, different body
curl -i -X POST "https://xsfyj.com/api/b2b/v1/series" -H "Authorization: Bearer $KEY" -H "Idempotency-Key: $IK" \
  -H "Content-Type: application/json" -d '{"name":"Idempotency demo 2","target_language":"en"}'
HTTP/1.1 201 Created
{ "id": "ser_0mvrid4s0TAE07g4Zo0T8sr", "object": "series", "name": "Idempotency demo", … }

HTTP/1.1 201 Created
Idempotent-Replayed: true
{ "id": "ser_0mvrid4s0TAE07g4Zo0T8sr", "object": "series", "name": "Idempotency demo", … }

HTTP/1.1 409 Conflict
Content-Type: application/problem+json
{ "code": "IDEMPOTENCY_KEY_MISMATCH", "status": 409, "title": "Idempotency-Key reused", "detail": "Idempotency-Key reused", "param": null, "request_id": "req_0mvridfjtLquimeSMXpZdok", … }

3. Rate limits

Every response carries IETF `RateLimit` / `RateLimit-Policy` headers (plus `X-RateLimit-*`) for the per-key window: reads and writes are counted separately (`limits.read_per_minute` / `write_per_minute` in `GET /account`). On 429 `RATE_LIMITED`, wait `Retry-After` seconds; use exponential backoff with jitter for 5xx.

curl -i "https://xsfyj.com/api/b2b/v1/account" -H "Authorization: Bearer $KEY"
HTTP/1.1 200 OK
RateLimit-Policy: "read-1m";q=120;w=60
RateLimit: "read-1m";r=118;t=20
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 118
X-RateLimit-Reset: 20

# when the write window is exhausted:
HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json
Retry-After: 17
RateLimit-Policy: "write-1m";q=20;w=60
RateLimit: "write-1m";r=0;t=17
{ "code": "RATE_LIMITED", "status": 429, "title": "Rate limited", "detail": "Limit of 20 requests per minute exceeded.", "request_id": "req_…", … }

Rate limits and tiers

Limits apply per key and depend on the tier of the key. New keys start on Standard (1 heavy job running at a time per account); contact us for the Partner tier.

TierReads / minWrites / minUploads / dayUpload GiB / dayRunning jobsQueued jobsJobs / day
Standard (default)12020100111050
Partner (granted on request)30060100010350500

Response headers

Header
RateLimit-Policy, RateLimitIETF draft rate-limit headers: policy window and remaining quota.
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-ResetThe same information in the de-facto standard form.
Retry-AfterSeconds to wait; sent with 429 responses (RATE_LIMITED, QUEUE_LIMIT_EXCEEDED, DAILY_QUOTA_EXCEEDED).

Back off exponentially on 429, 5xx and network errors, and always reuse the same Idempotency-Key when retrying a write.

Webhooks

  • Register an HTTPS endpoint in the console or with POST /webhook_endpoints. The signing secret (whsec_...) is shown once.
  • Deliveries follow the Standard Webhooks spec: headers webhook-id, webhook-timestamp and webhook-signature.
  • webhook-signature is v1,<base64 HMAC-SHA256> over `${id}.${timestamp}.${body}`. The HMAC key is the bytes of the base64 string after the whsec_ prefix.
  • Reject timestamps older than 5 minutes, and de-duplicate on webhook-id.
  • Reply with any 2xx within a few seconds. Failures are retried for about 24 hours with growing delays; an endpoint with only failures for 3 days is disabled automatically (re-enable it in the console).
  • Missed something? GET /events lists the last 30 days of events.

Event types

source.readysource.failedjob.queuedjob.runningjob.succeededjob.failedjob.cancelledseries.glossary.updatedaccount.credits_low

Verify a signature (Node.js)

import { createHmac, timingSafeEqual } from "node:crypto";

// secret: the "whsec_..." value shown once when you created the endpoint
// rawBody: the request body as the exact received string (do not re-serialize)
export function verifyWebhook(secret, headers, rawBody) {
  const id = headers["webhook-id"];
  const timestamp = Number(headers["webhook-timestamp"]);
  if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false; // 5 min tolerance

  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = createHmac("sha256", key)
    .update(`${id}.${timestamp}.${rawBody}`)
    .digest("base64");

  // the header may hold several space-separated "v1,<signature>" values
  return headers["webhook-signature"].split(" ").some((part) => {
    const [version, signature] = part.split(",");
    if (version !== "v1" || !signature) return false;
    const a = Buffer.from(signature);
    const b = Buffer.from(expected);
    return a.length === b.length && timingSafeEqual(a, b);
  });
}

Endpoint reference

Paths are relative to the Base URL. Full schemas are in the OpenAPI document. /api/b2b/v1/openapi.json

MethodPathScopeDescription
GET/accountaccount:readAccount balance, tier and limits
GET/languagesjobs:readSupported source / target language codes
GET/usageaccount:readDaily usage (jobs, credits)
POST/sourcesidemsources:writeUpload a source and start pre-analysis
GET/sources/{id}jobs:readPre-analysis result: characters, words, detected language
DELETE/sources/{id}sources:writeDelete a staged source
POST/quotesjobs:writeQuote credits for one or more jobs (free, valid 30 min)
POST/jobsidemjobs:writeCreate a worldview / glossary / translation / preview job
GET/jobsjobs:readList jobs (task center)
GET/jobs/{id}jobs:readJob status, progress and cost
DELETE/jobs/{id}jobs:writeRevoke access to a finished job's artifacts
POST/jobs/{id}/cancelidemjobs:writeCancel a queued job (credits released)
GET/jobs/{id}/filesjobs:readList output files
GET/jobs/{id}/files/{file_id}jobs:read302 to a short-lived download URL (`?redirect=false` for JSON)
GET/jobs/{id}/glossaryjobs:readStructured terms of a glossary job
GET/jobs/{id}/worldviewjobs:readWorldview text of a worldview job
POST/glossariesidemglossaries:writeCreate a versioned glossary (terms, from_job_id, or CSV upload)
GET/glossariesjobs:readList glossaries
GET/glossaries/{id}jobs:readGet a glossary version (`?version=`)
PATCH/glossaries/{id}idemglossaries:writeUpsert / remove terms → new immutable version (If-Match)
DELETE/glossaries/{id}glossaries:writeDelete a glossary
GET/glossaries/{id}/exportjobs:readExport as CSV (workbench-compatible)
POST/seriesidemseries:writeCreate a series (shared worldview + cumulative glossary)
GET/seriesjobs:readList series
GET/series/{id}jobs:readSeries with volumes and their jobs
POST/series/{id}/volumesidemseries:writeAdd a volume (an analyzed source)
POST/series/{id}/bootstrapidemseries:writeRun worldview + glossary on the anchor volume
POST/series/{id}/volumes/{volume_id}/glossaryidemseries:writeIncremental terms for a volume (merged into the series glossary)
POST/series/{id}/volumes/{volume_id}/translateidemseries:writeTranslate a volume with the series worldview and frozen glossary version
PATCH/series/{id}/worldviewidemseries:writeRevise the series worldview
POST/webhook_endpointsidemwebhooks:writeRegister a webhook endpoint (secret shown once)
GET/webhook_endpointswebhooks:writeList webhook endpoints
GET/webhook_endpoints/{id}webhooks:writeEndpoint with recent deliveries
PATCH/webhook_endpoints/{id}webhooks:writeUpdate / re-enable an endpoint
DELETE/webhook_endpoints/{id}webhooks:writeDelete an endpoint
POST/webhook_endpoints/{id}/testwebhooks:writeSend a signed test event
GET/eventsjobs:readEvents of the last 30 days (catch up on missed webhooks)
GET/events/{id}jobs:readGet one event

Errors

Errors use RFC 9457 problem+json (Content-Type: application/problem+json). Branch on the stable code field, never on the title or detail text. Every response carries a request_id: quote it when you contact support.

Example

HTTP/1.1 402 Payment Required
Content-Type: application/problem+json

{
  "type": "https://novotranslator.com/api-docs#error-INSUFFICIENT_CREDITS",
  "title": "Insufficient credits",
  "status": 402,
  "code": "INSUFFICIENT_CREDITS",
  "detail": "This job needs 120345 credits; 5000 available.",
  "param": null,
  "request_id": "req_...",
  "doc_url": "https://novotranslator.com/api-docs#error-INSUFFICIENT_CREDITS"
}
CodeHTTPTitleRetryableWhat to do
INVALID_REQUEST400Invalid requestnoFix the request body or query.
INVALID_PARAMETER400Invalid parameternoFix the field named in `param`.
UNSUPPORTED_FILE_FORMAT400Unsupported file formatnoUpload .txt, .epub or .docx.
UNSUPPORTED_LANGUAGE_PAIR400Unsupported language pairnoPick a supported source/target pair.
NO_TRANSLATABLE_CONTENT400No translatable contentnoThe source has no translatable text.
IDEMPOTENCY_KEY_REQUIRED400Idempotency-Key requirednoSend a unique Idempotency-Key header on every write.
IDEMPOTENCY_KEY_INVALID400Invalid Idempotency-KeynoUse 1-200 visible characters without whitespace.
API_KEY_MISSING401API key missingnoSend `Authorization: Bearer <key>`.
API_KEY_INVALID401API key invalidnoCheck the key; create a new one in the developer console.
API_KEY_REVOKED401API key revokednoUse an active key.
API_KEY_EXPIRED401API key expirednoRotate or create a new key.
INSUFFICIENT_SCOPE403Insufficient scopenoGrant the scope listed in meta.required_scope to this key.
IP_NOT_ALLOWED403IP not allowednoCall from an allow-listed IP or update the key.
ACCOUNT_SUSPENDED403Account suspendednoContact support.
BROWSER_ORIGIN_FORBIDDEN403Browser calls forbiddennoCall the API from your server; never ship keys to browsers.
KEY_ISSUANCE_REQUIRES_BALANCE403Credits requirednoTop up credits before creating a key.
INSUFFICIENT_CREDITS402Insufficient creditsnoTop up credits (meta.top_up_url) and retry.
KEY_SPEND_LIMIT_REACHED402Key spend limit reachednoRaise the key's monthly limit or wait for next month.
RESOURCE_NOT_FOUND404Not foundnoCheck the id; objects of other accounts are invisible.
ENDPOINT_REPLACED410Endpoint replacednoThis pilot endpoint was replaced; see doc_url for the mapping.
IDEMPOTENCY_KEY_MISMATCH409Idempotency-Key reusednoUse a new key for a different request body.
IDEMPOTENCY_IN_PROGRESS409Request in progressyesRetry after a few seconds with the same key.
QUOTE_EXPIRED_OR_CHANGED409Quote expired or changednoCreate a new quote.
SOURCE_LANGUAGE_CONFIRMATION_REQUIRED409Confirm source languagenoResend with confirm_source_language=true.
SOURCE_NOT_READY409Source not readyyesWait until the source status is ready.
SOURCE_EXPIRED409Source expirednoUpload the source again.
JOB_NOT_CANCELLABLE409Job not cancellablenoOnly queued jobs can be cancelled.
VERSION_CONFLICT409Version conflictnoRe-read the resource and resend with the new If-Match.
PAYLOAD_TOO_LARGE413Payload too largenoReduce the upload size.
GLOSSARY_INVALID422Glossary invalidnoFix the glossary terms.
SCOPE_INVALID422Scope invalidnoUse 0 <= start_percent < end_percent <= 100.
STYLE_GUIDE_TOO_LONG422Style guide too longnoKeep style_guide within 500 characters.
RATE_LIMITED429Rate limitedyesWait for Retry-After seconds.
QUEUE_LIMIT_EXCEEDED429Queue limit exceededyesWait for queued jobs to start.
DAILY_QUOTA_EXCEEDED429Daily quota exceededyesRetry after the UTC day resets.
INTERNAL_ERROR500Internal erroryesRetry; report request_id if it persists.
UPSTREAM_UNAVAILABLE502Upstream unavailableyesRetry with backoff.
SERVICE_UNAVAILABLE503Service unavailableyesRetry with backoff.

Migrating from the pilot API

The pilot endpoints under /tasks were replaced in place and now answer 410 ENDPOINT_REPLACED. Existing pilot keys keep working and have all v1 scopes; rotate them in the console to get v1 keys.

PilotAPI v1
POST /tasksPOST /sources + POST /quotes + POST /jobs
GET /tasks/{id}GET /jobs/{id}
GET /tasks/{id}/downloadGET /jobs/{id}/files/{file_id}
GET /usage (pilot format)GET /usage: daily usage list, see the OpenAPI document
  • Response envelope: the pilot wrapped everything in {success, data}. v1 returns the plain resource on success and problem+json on failure.
  • Every write now needs an Idempotency-Key header.
  • Pricing and credits: unchanged units (credits), but a quote is available before you create a job.

Changelog

  • 2026-10v1 GA (incompatible with the pilot). Sources, quotes, jobs, glossaries, series, webhooks, events and a developer console.