{"openapi":"3.1.0","info":{"title":"ShinrAI PII API","version":"2.0.0","summary":"Detect, protect and restore personal data in text, tables, JSON, transcripts, pages, images and audio.","description":"Find personal data in text, tables, JSON, transcripts, pages, images and audio. Protect it:\npseudonymise, mask, label, generalise, remove, fill image regions or bleep speech. Restore it later.\n\nThe same contract serves the hosted API, an installation in your own cluster and the offline\nedition. Hosted and offline: send your key as `Authorization: Bearer <key>`. Read\n`GET /v2/capabilities` once at start. It lists the models, languages, input kinds, actions,\ntiers and limits of the deployment. The developer guide explains every feature with curl\nexamples: [Native PII API v2 guide](https://goshinrai.com/docs/guides/v2)\n([Markdown](https://goshinrai.com/public-docs/pii-api-v2.md)).\n\nQuick start:\n\n```bash\ncurl -s https://api.goshinrai.com/v2/detect -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" -d '{\"text\": \"Mail jane@example.org or call +49 30 1234567.\"}'\n```\n\n## Features\n\n| Area | What the API does | Where |\n|---|---|---|\n| [Inputs](https://goshinrai.com/docs/guides/v2#inputs) | `text`, `texts` or `inputs[]` of kind `text`, `table`, `json`, `transcript`, `page` and `image`; a raw `text/plain` or image body; on the hosted API a raw audio body | `/v2/detect`, `/v2/protect` |\n| [Detection](https://goshinrai.com/docs/guides/v2#detection) | Language, model version, types to include or exclude (canonical or vendor names), confidence floors per type and language, values to ignore, your own values, segmentation of long texts | `detection` |\n| [Protection](https://goshinrai.com/docs/guides/v2#protect) | Presets `pseudonymize`, `mask`, `label`, `strict`; per-type actions `surrogate`, `label`, `mask`, `partial`, `generalize`, `replace`, `remove`, `keep` | `policy` |\n| [Outputs](https://goshinrai.com/docs/guides/v2#features) | Entities with spans, confidence and coordinates (table cells, JSON Pointers, pixel boxes, time intervals); annotations; linkage risk; mapping; restore table; redaction plan; stats; offsets in code points, UTF-16, UTF-8 or graphemes | `output` |\n| [Images](https://goshinrai.com/docs/guides/v2#images) | OCR in 14 languages, pixel boxes per entity, the filled image back; one screenshot per request on the realtime tier | `/v2/detect`, `/v2/protect` |\n| [Audio](https://goshinrai.com/docs/guides/v2#audio) | Hosted API: speech recognition, entities with time intervals, the recording back with every entity bleeped or silenced; up to 5 minutes per request on the standard tier, up to 60 minutes as a job; not on the realtime tier. The protection covers the words the speech recognition heard | `/v2/detect`, `/v2/protect`, `/v2/jobs` |\n| [Restore](https://goshinrai.com/docs/guides/v2#restore) | Surrogates drawn per request; the same surrogates across requests with a session or known pairs; restore text and JSON; restore tables for your own or streaming restore; one replacement on demand | `mapping`, `/v2/restore`, `/v2/restore-tables`, `/v2/replacements` |\n| [Sessions](https://goshinrai.com/docs/guides/v2#restore) | A server-held map, encrypted, readable only with your key; it lives at most 24 hours from its creation by default, or up to 7 days when the account enables extended sessions | `/v2/sessions` |\n| [Jobs](https://goshinrai.com/docs/guides/v2#jobs) | Uploads, text batches (JSONL or inline), PDF and DOCX documents (the redacted PDF back), audio recordings; artifacts to download. An upload is deleted when the last job that reads it ends, unless you keep it; jobs and artifacts are deleted after 24 hours | `/v2/uploads`, `/v2/jobs` |\n| [Tiers and cost](https://goshinrai.com/docs/guides/v2#tiers) | Tiers `standard`, `realtime`, `batch`; records of 1,000 characters; free restore, sessions and metadata; `Idempotency-Key` retries are charged once | `processing.tier`, `/v2/usage` |\n| [Limits](https://goshinrai.com/docs/guides/v2#limits) | Per tier and per input kind; `capabilities.limits` has the values of your deployment | `/v2/capabilities` |\n| [Errors](https://goshinrai.com/docs/guides/v2#errors) | One envelope with a code, a message, `retryable` and JSON Pointers; never your data | every operation |\n| [Compatibility APIs](https://goshinrai.com/docs#apis) | Azure AI Language PII, Google Cloud DLP and AWS Comprehend clients change only the endpoint: `azure.api.goshinrai.com`, `google.api.goshinrai.com`, `aws.api.goshinrai.com`, or `/v1/azure`, `/v1/google`, `/v1/aws` on the API host. The vendor contract limits what they return. | own hosts |\n\n## Rules for every operation\n\n- Unknown request fields answer 422 `validation_failed` with a JSON Pointer. Options this\n  deployment does not serve answer 501 `capability_unavailable`.\n- Responses carry no originals unless the request asks for them (`output.include_text`,\n  `output.include: [\"mapping\"]`). Personal data is never a JSON key.\n- `processing.on_degraded: fail` (default) answers 503 `degraded_refused` when a requested\n  detection layer did not run. Failed requests and degraded results are not charged.\n- Surrogates are drawn per request: within one request a value keeps one surrogate, the next\n  request draws new ones. For the same surrogates across requests use a session or\n  `mapping.known`. `mapping.consistency: account` keeps them across all requests of your\n  account (opt-in). Other customers never get your surrogates.\n- Responses carry `Cache-Control: no-store` and `X-Request-Id`.\n\n## Compatibility promise\n\n2.x changes are additive. A breaking change gets a new major and a new path prefix, announced\n12 months ahead; the previous major stays served in that period.\n\n- Additive changes are new operations, new optional request fields and parameters, new response\n  fields, new entity types and new values in response fields. Ignore response fields you do not\n  know, and treat an unknown status in `/v2/capabilities` as not served.\n- The schemas describe 2.0.0 exactly. They list every response field and every value, so that a\n  conformance test finds each deviation of a server. Do not reject a response for a field or a\n  value that you do not know. Set your code generator to ignore unknown fields and to accept\n  unknown enum values; strict generated models break on additive changes.\n- `info.version` follows semantic versioning. Detect, protect and capabilities answers carry it as\n  `api_version`.\n- `shinrai-restore` and `shinrai-word` carry their own versions. A client refuses an unknown major.\n","license":{"name":"Proprietary"}},"servers":[{"url":"https://api.goshinrai.com","description":"Hosted API (Germany)"},{"url":"https://api-sbx.goshinrai.com","description":"Hosted sandbox (test keys)"},{"url":"{base}","description":"Your own installation (in-cluster or offline)","variables":{"base":{"default":"http://localhost:8080"}}}],"security":[{"BearerApiKey":[]}],"paths":{"/v2/detect":{"post":{"tags":["Native PII API v2"],"operationId":"detect","summary":"Find personal data in text, tables, JSON, transcripts, pages, images and audio","description":"Finds personal data and returns every entity with its type, span, confidence and, for\nnon-text inputs, its coordinates. Nothing is replaced.\n\n**Accepts**\n- JSON: `{\"text\": \"...\"}`, `{\"texts\": [\"...\", \"...\"]}` or `{\"inputs\": [...]}` with 1 to 256\n  inputs of kind `text`, `table`, `json`, `transcript`, `page` or `image`. Options go into\n  `detection`, `output` and `processing`.\n- A raw body with options as query parameters: `text/plain` (UTF-8) or one image\n  (`image/png`, `image/jpeg`, `image/bmp`, `image/tiff`, `image/webp`; at most 6 MiB).\n- Hosted API (see `capabilities.inputs.audio`): one recording as the raw body. See Audio.\n\n**Returns** `results[]` per input with `entities` and, on request, `annotations`,\n`linkage_risk`, `stats` and `text`; `engine` (the model, the layers that ran, `degraded`) and\n`usage`. Table entities carry `coords.cell`, JSON entities `coords.path`, page and image\nentities `coords.boxes`, transcript and audio entities `coords.intervals`. An image result adds\n`media` (size and OCR summary).\n\n**Audio** (hosted API): send `audio/wav`, `audio/mpeg`, `audio/ogg`, `audio/opus`,\n`audio/flac`, `audio/mp4`, `audio/m4a`, `audio/aac` or `audio/webm`, at most 300 seconds and\n12 MiB, on the standard tier (another tier answers 422). `results[0].text` is the recognised\ntranscript; entities carry `coords.intervals` in milliseconds. Send `language` for the best\nrecognition. Longer recordings: upload them and start a job of kind `audio`. The answer\nheaders `Shinrai-Audio-Seconds`, `Shinrai-Audio-Language` and `Shinrai-Entities` summarise\nthe call. One audio request per account runs at a time (429 otherwise).\n\n**Cost** (hosted): records of 1,000 characters per input, times the tier weight. An image costs\nat least one record. Audio costs the records of its transcript, at least 10 records per started\nminute. `X-Records-Charged` and `X-Records-Remaining` show the charge.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/detect -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" -d '{\"text\": \"Anna Weber, anna.weber@example.org\"}'\ncurl -s \"https://api.goshinrai.com/v2/detect?language=de\" -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: image/png\" --data-binary @screenshot.png\ncurl -s \"https://api.goshinrai.com/v2/detect?language=de\" -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: audio/mpeg\" --data-binary @call.mp3\n```\n","externalDocs":{"url":"https://goshinrai.com/docs/guides/v2#inputs"},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RequestId"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/QLanguage"},{"$ref":"#/components/parameters/QModel"},{"$ref":"#/components/parameters/QTypes"},{"$ref":"#/components/parameters/QExclude"},{"$ref":"#/components/parameters/QTier"},{"$ref":"#/components/parameters/QOnDegraded"},{"$ref":"#/components/parameters/QGranularity"}],"requestBody":{"required":true,"description":"JSON, or the content itself (plain text, one image or, on the hosted API, one recording) with options as query parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectRequest"},"examples":{"text":{"summary":"One text","value":{"text":"Mail jane@example.org or call +49 30 1234567."}},"inputs":{"summary":"A text and a table, German, with annotations and stats","value":{"language":"de","inputs":[{"id":"letter","kind":"text","text":"Anna Weber wohnt in Darmstadt."},{"id":"crm","kind":"table","columns":[{"name":"name"},{"name":"email"}],"rows":[["Max Mustermann","max@example.org"]]}],"output":{"include":["entities","annotations","stats"]}}},"thresholds":{"summary":"Only e-mail and phone, a higher floor for phone numbers","value":{"text":"Call Anna at +49 30 1234567 or anna@example.org.","detection":{"types":{"include":["EMAIL","PHONE"]},"thresholds":{"per_type":{"PHONE":0.8}}}}}}},"text/plain":{"schema":{"type":"string"},"example":"Mail jane@example.org or call +49 30 1234567."},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/bmp":{"schema":{"type":"string","format":"binary"}},"image/tiff":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}},"audio/mpeg":{"schema":{"type":"string","format":"binary"}},"audio/ogg":{"schema":{"type":"string","format":"binary"}},"audio/opus":{"schema":{"type":"string","format":"binary"}},"audio/flac":{"schema":{"type":"string","format":"binary"}},"audio/mp4":{"schema":{"type":"string","format":"binary"}},"audio/m4a":{"schema":{"type":"string","format":"binary"}},"audio/aac":{"schema":{"type":"string","format":"binary"}},"audio/webm":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/Result"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"},"504":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/protect":{"post":{"tags":["Native PII API v2"],"operationId":"protect","summary":"Detect and protect personal data; return the protected content, the entities and on request the mapping","description":"Detects personal data (or takes your spans), applies the policy and returns the protected\ncontent. Pseudonymised values and labels can be restored later.\n\n**Accepts** the same bodies as `/v2/detect`, plus `policy` (a preset or rules per type) and\n`mapping` (consistency, a session, known pairs, reserved replacements). A raw body takes\n`preset` as a query parameter; a raw audio body also takes `audio_op` and `pad_ms`.\n\n**Returns**\n- JSON (default): `results[]` with the protected `output` in the input's shape (for an image an\n  `ImageOutput` with the filled image), `entities` with `action`, `replacement` and\n  `output_span`, and on request `redaction_plan` (boxes, intervals), `annotations`,\n  `linkage_risk` and `stats`. `mapping` (originals and replacements) comes only with\n  `output.include: [\"mapping\"]`; `restore_table` with `output.include: [\"restore_table\"]`.\n- Raw text body with `Accept: text/plain`: the protected text.\n- Raw image body with `Accept: image/*`: the filled image.\n- Raw audio body (hosted API): the redacted recording as `audio/wav` (16-bit PCM, the\n  source's sample rate up to 48 kHz) unless `Accept` is `application/json` without an audio\n  type. With `Accept: application/json`: `results[0].output.display` is the protected\n  transcript, entities carry `coords.intervals` in milliseconds and\n  `results[0].redaction_plan.intervals` lists every interval the recording mutes.\n\n**Audio options** map to `policy.media.audio`: `audio_op=bleep` (default, a 1 kHz tone) or\n`silence`; `pad_ms` from 0 to 1000 (default 150) widens every muted interval on both sides.\nLimits and headers as on `/v2/detect`. The protection covers the words the speech recognition\nheard: a misheard word that the model does not recognise stays audible.\n\n**Actions**: `surrogate` (realistic, reversible), `label` (`[PERSON_1]`, reversible per value),\n`mask`, `partial` (keeps the e-mail domain, the phone country prefix, the last four digits of\na card or account, the year of a date), `generalize` (a phrase for the kind of name, place or\norganisation), `replace`, `remove`, `keep`. `partial` and `generalize` are one-way.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/protect -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\": \"Anna Weber lives in Darmstadt.\", \"policy\": {\"preset\": \"pseudonymize\"}, \"output\": {\"include\": [\"entities\", \"mapping\"]}}'\ncurl -s \"https://api.goshinrai.com/v2/protect?preset=label\" -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: text/plain\" -H \"Accept: text/plain\" --data-binary @letter.txt\ncurl -s https://api.goshinrai.com/v2/protect -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: image/png\" -H \"Accept: image/png\" --data-binary @screenshot.png -o redacted.png\ncurl -sS \"https://api.goshinrai.com/v2/protect?language=de&audio_op=bleep&pad_ms=150\" \\\n  -H \"Authorization: Bearer $SHINRAI_API_KEY\" -H \"Content-Type: audio/mpeg\" -H \"Accept: audio/wav\" \\\n  --data-binary @call.mp3 -o call.redacted.wav\n```\n","externalDocs":{"url":"https://goshinrai.com/docs/guides/v2#protect"},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/RequestId"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/QLanguage"},{"$ref":"#/components/parameters/QModel"},{"$ref":"#/components/parameters/QTypes"},{"$ref":"#/components/parameters/QExclude"},{"$ref":"#/components/parameters/QTier"},{"$ref":"#/components/parameters/QOnDegraded"},{"$ref":"#/components/parameters/QGranularity"},{"$ref":"#/components/parameters/QPreset"},{"$ref":"#/components/parameters/QAudioOp"},{"$ref":"#/components/parameters/QPadMs"}],"requestBody":{"required":true,"description":"JSON, or the content itself (plain text, one image or, on the hosted API, one recording) with options as query parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProtectRequest"},"examples":{"pseudonymize":{"summary":"Pseudonymise and return the mapping for a later restore","value":{"text":"Anna Weber, IBAN DE89 3704 0044 0532 0130 00","policy":{"preset":"pseudonymize"},"output":{"include":["entities","mapping"]}}},"rules":{"summary":"Keep the e-mail domain and the last four digits of a card, generalise the rest","value":{"text":"Anna Weber aus Biberach, anna@example.org, Karte 4111 1111 1111 1111","language":"de","policy":{"default":{"action":"generalize"},"rules":[{"types":["EMAIL","CREDIT_CARD"],"action":"partial"}]}}},"session":{"summary":"Use and extend a server-held session map","value":{"text":"Anna Weber called again.","mapping":{"session":"ses_7f3a9c"},"output":{"include":["entities","mapping"]}}},"risk":{"summary":"Labels, annotations and the linkage risk","value":{"text":"The 34-year-old head surgeon from Biberach, Anna Weber, joined in 2019.","policy":{"preset":"label"},"output":{"include":["entities","annotations","linkage_risk"]}}}}},"text/plain":{"schema":{"type":"string"},"example":"Mail jane@example.org or call +49 30 1234567."},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/bmp":{"schema":{"type":"string","format":"binary"}},"image/tiff":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}},"audio/mpeg":{"schema":{"type":"string","format":"binary"}},"audio/ogg":{"schema":{"type":"string","format":"binary"}},"audio/opus":{"schema":{"type":"string","format":"binary"}},"audio/flac":{"schema":{"type":"string","format":"binary"}},"audio/mp4":{"schema":{"type":"string","format":"binary"}},"audio/m4a":{"schema":{"type":"string","format":"binary"}},"audio/aac":{"schema":{"type":"string","format":"binary"}},"audio/webm":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/ProtectResult"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"},"504":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/restore":{"post":{"tags":["Native PII API v2"],"operationId":"restore","summary":"Restore originals in text and JSON with a map, a restore table or a session (free)","description":"Replaces the surrogates and labels of a protect call with the originals\n(`shinrai-restore/1`, the reference for client implementations).\n\n**Accepts** 1 to 256 `inputs` (`text`, or a JSON `value` whose string leaves are restored) and\none map: `mapping.known` (the `original`/`replacement` pairs of `mapping.delta`), `table` (a\nrestore table) or, on the hosted API, `session` (a session id).\n\n**Returns** `results[]` with the restored `text` or `value`, and `restored` (the number of\nreplacements). Not charged.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/restore -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"mapping\": {\"known\": [{\"original\": \"Anna Weber\", \"replacement\": \"Julia Brandt\"}]}, \"inputs\": [{\"id\": \"1\", \"text\": \"Julia Brandt replied.\"}]}'\n```\n","externalDocs":{"url":"https://goshinrai.com/docs/guides/v2#restore"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreRequest"},"examples":{"known":{"summary":"Restore a model answer with the pairs from mapping.delta","value":{"mapping":{"known":[{"original":"Anna Weber","replacement":"Julia Brandt"}]},"inputs":[{"id":"1","text":"Julia Brandt replied."}]}},"json":{"summary":"Restore the string leaves of a JSON value","value":{"mapping":{"known":[{"original":"anna@example.org","replacement":"lena@example.net"}]},"inputs":[{"id":"ticket","value":{"from":"lena@example.net","status":"open"}}]}}}}}},"responses":{"200":{"description":"Restored inputs. Not charged.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreResponse"},"example":{"results":[{"input_id":"1","text":"Anna Weber replied."}],"restored":1}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/restore-tables":{"post":{"tags":["Native PII API v2"],"operationId":"createRestoreTable","summary":"Compile a map into a restore table for your own or streaming restore (free)","description":"Compiles a map into a `shinrai-restore/1` table. Use it to restore in your own code, for\nexample token by token in a streamed model answer. No text is processed. Not charged.\n\n**Accepts** `mapping.known` or, on the hosted API, `session`; `direction` (`restore`, the\ndefault, or `forward`, which applies the same replacements again); `variants` (case, name\nparts, transliteration, JSON-escaped forms; all on by default) and `markers`.\n\n**Returns** the table: `algorithm`, `keys` (`k` the replacement, `o` the original), the word\nclass and, for a session, `mapping_rev`.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/restore-tables -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" -d '{\"mapping\": {\"known\": [{\"original\": \"Anna Weber\", \"replacement\": \"Julia Brandt\"}]}}'\n```\n","externalDocs":{"url":"https://goshinrai.com/docs/guides/v2#restore"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreTablesRequest"},"example":{"mapping":{"known":[{"original":"Anna Weber","replacement":"Julia Brandt","type":"PERSON"}]}}}}},"responses":{"200":{"description":"Restore table for shinrai-restore/1. Not charged.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreTable"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/replacements":{"post":{"tags":["Native PII API v2"],"operationId":"createReplacement","summary":"Mint one replacement for a value and type you choose (free)","description":"Returns one replacement for a value and type, with the same rules as `/v2/protect`: realistic,\nunique, never equal to an original. Use it when you place replacements yourself.\n\n**Accepts** `value`, `type` (a canonical type from `/v2/types`), optional `language`, an\n`action` (default `surrogate`) and a `mapping` block (`known` pairs keep their replacement,\n`reserved` replacements are avoided).\n\n**Returns** `replacement` and its mapping `entry` (original, replacement, type, reversible).\nNot charged.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/replacements -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" -d '{\"value\": \"Anna Weber\", \"type\": \"PERSON\", \"language\": \"de\"}'\n```\n","externalDocs":{"url":"https://goshinrai.com/docs/guides/v2#restore"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplacementRequest"},"example":{"value":"Anna Weber","type":"PERSON","language":"de"}}}},"responses":{"200":{"description":"The replacement and its mapping entry. Not charged.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplacementResponse"},"example":{"replacement":"Julia Brandt","entry":{"id":"mp_1","type":"PERSON","original":"Anna Weber","replacement":"Julia Brandt","reversible":true}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/sessions":{"post":{"tags":["Native PII API v2"],"operationId":"createSession","summary":"Create a server-held map that lives at most 24 hours by default, up to 7 days with extended sessions (free)","description":"Creates a session: one map of originals and replacements on the server. `mapping.session` on\ndetect and protect uses and extends it, so a value keeps its surrogate across requests.\n`/v2/restore` and `/v2/restore-tables` accept `session` instead of a map. The map is stored\nencrypted and only your key can read it. See `capabilities.sessions`,\n`capabilities.limits.sessions_max_ttl_s` and `capabilities.limits.sessions_max_lifetime_s`.\n\n**Accepts** an optional `ttl_s` (60 to 86,400 seconds, default 3,600) and `known` pairs to\nstart with. **Returns** 201 with the session id, `mapping_rev`, `entries`, `expires_at` and\n`max_expires_at`, and a `Location` header.\n\n**Lifetime**: a session lives at most until `max_expires_at`: 24 hours after its creation by\ndefault, or up to 7 days when the account enables extended sessions\n(`capabilities.limits.sessions_max_lifetime_s`). `ttl_s` sets `expires_at`, and `expires_at`\nnever passes `max_expires_at`: on create, a longer `ttl_s` is shortened; on PATCH, it answers\n422. The service deletes an expired session and its map.\n\n```bash\ncurl -s -X POST https://api.goshinrai.com/v2/sessions -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" -d '{\"ttl_s\": 3600}'\n```\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionCreate"},"example":{"ttl_s":3600,"known":[{"original":"Anna Weber","replacement":"Julia Brandt","type":"PERSON"}]}}}},"responses":{"201":{"description":"Session created.","headers":{"Location":{"$ref":"#/components/headers/Location"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"},"example":{"id":"ses_7f3a9c","mapping_rev":1,"entries":1,"created_at":"2026-09-29T08:00:00Z","expires_at":"2026-09-29T09:00:00Z","max_expires_at":"2026-09-30T08:00:00Z"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/sessions/{session_id}":{"parameters":[{"$ref":"#/components/parameters/SessionId"}],"get":{"tags":["Native PII API v2"],"operationId":"getSession","summary":"Session metadata (size, revision, expiry); no originals","description":"Returns the session's `mapping_rev`, the number of `entries`, `created_at`, `expires_at` and\n`max_expires_at`. An expired session answers 410 `session_expired`, later 404. Free.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/sessions/$SESSION -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"200":{"description":"Session metadata. No originals.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"},"example":{"id":"ses_7f3a9c","mapping_rev":4,"entries":3,"created_at":"2026-09-29T08:00:00Z","expires_at":"2026-09-29T09:00:00Z","max_expires_at":"2026-09-30T08:00:00Z"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]},"patch":{"tags":["Native PII API v2"],"operationId":"updateSession","summary":"Add known pairs or reserved replacements, or change the time to live","description":"Adds `known` pairs, adds `reserved` replacements (new surrogates avoid them) or sets a new\n`ttl_s` from now. A `ttl_s` that would move `expires_at` past `max_expires_at` answers 422\n`validation_failed` (pointer `/ttl_s`) with `max_expires_at` and `max_ttl_s`, the seconds that\nremain. Send `expected_rev` to detect a concurrent change: a different current revision\nanswers 409 `rev_conflict`. Free.\n\n```bash\ncurl -s -X PATCH https://api.goshinrai.com/v2/sessions/$SESSION -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" -d '{\"reserved\": [\"Julia Brandt\"], \"ttl_s\": 7200}'\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionPatch"},"example":{"known":[{"original":"Max Mustermann","replacement":"Paul Richter","type":"PERSON"}],"reserved":["Julia Brandt"],"expected_rev":4}}}},"responses":{"200":{"description":"Updated session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]},"delete":{"tags":["Native PII API v2"],"operationId":"deleteSession","summary":"Delete the session and its map","description":"Deletes the session and its map at once. Free.\n\n```bash\ncurl -s -X DELETE https://api.goshinrai.com/v2/sessions/$SESSION -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"204":{"description":"Deleted. The map is gone."},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/sessions/{session_id}/mapping":{"parameters":[{"$ref":"#/components/parameters/SessionId"}],"get":{"tags":["Native PII API v2"],"operationId":"exportSessionMapping","summary":"Export the session map (contains originals)","description":"Returns every entry of the session map as `full` (original, replacement, type) with the\nrevision `rev`. The answer contains originals: store it as sensitive data. Free.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/sessions/$SESSION/mapping -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"200":{"description":"Mapping entries.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingResult"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/sessions/{session_id}/restore-table":{"parameters":[{"$ref":"#/components/parameters/SessionId"}],"get":{"tags":["Native PII API v2"],"operationId":"getSessionRestoreTable","summary":"Restore table of the session map","description":"Compiles the session map into a `shinrai-restore/1` table, as `/v2/restore-tables` does.\n`direction=forward` returns the table that applies the replacements. Free.\n\n```bash\ncurl -s \"https://api.goshinrai.com/v2/sessions/$SESSION/restore-table?direction=restore\" -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","parameters":[{"name":"direction","in":"query","description":"restore (replacement to original, default) or forward (original to replacement).","schema":{"type":"string","enum":["restore","forward"],"default":"restore"}}],"responses":{"200":{"description":"Restore table.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreTable"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/uploads":{"post":{"tags":["Native PII API v2"],"operationId":"createUpload","summary":"Upload a file for a job (encrypted at rest, deleted when its last job ends)","description":"Stores one file for a job. Send the file as the body with its content type: JSONL\n(`application/x-ndjson`) for a text batch, a PDF or DOCX file for a document, a recording\n(`audio/mpeg`, `audio/wav`, ...) for an audio job. The content type is kept and the job reads\nit.\n\n**Returns** 201 with the upload `id`, `media_type`, `bytes`, `sha256`, `expires_at` and\n`retain_until_expiry`. An upload is at most `capabilities.limits.jobs_upload_max_bytes`\n(hosted API: 50,000,000 bytes); a larger one answers 413 `too_large`. Only your key can read\nor use the upload.\n\n**Retention**: an upload is deleted as soon as the last job that reads it ends (succeeded,\nfailed or cancelled). Add `?keep=true` when several jobs will read one upload: it then stays\nuntil `expires_at` (24 hours, extended by every job that reads it), and\n`DELETE /v2/jobs/{job_id}` still removes it. An upload that no job reads is deleted after\n24 hours. With `capabilities.limits.jobs_account_max_uploads` live uploads, the next upload\nanswers 429 `rate_limited`.\n\nA text batch has one JSON object per line: `custom_id` and either `text` or `input` (a `text`,\n`table` or `json` input), optionally `language`:\n\n```jsonl\n{\"custom_id\": \"row-1\", \"text\": \"Anna Schmidt, anna@example.com\"}\n{\"custom_id\": \"row-2\", \"text\": \"Call +49 30 1234567\", \"language\": \"de\"}\n```\n\n```bash\ncurl -s https://api.goshinrai.com/v2/uploads -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/x-ndjson\" --data-binary @rows.jsonl\ncurl -s \"https://api.goshinrai.com/v2/uploads?keep=true\" -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/pdf\" --data-binary @contract.pdf\n```\n","externalDocs":{"url":"https://goshinrai.com/docs/guides/v2#jobs"},"parameters":[{"name":"keep","in":"query","required":false,"description":"true: keep the upload until `expires_at` (24 hours, extended by every job that reads it). false (default): delete it when the last job that reads it ends.","schema":{"type":"boolean","default":false}}],"requestBody":{"required":true,"content":{"application/x-ndjson":{"schema":{"type":"string","format":"binary"}},"application/pdf":{"schema":{"type":"string","format":"binary"}},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{"schema":{"type":"string","format":"binary"}},"audio/mpeg":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}},"application/octet-stream":{"schema":{"type":"string","contentMediaType":"application/octet-stream"}}}},"responses":{"201":{"description":"Upload stored.","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Upload"},"example":{"id":"up_4d1c9e0b7a2f4e6c8b3a5d7f9e1c2b4a","media_type":"application/x-ndjson","bytes":132,"sha256":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08","expires_at":"2026-09-30T08:00:00Z","retain_until_expiry":false}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/jobs":{"post":{"tags":["Native PII API v2"],"operationId":"createJob","summary":"Start a job for a text batch, a PDF or DOCX document or an audio recording","description":"Starts an asynchronous job at the batch tier (weight 0.5). The service checks the whole input\nbefore it answers 202, so an error names the line (`/lines/2/custom_id`).\n`capabilities.inputs.*.jobs` shows which kinds a deployment serves.\n\n| `kind` | `inputs` | Artifacts |\n|---|---|---|\n| `text_batch` | one `{\"kind\": \"file\", \"source\": {\"upload\": ...}}` with JSONL lines (`custom_id` and `text` or `input`), or inline `text`, `table` and `json` inputs | `protected`, `entities`, `mapping` (JSONL, one line per input) |\n| `document` | one `file` input: a PDF or DOCX upload | `protected` (the redacted PDF), `text` (the protected extracted text), `entities`, `mapping` (JSON) |\n| `audio` | one `{\"kind\": \"audio\", \"source\": {\"upload\": ...}}` input, up to `capabilities.limits.audio_jobs_max_seconds` and `audio_jobs_max_bytes` | `protected` (the redacted WAV), `transcript`, `entities` (JSON) |\n\n`image` and `video` jobs answer 501 `capability_unavailable` where they are not served.\n`output.artifacts` selects the artifacts; a job without `protected`, `text` or `mapping` only\ndetects.\n`detection`, `policy` and `mapping` work as on `/v2/protect`; `policy.media.audio` sets `op`\nand `pad_ms` for audio. The balance must cover a text batch when you submit it (402\n`insufficient_records`). A document costs the records of its extracted text; audio the records\nof its transcript, at least 10 records per started minute; both at the batch weight 0.5. A\nretry with the same `Idempotency-Key` and body returns the same job.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/jobs -H \"Authorization: Bearer $SHINRAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" -H \"Idempotency-Key: rows-2026-09-29\" \\\n  -d '{\"kind\": \"text_batch\", \"inputs\": [{\"kind\": \"file\", \"source\": {\"upload\": \"up_...\"}}], \"output\": {\"artifacts\": [\"protected\", \"entities\"]}}'\ncurl -s https://api.goshinrai.com/v2/jobs -H \"Authorization: Bearer $SHINRAI_API_KEY\" -H \"Content-Type: application/json\" \\\n  -d '{\"kind\": \"audio\", \"inputs\": [{\"kind\": \"audio\", \"source\": {\"upload\": \"up_...\"}, \"language\": \"de\"}]}'\n```\n","externalDocs":{"url":"https://goshinrai.com/docs/guides/v2#jobs"},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCreate"},"examples":{"text_batch":{"summary":"A JSONL upload, protected text and entities","value":{"kind":"text_batch","inputs":[{"kind":"file","source":{"upload":"up_4d1c9e0b7a2f4e6c8b3a5d7f9e1c2b4a"}}],"output":{"artifacts":["protected","entities"]}}},"inline":{"summary":"A few texts inline, no upload","value":{"kind":"text_batch","inputs":[{"id":"a","kind":"text","text":"Anna Weber called."},{"id":"b","kind":"text","text":"Mail max@example.org"}],"policy":{"preset":"mask"}}},"document":{"summary":"A PDF or DOCX upload; the redacted PDF, the protected text and the entities","value":{"kind":"document","inputs":[{"kind":"file","source":{"upload":"up_8b2e4f6a1c3d5e7f9a0b2c4d6e8f0a1b"}}],"output":{"artifacts":["protected","text","entities"]}}},"audio":{"summary":"A recording up to 60 minutes, silenced instead of bleeped","value":{"kind":"audio","inputs":[{"kind":"audio","source":{"upload":"up_1a3c5e7f9b0d2f4a6c8e0a2c4e6a8c0e"},"language":"de"}],"policy":{"media":{"audio":{"op":"silence","pad_ms":200}}}}}}}}},"responses":{"202":{"description":"Accepted. Poll the Location or GET /v2/jobs/{job_id}.","headers":{"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"job_5e2a","kind":"text_batch","status":"queued","created_at":"2026-09-29T08:00:00Z","updated_at":"2026-09-29T08:00:00Z","expires_at":"2026-09-30T08:00:00Z","progress":{"done":0,"total":3},"usage":{"records":0,"weighted_records":0,"tier":"batch","charged":false}}}}},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]},"get":{"tags":["Native PII API v2"],"operationId":"listJobs","summary":"The jobs of your account, newest first","description":"Lists up to 50 jobs per page. Pass `next` of the answer as `after` for the next page, and\n`status` to filter.\n\n```bash\ncurl -s \"https://api.goshinrai.com/v2/jobs?status=succeeded\" -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","parameters":[{"name":"status","in":"query","description":"Only jobs in this state.","schema":{"type":"string","enum":["queued","running","succeeded","failed","cancelled"]}},{"name":"after","in":"query","description":"The next cursor of the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Jobs of the caller.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobList"}}}},"401":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/jobs/{job_id}":{"parameters":[{"$ref":"#/components/parameters/JobId"}],"get":{"tags":["Native PII API v2"],"operationId":"getJob","summary":"Job state, progress, usage and artifact links","description":"`status` goes `queued`, `running`, then `succeeded`, `failed` or `cancelled`. `progress` counts\nthe done and total inputs. When the job has ended, `artifacts` maps each artifact name to its\ndownload path, `usage` shows the charge and `error` the reason of a failure. While the job\nruns, the answer carries `Retry-After`. Another account's job answers 404.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/jobs/$JOB -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"200":{"description":"Job state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"job_5e2a","kind":"audio","status":"succeeded","created_at":"2026-09-29T08:00:00Z","updated_at":"2026-09-29T08:03:10Z","expires_at":"2026-09-30T08:00:00Z","progress":{"done":1,"total":1},"artifacts":{"protected":"/v2/jobs/job_5e2a/artifacts/protected","transcript":"/v2/jobs/job_5e2a/artifacts/transcript","entities":"/v2/jobs/job_5e2a/artifacts/entities"},"usage":{"records":6,"weighted_records":6,"tier":"batch","charged":true}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]},"delete":{"tags":["Native PII API v2"],"operationId":"deleteJob","summary":"Delete the job, its uploads and its artifacts","description":"Stops the job if it runs and deletes the job, its uploads and its artifacts at once. This\nalso deletes an upload created with `keep=true`. An upload that another queued or running\njob reads is deleted when that job ends. Completed parts stay charged.\n\n```bash\ncurl -s -X DELETE https://api.goshinrai.com/v2/jobs/$JOB -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/jobs/{job_id}/cancel":{"parameters":[{"$ref":"#/components/parameters/JobId"}],"post":{"tags":["Native PII API v2"],"operationId":"cancelJob","summary":"Cancel a job; completed parts stay charged, artifacts are deleted","description":"Stops a queued or running job and deletes its results. Its uploads follow the rule for a\nfinished job: an upload that no other job reads is deleted, unless it was created with\n`keep=true`. Completed parts stay charged.\n\n```bash\ncurl -s -X POST https://api.goshinrai.com/v2/jobs/$JOB/cancel -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"202":{"description":"Cancellation accepted. Completed parts stay charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/jobs/{job_id}/artifacts/{name}":{"parameters":[{"$ref":"#/components/parameters/JobId"},{"name":"name","in":"path","required":true,"description":"An artifact the job lists in `artifacts`.","schema":{"type":"string","enum":["protected","text","entities","mapping","redaction_plan","transcript","audit"]}}],"get":{"tags":["Native PII API v2"],"operationId":"getJobArtifact","summary":"Download a job artifact","description":"Streams one artifact as an attachment. The media type depends on the job kind:\n\n| Job kind | `protected` | `text` | `entities` | `mapping` | `transcript` |\n|---|---|---|---|---|---|\n| `text_batch` | JSONL: `custom_id`, `status`, `output`, `entities` (or `error`) | | JSONL: `custom_id`, `status`, `entities` | JSONL (contains originals) | |\n| `document` | `application/pdf`, the redacted PDF (`protected.pdf`) | `text/plain`, the protected extracted text | JSON: entities with offsets into the extracted text | JSON (contains originals) | |\n| `audio` | `audio/wav`, the redacted recording (`redacted.wav`) | | JSON: `entities` with `coords.intervals`, `intervals` | | JSON: `language`, `duration_s`, the protected transcript `text` |\n\nThe redacted PDF has image-only pages rendered at 144 dpi, a black box over every entity whose\naction is not `keep`, and no text layer. A DOCX document is converted to PDF first.\n`redaction_plan` for documents answers 501 `capability_unavailable`. A job that has not ended\nanswers 404 with `retryable: true`.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/jobs/$JOB/artifacts/protected -H \"Authorization: Bearer $SHINRAI_API_KEY\" -o protected.jsonl\n```\n","responses":{"200":{"description":"Artifact bytes (media type depends on the job kind and the artifact).","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"},"Content-Disposition":{"schema":{"type":"string"},"description":"attachment; filename=\"<artifact>.<ext>\" (redacted.wav for audio, protected.pdf for documents)."}},"content":{"application/x-ndjson":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object"}},"text/plain":{"schema":{"type":"string"}},"application/pdf":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}},"application/octet-stream":{"schema":{"type":"string","contentMediaType":"application/octet-stream"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/capabilities":{"get":{"tags":["Native PII API v2"],"operationId":"getCapabilities","summary":"What this deployment serves (input kinds, tiers, models, languages, OCR, audio, limits)","description":"Read it once at start. Status values: `ga` (served), `upcoming` (announced, not served yet),\n`planned` (in the contract, not served), `unavailable` (not served by this deployment).\nTreat any other value as not served.\n\n- `inputs.<kind>`: the status per kind on the `standard` and `realtime` tiers and in `jobs`\n  (kinds `text`, `table`, `json`, `transcript`, `page`, `image`, `file`, `audio`, `video`).\n- `models`, `languages`, `offset_units`, `actions`, `vocabularies`, `restore`, `sessions`.\n- `ocr`: `available`, `languages`, `max_pixels`, `max_bytes`.\n- `limits`: integers. Per tier `<tier>_inputs`, `<tier>_chars` (per input) and `<tier>_total`\n  (per request); `image_*`; `sessions_max_ttl_s`, `sessions_max_entries`,\n  `sessions_max_lifetime_s` (for sessions of your key); `jobs_upload_max_bytes`,\n  `jobs_text_batch_max_lines`, `jobs_text_batch_max_bytes`, `jobs_document_max_bytes`,\n  `jobs_retention_s`, `jobs_account_budget_bytes` (job storage per account),\n  `jobs_account_max_uploads` (live uploads per account); `audio_standard_max_seconds`,\n  `audio_standard_max_bytes`, `audio_jobs_max_seconds`, `audio_jobs_max_bytes`.\n- Hosted and offline: `tiers` (the tiers your plan allows) and `metering` (unit, tier weights,\n  free routes, `image_minimum_records`, `audio_minimum_records_per_minute`).\n- `engine`: the default model and whether it can answer now (`ok`, `degraded`, `unavailable`).\n\n```bash\ncurl -s https://api.goshinrai.com/v2/capabilities -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"200":{"description":"Capabilities.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Capabilities"},"example":{"api_version":"2.0.0","profile":"public","mode":"global","models":[{"id":"v1.4","status":"ga","languages":["de","en"]}],"languages":["de","en"],"offset_units":["codepoint","utf16","utf8","grapheme"],"inputs":{"text":{"standard":"ga","realtime":"ga","jobs":"ga"},"image":{"standard":"ga","realtime":"ga","jobs":"planned"},"file":{"standard":"unavailable","realtime":"unavailable","jobs":"ga"},"audio":{"standard":"ga","realtime":"unavailable","jobs":"ga"},"video":{"standard":"upcoming","realtime":"upcoming","jobs":"planned"}},"actions":{"surrogate":"ga","label":"ga","mask":"ga","partial":"ga","generalize":"ga","replace":"ga","remove":"ga","keep":"ga"},"sessions":"ga","limits":{"standard_inputs":64,"standard_chars":200000,"standard_total":200000,"realtime_inputs":4,"realtime_chars":4000,"realtime_total":16000,"batch_inputs":200,"batch_chars":200000,"batch_total":200000,"sessions_max_ttl_s":86400,"sessions_max_lifetime_s":86400,"jobs_upload_max_bytes":50000000,"jobs_retention_s":86400,"jobs_account_budget_bytes":1000000000,"jobs_account_max_uploads":200,"audio_standard_max_seconds":300,"audio_standard_max_bytes":12582912,"audio_jobs_max_seconds":3600,"audio_jobs_max_bytes":50000000},"restore":{"algorithms":["shinrai-restore/1"],"word_classes":["shinrai-word/1"]},"tiers":{"standard":"allowed","batch":"allowed","realtime":"not_in_plan"},"metering":{"unit":"records of 1000 characters","image_minimum_records":1,"audio_minimum_records_per_minute":10,"weights":{"standard":1,"realtime":1.6,"batch":0.5},"free":["restore","restore-tables","replacements","capabilities","types","usage","sessions"]},"ocr":{"available":true,"languages":["de","en"],"max_pixels":40000000,"max_bytes":6291456},"engine":{"model":"v1.4","status":"ok"}}}}},"401":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/types":{"get":{"tags":["Native PII API v2"],"operationId":"getTypes","summary":"Canonical entity types and the vendor vocabularies","description":"Lists the types this deployment returns with a description, a group, `personal` (false for\nyears, amounts, legal references and bias terms; those come back as `annotations`) and\n`since` for types of a newer model. `vocabularies` maps the names of Google, AWS, Azure and\nPresidio to canonical types; use them with `detection.types.vocabulary`. Free.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/types -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"200":{"description":"Types.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypesResponse"}}}},"401":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}},"/v2/usage":{"get":{"tags":["Native PII API v2"],"operationId":"getUsage","summary":"Plan, available records and the last 30 days of your key (hosted and offline)","description":"Returns `plan`, `available_records` and `last_30_days` (records and requests per tier). Free.\n\n```bash\ncurl -s https://api.goshinrai.com/v2/usage -H \"Authorization: Bearer $SHINRAI_API_KEY\"\n```\n","responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}},"401":{"$ref":"#/components/responses/Error"},"501":{"$ref":"#/components/responses/Error"}},"security":[{"BearerApiKey":[]}]}}},"components":{"schemas":{"Capabilities":{"$ref":"#/components/schemas/PiiV2Capabilities"},"DetectRequest":{"$ref":"#/components/schemas/PiiV2DetectRequest"},"ErrorResponse":{"$ref":"#/components/schemas/PiiV2ErrorResponse"},"Id":{"$ref":"#/components/schemas/PiiV2Id"},"Job":{"$ref":"#/components/schemas/PiiV2Job"},"JobCreate":{"$ref":"#/components/schemas/PiiV2JobCreate"},"JobList":{"$ref":"#/components/schemas/PiiV2JobList"},"MappingResult":{"$ref":"#/components/schemas/PiiV2MappingResult"},"ProtectRequest":{"$ref":"#/components/schemas/PiiV2ProtectRequest"},"ReplacementRequest":{"$ref":"#/components/schemas/PiiV2ReplacementRequest"},"ReplacementResponse":{"$ref":"#/components/schemas/PiiV2ReplacementResponse"},"RestoreRequest":{"$ref":"#/components/schemas/PiiV2RestoreRequest"},"RestoreResponse":{"$ref":"#/components/schemas/PiiV2RestoreResponse"},"RestoreTable":{"$ref":"#/components/schemas/PiiV2RestoreTable"},"RestoreTablesRequest":{"$ref":"#/components/schemas/PiiV2RestoreTablesRequest"},"Result":{"$ref":"#/components/schemas/PiiV2Result"},"Session":{"$ref":"#/components/schemas/PiiV2Session"},"SessionCreate":{"$ref":"#/components/schemas/PiiV2SessionCreate"},"SessionPatch":{"$ref":"#/components/schemas/PiiV2SessionPatch"},"TypesResponse":{"$ref":"#/components/schemas/PiiV2TypesResponse"},"Upload":{"$ref":"#/components/schemas/PiiV2Upload"},"UsageResponse":{"$ref":"#/components/schemas/PiiV2UsageResponse"},"PiiV2Id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$","description":"Caller or service identifier. Never PII."},"PiiV2Language":{"type":"string","pattern":"^(auto|[a-z]{2,3}(-[A-Za-z0-9]{2,8})*)$","description":"BCP 47 language tag (lower-case primary subtag) or auto."},"PiiV2OffsetUnit":{"type":"string","enum":["codepoint","utf16","utf8","grapheme"],"description":"Unit of span offsets. codepoint is the default and the metering unit."},"PiiV2EntityType":{"type":"string","pattern":"^[A-Z][A-Z0-9_]{0,63}$","description":"Canonical type in UPPER_SNAKE (engine label space)."},"PiiV2Probability":{"type":"number","minimum":0,"maximum":1},"PiiV2Span":{"type":"object","additionalProperties":false,"required":["start","end"],"properties":{"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0},"extra":{"type":"object","additionalProperties":false,"properties":{"utf16":{"$ref":"#/components/schemas/PiiV2Range"},"utf8":{"$ref":"#/components/schemas/PiiV2Range"},"grapheme":{"$ref":"#/components/schemas/PiiV2Range"},"codepoint":{"$ref":"#/components/schemas/PiiV2Range"}},"description":"The same span in the extra offset units the request asked for."}},"description":"Half-open [start, end) in the request's offset unit."},"PiiV2Range":{"type":"object","additionalProperties":false,"required":["start","end"],"properties":{"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}}},"PiiV2Interval":{"type":"object","additionalProperties":false,"required":["t0","t1"],"properties":{"t0":{"type":"number","minimum":0},"t1":{"type":"number","minimum":0}},"description":"Time interval in the input's time unit."},"PiiV2Box":{"type":"object","additionalProperties":false,"required":["page","box"],"properties":{"page":{"type":"integer","minimum":1},"box":{"type":"array","items":{"type":"number"},"minItems":4,"maxItems":4,"description":"[x, y, width, height] in the input's box unit."},"t0":{"type":"number","minimum":0},"t1":{"type":"number","minimum":0}},"description":"Page or frame box; video boxes carry a time interval."},"PiiV2Cell":{"type":"object","additionalProperties":false,"required":["row","column"],"properties":{"row":{"type":"integer","minimum":0},"column":{"type":"string"}}},"PiiV2Coords":{"type":"object","additionalProperties":false,"properties":{"intervals":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Interval"}},"boxes":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Box"}},"cell":{"$ref":"#/components/schemas/PiiV2Cell"},"path":{"type":"string","description":"JSON Pointer (RFC 6901) into a json input."}},"description":"Where an entity sits in a non-text input (text plus coordinate atoms)."},"PiiV2KeyRef":{"type":"object","additionalProperties":false,"required":["ref"],"properties":{"ref":{"type":"string","pattern":"^(kms|vault|local):[A-Za-z0-9._/-]{1,200}$"}},"description":"Reference to key material held by the deployment. Key bytes never travel in a request."},"PiiV2Status":{"type":"string","enum":["ga","upcoming","planned","unavailable"],"description":"ga: served. upcoming: announced, not served yet. planned: in the contract, not served. unavailable: not served by this deployment. Clients treat any other value as not served."},"PiiV2Detection":{"oneOf":[{"type":"object","additionalProperties":false,"required":["template"],"properties":{"template":{"$ref":"#/components/schemas/PiiV2Id"}}},{"$ref":"#/components/schemas/PiiV2DetectionOptions"}]},"PiiV2DetectionOptions":{"type":"object","additionalProperties":false,"properties":{"mode":{"type":"string","enum":["detect","provided","merge"],"default":"detect","description":"detect: the service finds entities. provided: only caller spans (no model call). merge: both."},"model":{"type":"string","pattern":"^(latest|v[0-9]+\\.[0-9]+)$","default":"latest"},"language":{"$ref":"#/components/schemas/PiiV2Language"},"types":{"type":"object","additionalProperties":false,"properties":{"include":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128}},"exclude":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128}},"vocabulary":{"type":"string","pattern":"^(canonical|azure:[0-9a-z.-]+|aws|google|presidio)$","default":"canonical"}}},"thresholds":{"type":"object","additionalProperties":false,"properties":{"default":{"$ref":"#/components/schemas/PiiV2Probability"},"per_type":{"type":"object","propertyNames":{"$ref":"#/components/schemas/PiiV2EntityType"},"additionalProperties":{"$ref":"#/components/schemas/PiiV2Probability"}},"per_language":{"type":"object","propertyNames":{"$ref":"#/components/schemas/PiiV2Language"},"additionalProperties":{"$ref":"#/components/schemas/PiiV2Probability"}}}},"recognizers":{"type":"object","additionalProperties":false,"properties":{"model":{"type":"boolean","default":true},"pattern":{"type":"boolean","default":true},"validated_identifiers":{"type":"boolean","default":true,"description":"Checksum-validated identifiers (IBAN, Luhn, SSN, DE tax id, VIN, ...)."},"bias_terms":{"type":"boolean","default":false},"carrier":{"type":"array","items":{"type":"string","enum":["face","license_plate","signature","voice"]},"description":"Carrier PII in media. Planned."}}},"validation":{"type":"string","enum":["strict","off"],"default":"strict"},"exclude_values":{"type":"object","additionalProperties":false,"required":["values"],"properties":{"values":{"type":"array","items":{"type":"string","minLength":1}},"case_sensitive":{"type":"boolean","default":false}}},"context_terms":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["type","terms"],"properties":{"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"terms":{"type":"array","items":{"type":"string","minLength":1}},"language":{"$ref":"#/components/schemas/PiiV2Language"}}}},"custom":{"type":"object","additionalProperties":false,"properties":{"user_values":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["value"],"properties":{"value":{"type":"string","minLength":1},"label":{"type":"string","maxLength":128},"type":{"$ref":"#/components/schemas/PiiV2EntityType"}}}},"regex":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["name","type","pattern"],"properties":{"name":{"type":"string","maxLength":128},"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"pattern":{"type":"string","maxLength":1024,"description":"RE2 syntax; evaluated with a time budget."},"score":{"$ref":"#/components/schemas/PiiV2Probability"},"hotwords":{"type":"object","additionalProperties":false,"properties":{"terms":{"type":"array","items":{"type":"string"}},"window":{"type":"integer","minimum":1,"maximum":200},"boost":{"type":"number"}}},"exclusions":{"type":"array","items":{"type":"string","maxLength":1024}}}}},"dictionaries":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["name","type"],"properties":{"name":{"type":"string","maxLength":128},"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"terms":{"type":"array","items":{"type":"string","minLength":1}},"ref":{"type":"string","pattern":"^stored:[A-Za-z0-9._-]{1,128}$"}}}},"zero_shot":{"type":"object","additionalProperties":false,"required":["labels"],"properties":{"labels":{"type":"array","minItems":1,"maxItems":32,"items":{"type":"string","minLength":1,"maxLength":64}},"threshold":{"$ref":"#/components/schemas/PiiV2Probability"}}}}},"spans":{"type":"object","additionalProperties":false,"properties":{"merge_persons":{"type":"boolean","default":true},"complete":{"type":"boolean","default":true,"description":"A model span that starts or ends inside a word covers the whole word. An edge next to a hyphen or apostrophe, and a start after a Hebrew or Arabic prefix such as \"and\" or \"in\", stay where the model put them. Text in scripts without spaces between words (Chinese, Japanese, Korean, Thai, Lao, Khmer, Myanmar) is unchanged. `false`: the spans as the model decoded them."},"complete_names":{"type":"boolean","default":true,"description":"Protect every occurrence of a detected value in the batch."},"sweep_repeats":{"type":"boolean","default":true},"segment":{"type":"string","enum":["auto","sentence","none"],"default":"auto","description":"How the model reads long texts: `auto` (whole text up to 1,200 characters, above that also per sentence), `sentence` (always per sentence as well), `none` (whole text only)."}}},"engine_options":{"type":"object","additionalProperties":false,"description":"Reserved for operator tuning; answers 403 forbidden_scope for API keys.","properties":{"reflow":{"type":"boolean"},"recall_floor":{"$ref":"#/components/schemas/PiiV2Probability"},"decoder_settings":{"type":"object"}}},"ocr":{"type":"object","additionalProperties":false,"description":"Options of the packaged OCR for image inputs.","properties":{"languages":{"type":"array","minItems":1,"maxItems":4,"uniqueItems":true,"items":{"$ref":"#/components/schemas/PiiV2Language"},"description":"OCR language packs (BCP 47 primary subtags). Default: the input or detection language plus English when a pack exists for it, else the deployment's fallback set (default de and en). capabilities.ocr.languages lists the provisioned packs. A pack the deployment does not provision answers 422."},"min_confidence":{"type":"integer","minimum":0,"maximum":100,"default":0,"description":"Drop OCR words below this recogniser confidence. 0 keeps every word."},"layout":{"type":"string","enum":["block","auto","line"],"default":"block","description":"block: one uniform text block (screenshots, forms). auto: automatic page segmentation (scans with columns). line: a single text line."}}}}},"PiiV2Entity":{"type":"object","additionalProperties":false,"required":["id","type","span","confidence","source"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"subtype":{"type":"string","pattern":"^[A-Z][A-Z0-9_]{0,63}$","description":"Open refinement, for example US_SSN, DE_TAX_ID, VIN."},"vendor_type":{"type":"string","maxLength":128,"description":"Type in the requested vocabulary, when one was requested."},"span":{"$ref":"#/components/schemas/PiiV2Span"},"text":{"type":"string","description":"Present only when output.include_text is true."},"confidence":{"$ref":"#/components/schemas/PiiV2Probability"},"evidence":{"type":"string","enum":["argmax","floor"],"description":"Model entities only: argmax = the model's decision; floor = rescued by the recall floor, confidence is the entity mass. Treat floor spans by your own policy."},"tier":{"type":"string","pattern":"^[a-z][a-z_]{0,31}$","description":"How common the value is, for example names common|uncommon|rare, cities major|medium|small, organisations international|national|regional; std for format types. Model entities only."},"validated":{"type":"boolean","description":"A checksum or format validator accepted the value."},"source":{"type":"string","enum":["model","pattern","user_value","custom_regex","dictionary","zero_shot","known_value","name_completion","bias","carrier","provided"]},"detector":{"type":"string","maxLength":128},"attrs":{"type":"object","additionalProperties":false,"properties":{"origin":{"type":"string","maxLength":32},"gender_expression":{"type":"string","enum":["feminine","masculine","neutral","unknown"]},"name_part":{"type":"string","enum":["given","family","full","other"]}}},"coords":{"$ref":"#/components/schemas/PiiV2Coords"},"action":{"type":"string"},"replacement":{"type":"string"},"mapping_id":{"$ref":"#/components/schemas/PiiV2Id"},"output_span":{"$ref":"#/components/schemas/PiiV2Span"}}},"PiiV2ErrorCode":{"type":"string","enum":["unauthorized","insufficient_records","forbidden_scope","not_found","method_not_allowed","idempotency_conflict","mapping_conflict","session_expired","too_large","validation_failed","rate_limited","capability_unavailable","degraded_refused","backend_unavailable","deadline_exceeded","internal_error","invalid_key","no_active_plan","tier_not_allowed","key_limit","rev_conflict","queue_full","queue_timeout","processing_timeout","billing_unavailable"],"description":"The hosted API answers invalid_key (401) for a missing, invalid or revoked key, no_active_plan, tier_not_allowed and key_limit (403) for plan limits, rev_conflict (409) for a changed session, queue_full and queue_timeout (503) when a lane is busy, processing_timeout (504) and billing_unavailable (503)."},"PiiV2ErrorResponse":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"object","additionalProperties":false,"required":["code","message","request_id","retryable"],"properties":{"code":{"$ref":"#/components/schemas/PiiV2ErrorCode"},"message":{"type":"string","maxLength":512,"description":"Human-readable. Never echoes input values."},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"processing_started":{"type":"boolean"},"charged":{"type":"boolean"},"use":{"type":"string","description":"Alternative resource, for example /v2/jobs on too_large."},"retry_after":{"type":"integer","description":"Seconds to wait; the Retry-After header carries the same value."},"limit_name":{"type":"string","description":"The limit that a 413 too_large or a 429 rate_limited reached, for example max_input_chars, max_audio_seconds, jobs_account_budget_bytes or jobs_account_max_uploads."},"limit":{"type":"integer"},"supplied":{"type":"integer"},"item_index":{"type":"integer","minimum":0},"records_required":{"type":"number"},"records_available":{"type":"number"},"purchase_url":{"type":"string"},"upgrade_url":{"type":"string"},"allowed_tiers":{"type":"array","items":{"type":"string"}},"requested_tier":{"type":"string"},"current_rev":{"type":"integer","minimum":0},"max_expires_at":{"type":"string","format":"date-time","description":"A 422 for a session ttl_s: the end of the session's maximum lifetime."},"max_ttl_s":{"type":"integer","minimum":0,"description":"A 422 for a session ttl_s: the largest ttl_s that the session still accepts."},"details":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["pointer","reason"],"properties":{"pointer":{"type":"string","description":"JSON Pointer into the request."},"reason":{"type":"string","maxLength":256}}}}}}}},"PiiV2Input":{"oneOf":[{"$ref":"#/components/schemas/PiiV2TextInput"},{"$ref":"#/components/schemas/PiiV2TableInput"},{"$ref":"#/components/schemas/PiiV2JsonInput"},{"$ref":"#/components/schemas/PiiV2TranscriptInput"},{"$ref":"#/components/schemas/PiiV2PageInput"},{"$ref":"#/components/schemas/PiiV2ImageInput"},{"$ref":"#/components/schemas/PiiV2FileInput"},{"$ref":"#/components/schemas/PiiV2AudioInput"},{"$ref":"#/components/schemas/PiiV2VideoInput"}],"discriminator":{"propertyName":"kind"}},"PiiV2TextInput":{"type":"object","additionalProperties":false,"required":["kind","text"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"text"},"text":{"type":"string"},"language":{"$ref":"#/components/schemas/PiiV2Language"},"entities":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2ProvidedEntity"}}}},"PiiV2ProvidedEntity":{"type":"object","additionalProperties":false,"required":["type","span"],"properties":{"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"span":{"$ref":"#/components/schemas/PiiV2Span"},"confidence":{"$ref":"#/components/schemas/PiiV2Probability"},"vendor_type":{"type":"string","maxLength":128}},"description":"Caller spans for detection.mode provided or merge (for example Presidio analyzer_results)."},"PiiV2TableInput":{"type":"object","additionalProperties":false,"required":["kind","columns","rows"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"table"},"columns":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1},"language":{"$ref":"#/components/schemas/PiiV2Language"}}}},"rows":{"type":"array","items":{"type":"array","items":{"type":["string","number","boolean","null"]}}},"language":{"$ref":"#/components/schemas/PiiV2Language"}}},"PiiV2JsonInput":{"type":"object","additionalProperties":false,"required":["kind","value"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"json"},"value":{},"include_keys":{"type":"boolean","default":false,"description":"Also inspect object keys. Keys are never used as map keys in the output."},"language":{"$ref":"#/components/schemas/PiiV2Language"}},"description":"Tool-call plane: every string leaf is inspected; entity coords carry a JSON Pointer."},"PiiV2TranscriptInput":{"type":"object","additionalProperties":false,"required":["kind","forms"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"transcript"},"speaker":{"type":"string","maxLength":64},"primary_form":{"type":"string","enum":["display","itn","masked_itn","lexical"],"default":"display"},"forms":{"type":"object","additionalProperties":false,"required":["display"],"properties":{"display":{"type":"string"},"itn":{"type":"string"},"masked_itn":{"type":"string"},"lexical":{"type":"string"}}},"atoms_form":{"type":"string","enum":["display","itn","masked_itn","lexical"],"default":"lexical"},"time_unit":{"type":"string","enum":["100ns","ms","s"],"default":"100ns"},"atoms":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["text","t0","t1"],"properties":{"text":{"type":"string"},"t0":{"type":"number","minimum":0},"t1":{"type":"number","minimum":0}}}},"language":{"$ref":"#/components/schemas/PiiV2Language"},"entities":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2ProvidedEntity"},"description":"Caller spans on the primary form."}},"description":"Speech transcript with word timings (Azure conversation forms). redaction_plan.intervals maps entities to audio time."},"PiiV2PageInput":{"type":"object","additionalProperties":false,"required":["kind","text","atoms"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"page"},"text":{"type":"string"},"atoms":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["start","end","page","box"],"properties":{"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0},"page":{"type":"integer","minimum":1},"box":{"type":"array","items":{"type":"number"},"minItems":4,"maxItems":4}}},"description":"Word boxes of the text: each atom covers text[start:end] (code points, 0 <= start <= end <= len(text)) on a page, in box_unit. Entities get the boxes of every atom their span overlaps."},"box_unit":{"type":"string","enum":["pt","px","norm"],"default":"pt"},"language":{"$ref":"#/components/schemas/PiiV2Language"},"entities":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2ProvidedEntity"}}},"description":"Extracted page text plus word boxes (OCR or PDF text layer)."},"PiiV2ImageInput":{"type":"object","additionalProperties":false,"required":["kind","media_type","data_b64"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"image"},"media_type":{"type":"string","enum":["image/png","image/jpeg","image/bmp","image/tiff","image/webp"]},"data_b64":{"type":"string","contentEncoding":"base64","maxLength":8388608,"description":"At most 6 MiB decoded and capabilities.ocr.max_pixels pixels (413 too_large above either); on the realtime tier one image of at most 4.2 megapixels and 3 MiB. Boxes and the protected image are in the source's pixels."},"language":{"$ref":"#/components/schemas/PiiV2Language"}},"description":"A raster image; the service reads its text with the packaged OCR and answers synchronously with pixel boxes (box_unit px, page 1)."},"PiiV2FileInput":{"type":"object","additionalProperties":false,"required":["kind","source"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"file"},"source":{"$ref":"#/components/schemas/PiiV2Source"},"media_type":{"type":"string","maxLength":128},"language":{"$ref":"#/components/schemas/PiiV2Language"}},"description":"Jobs only: a file from /v2/uploads. A JSONL text batch (kind text_batch) or a PDF or DOCX document (kind document)."},"PiiV2Source":{"oneOf":[{"type":"object","additionalProperties":false,"required":["upload"],"properties":{"upload":{"$ref":"#/components/schemas/PiiV2Id"}}},{"type":"object","additionalProperties":false,"required":["s3"],"properties":{"s3":{"type":"object","additionalProperties":false,"required":["uri"],"properties":{"uri":{"type":"string","pattern":"^s3://"},"role_binding":{"type":"string"}}}}},{"type":"object","additionalProperties":false,"required":["azure_blob"],"properties":{"azure_blob":{"type":"object","additionalProperties":false,"required":["url"],"properties":{"url":{"type":"string","format":"uri"},"managed_identity_client_id":{"type":"string"}}}}},{"type":"object","additionalProperties":false,"required":["gcs"],"properties":{"gcs":{"type":"object","additionalProperties":false,"required":["uri"],"properties":{"uri":{"type":"string","pattern":"^gs://"}}}}},{"type":"object","additionalProperties":false,"required":["local"],"properties":{"local":{"type":"object","additionalProperties":false,"required":["mapping","path"],"properties":{"mapping":{"type":"string"},"path":{"type":"string"}}}}}]},"PiiV2AudioInput":{"type":"object","additionalProperties":false,"required":["kind","source"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"audio"},"source":{"$ref":"#/components/schemas/PiiV2Source"},"media_type":{"type":"string","maxLength":128},"language":{"$ref":"#/components/schemas/PiiV2Language"}},"description":"A recording from /v2/uploads for a job of kind audio (hosted API; up to capabilities.limits.audio_jobs_max_seconds and audio_jobs_max_bytes). For /v2/detect and /v2/protect send the recording as the raw body instead (standard tier, up to audio_standard_max_seconds and audio_standard_max_bytes); a JSON audio input there answers 501 capability_unavailable. Deployments without audio (capabilities.inputs.audio upcoming or unavailable) answer 501 capability_unavailable."},"PiiV2VideoInput":{"type":"object","additionalProperties":false,"required":["kind","source"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"const":"video"},"source":{"$ref":"#/components/schemas/PiiV2Source"},"media_type":{"type":"string","maxLength":128},"language":{"$ref":"#/components/schemas/PiiV2Language"}},"description":"Planned for jobs. Deployments that do not serve video (capabilities.inputs.video) answer 501 capability_unavailable."},"PiiV2KnownEntry":{"type":"object","additionalProperties":false,"required":["original","replacement"],"properties":{"original":{"type":"string","minLength":1},"replacement":{"type":"string","minLength":1},"type":{"$ref":"#/components/schemas/PiiV2EntityType"}}},"PiiV2MappingBlock":{"type":"object","additionalProperties":false,"properties":{"consistency":{"type":"string","enum":["input","batch","session","account"],"default":"batch","description":"input: one map per input. batch: one map for the request; the next request draws new surrogates. session: the server-held map of `session`. account: a value keeps its surrogate across all requests of the account (explicit opt-in; it lets anyone with the key build an original-to-surrogate table by repetition). For consistency across requests prefer a session or `known`."},"session":{"$ref":"#/components/schemas/PiiV2Id"},"known":{"type":"array","maxItems":20000,"items":{"$ref":"#/components/schemas/PiiV2KnownEntry"},"description":"The caller's existing map: original, replacement and optional type per entry. Values here keep their replacement. PII is never a JSON key."},"reserved":{"type":"array","maxItems":20000,"items":{"type":"string","minLength":1},"description":"Replacements already in use; new ones avoid them."},"return":{"type":"string","enum":["delta","full","none"],"default":"delta"}}},"PiiV2Part":{"type":"object","additionalProperties":false,"required":["original","replacement","role"],"properties":{"original":{"type":"string"},"replacement":{"type":"string"},"role":{"type":"string","enum":["given","family","middle","particle","other"]}}},"PiiV2MappingEntry":{"type":"object","additionalProperties":false,"required":["id","type","original","replacement","reversible"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"original":{"type":"string"},"replacement":{"type":"string"},"reversible":{"type":"boolean"},"fallback":{"type":"boolean","default":false,"description":"True when a bind rule failed and an opaque fixed-width token was used."},"parts":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Part"}}}},"PiiV2MappingResult":{"type":"object","additionalProperties":false,"required":["rev"],"properties":{"rev":{"type":"integer","minimum":0},"delta":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2MappingEntry"}},"full":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2MappingEntry"}},"unprotected":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["input_id","reason"],"properties":{"input_id":{"$ref":"#/components/schemas/PiiV2Id"},"reason":{"type":"string","enum":["policy_keep","not_detected_type","capability_unavailable"]}}}}}},"PiiV2Policy":{"oneOf":[{"type":"object","additionalProperties":false,"required":["template"],"properties":{"template":{"$ref":"#/components/schemas/PiiV2Id"}}},{"$ref":"#/components/schemas/PiiV2PolicyBody"}]},"PiiV2PolicyBody":{"type":"object","additionalProperties":false,"properties":{"preset":{"type":"string","enum":["pseudonymize","mask","label","strict","private-only","phi"],"default":"pseudonymize"},"default":{"$ref":"#/components/schemas/PiiV2StrictAction"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Rule"}},"fields":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2FieldRule"}},"media":{"type":"object","additionalProperties":false,"properties":{"image":{"type":"object","additionalProperties":false,"properties":{"op":{"const":"fill"},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","default":"#000000"},"all_text":{"type":"boolean","default":false},"pad_px":{"type":"integer","minimum":0,"maximum":16,"default":2}},"description":"How image inputs are protected: every entity whose text action is not keep is filled with color; all_text fills every recognised word; pad_px widens the fill only, never the reported boxes."},"audio":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","enum":["silence","bleep"]},"pad_ms":{"type":"integer","minimum":0,"maximum":1000}}},"video":{"type":"object","additionalProperties":false,"properties":{"op":{"const":"track_fill"},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"}}}}}}},"PiiV2StrictAction":{"allOf":[{"$ref":"#/components/schemas/PiiV2Action"}],"unevaluatedProperties":false},"PiiV2Action":{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["keep","mask","partial","label","surrogate","synthetic","generalize","hash","date_shift","bucket","time_part","dictionary","replace","remove","drop_row","crypto"]},"mask":{"type":"object","additionalProperties":false,"properties":{"char":{"type":"string","minLength":1,"maxLength":1},"keep_first":{"type":"integer","minimum":0},"keep_last":{"type":"integer","minimum":0},"count":{"type":"integer","minimum":0},"reverse":{"type":"boolean"},"ignore":{"type":"string","maxLength":64}}},"label":{"type":"object","additionalProperties":false,"properties":{"format":{"type":"string","maxLength":64,"default":"[{TYPE}_{n}]"},"numbering":{"type":"string","enum":["none","per_value","per_occurrence"],"default":"per_value"}}},"surrogate":{"type":"object","additionalProperties":false,"properties":{"realm":{"type":"string","enum":["preserve","neutralize"],"default":"preserve"},"arity":{"const":"same"},"preserve_format":{"type":"boolean","default":true},"valid_checksum":{"type":"boolean","default":true}}},"synthetic":{"type":"object","additionalProperties":false,"properties":{"preserve_format":{"type":"boolean","default":false}}},"generalize":{"type":"object","additionalProperties":false,"properties":{"level":{"type":"integer","minimum":1,"maximum":3}}},"hash":{"type":"object","additionalProperties":false,"required":["key"],"properties":{"alg":{"type":"string","enum":["hmac-sha256","hmac-sha512"],"default":"hmac-sha256"},"key":{"$ref":"#/components/schemas/PiiV2KeyRef"}}},"date_shift":{"type":"object","additionalProperties":false,"required":["min_days","max_days"],"properties":{"min_days":{"type":"integer","minimum":-36500,"maximum":36500},"max_days":{"type":"integer","minimum":-36500,"maximum":36500},"key":{"$ref":"#/components/schemas/PiiV2KeyRef"}}},"bucket":{"type":"object","additionalProperties":false,"required":["bounds"],"properties":{"bounds":{"type":"array","minItems":1,"items":{"type":"number"}},"labels":{"type":"array","items":{"type":"string"}}}},"time_part":{"type":"object","additionalProperties":false,"required":["part"],"properties":{"part":{"type":"string","enum":["year","month","day_of_month","day_of_week","week_of_year","hour_of_day"]}}},"dictionary":{"type":"object","additionalProperties":false,"required":["ref"],"properties":{"ref":{"type":"string","pattern":"^stored:[A-Za-z0-9._-]{1,128}$"}}},"replace":{"type":"object","additionalProperties":false,"required":["value"],"properties":{"value":{"type":"string","maxLength":256}}},"crypto":{"type":"object","description":"Planned: format-preserving or deterministic encryption. Answers 501 capability_unavailable today."}},"description":"Reversible actions: surrogate, and label with numbering per_value. Every other action is one-way."},"PiiV2Rule":{"allOf":[{"$ref":"#/components/schemas/PiiV2Action"}],"type":"object","required":["types","action"],"properties":{"types":{"type":"array","minItems":1,"items":{"type":"string","minLength":1,"maxLength":128}}},"unevaluatedProperties":false},"PiiV2FieldRule":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/PiiV2Action"}],"type":"object","required":["columns","action"],"properties":{"columns":{"type":"array","minItems":1,"items":{"type":"string"}},"when":{"$ref":"#/components/schemas/PiiV2Condition"}},"unevaluatedProperties":false},{"type":"object","additionalProperties":false,"required":["drop_row_when"],"properties":{"drop_row_when":{"$ref":"#/components/schemas/PiiV2Condition"}}}]},"PiiV2Condition":{"type":"object","additionalProperties":false,"required":["column","op"],"properties":{"column":{"type":"string"},"op":{"type":"string","enum":["eq","ne","lt","le","gt","ge","exists"]},"value":{"type":["string","number","boolean","null"]}}},"PiiV2Output":{"type":"object","additionalProperties":false,"properties":{"offset_unit":{"default":"codepoint","$ref":"#/components/schemas/PiiV2OffsetUnit"},"extra_offset_units":{"type":"array","uniqueItems":true,"items":{"$ref":"#/components/schemas/PiiV2OffsetUnit"}},"include_text":{"type":"boolean","default":false,"description":"Echo entity text. Off by default: responses carry no originals unless asked."},"include":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["entities","annotations","mapping","restore_table","forward_table","redaction_plan","audit","linkage_risk","explanation","stats"]}},"max_entities":{"type":"object","additionalProperties":false,"properties":{"per_input":{"type":"integer","minimum":1,"maximum":100000}},"description":"Caps the length of each result's `entities` list (document order). Protection is not capped; `entities_omitted` counts the rest."},"box_granularity":{"type":"string","enum":["word","line"],"default":"line","description":"Boxes per entity on page and image inputs: line = one box per text line, the union of the entity's own words; word = one box per word."}}},"PiiV2Processing":{"type":"object","additionalProperties":false,"properties":{"tier":{"type":"string","enum":["standard","realtime","batch"],"default":"standard"},"deadline_ms":{"type":"integer","minimum":100,"maximum":600000},"on_degraded":{"type":"string","enum":["fail","allow"],"default":"fail","description":"fail: 503 degraded_refused, no output, no charge, when a requested layer did not run."}}},"PiiV2DetectRequest":{"type":"object","additionalProperties":false,"description":"Send `inputs`, or for plain text the shorthand `text` (one input) or `texts` (one input per string, ids 1, 2, ...).","oneOf":[{"required":["inputs"]},{"required":["text"]},{"required":["texts"]}],"properties":{"text":{"type":"string","description":"Shorthand for inputs: [{id: \"1\", kind: \"text\", text}]."},"texts":{"type":"array","minItems":1,"maxItems":256,"items":{"type":"string"},"description":"Shorthand for one text input per string, ids \"1\", \"2\", ..."},"language":{"description":"Shorthand for detection.language.","$ref":"#/components/schemas/PiiV2Language"},"inputs":{"type":"array","minItems":1,"maxItems":256,"items":{"$ref":"#/components/schemas/PiiV2Input"}},"detection":{"$ref":"#/components/schemas/PiiV2Detection"},"output":{"$ref":"#/components/schemas/PiiV2Output"},"processing":{"$ref":"#/components/schemas/PiiV2Processing"}}},"PiiV2ProtectRequest":{"type":"object","additionalProperties":false,"description":"Send `inputs`, or for plain text the shorthand `text` (one input) or `texts` (one input per string, ids 1, 2, ...).","oneOf":[{"required":["inputs"]},{"required":["text"]},{"required":["texts"]}],"properties":{"text":{"type":"string","description":"Shorthand for inputs: [{id: \"1\", kind: \"text\", text}]."},"texts":{"type":"array","minItems":1,"maxItems":256,"items":{"type":"string"},"description":"Shorthand for one text input per string, ids \"1\", \"2\", ..."},"language":{"description":"Shorthand for detection.language.","$ref":"#/components/schemas/PiiV2Language"},"inputs":{"type":"array","minItems":1,"maxItems":256,"items":{"$ref":"#/components/schemas/PiiV2Input"}},"detection":{"$ref":"#/components/schemas/PiiV2Detection"},"policy":{"$ref":"#/components/schemas/PiiV2Policy"},"mapping":{"$ref":"#/components/schemas/PiiV2MappingBlock"},"output":{"$ref":"#/components/schemas/PiiV2Output"},"processing":{"$ref":"#/components/schemas/PiiV2Processing"}}},"PiiV2RestoreRequest":{"type":"object","additionalProperties":false,"required":["inputs"],"oneOf":[{"required":["table"]},{"required":["session"]},{"required":["mapping"]}],"properties":{"table":{"$ref":"#/components/schemas/PiiV2RestoreTable"},"session":{"$ref":"#/components/schemas/PiiV2Id"},"mapping":{"type":"object","additionalProperties":false,"required":["known"],"properties":{"known":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2KnownEntry"}}}},"inputs":{"type":"array","minItems":1,"maxItems":256,"items":{"oneOf":[{"type":"object","additionalProperties":false,"required":["id","text"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"text":{"type":"string"}}},{"type":"object","additionalProperties":false,"required":["id","value"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"value":{},"include_keys":{"type":"boolean","default":false}}}]}}},"description":"Reference restore for non-streaming callers; the conformance oracle for client implementations."},"PiiV2RestoreTable":{"type":"object","additionalProperties":false,"required":["algorithm","keys"],"properties":{"algorithm":{"type":"string","pattern":"^shinrai-restore/[0-9]+(\\.[0-9]+)?$"},"table_id":{"$ref":"#/components/schemas/PiiV2Id"},"mapping_rev":{"type":"integer","minimum":0},"direction":{"type":"string","enum":["restore","forward"],"default":"restore"},"word_class":{"oneOf":[{"type":"string","pattern":"^shinrai-word/[0-9]+$"},{"$ref":"#/components/schemas/PiiV2RangeList"}],"default":"shinrai-word/1"},"max_key_len":{"type":"integer","minimum":0},"ignorable":{"$ref":"#/components/schemas/PiiV2RangeList"},"keys":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2RestoreKey"}},"dropped":{"type":"object","additionalProperties":{"type":"integer","minimum":0},"description":"Variants the service left out, by reason (for example ambiguous_parts)."},"markers":{"type":"object","additionalProperties":false,"required":["prefix","suffix"],"properties":{"prefix":{"type":"string","minLength":1},"suffix":{"type":"string","minLength":1},"max_body":{"type":"integer","minimum":1,"maximum":256},"on_unknown":{"type":"string","enum":["keep","remove","redact"],"default":"keep"},"redact_text":{"type":"string","maxLength":64}}}}},"PiiV2RangeList":{"type":"array","items":{"type":"array","prefixItems":[{"type":"integer","minimum":0,"maximum":1114111},{"type":"integer","minimum":0,"maximum":1114111}],"minItems":2,"maxItems":2}},"PiiV2RestoreKey":{"type":"object","additionalProperties":false,"required":["k","o"],"properties":{"k":{"type":"string","minLength":1},"o":{"type":"string"},"m":{"$ref":"#/components/schemas/PiiV2Id"},"b":{"type":"string","enum":["both","none"],"default":"both"},"v":{"type":"string","enum":["exact","case","part","translit","json_ascii"],"default":"exact"},"ch":{"type":"string","enum":["any","text","json"],"default":"any"}}},"PiiV2RestoreTablesRequest":{"type":"object","additionalProperties":false,"oneOf":[{"required":["mapping"]},{"required":["session"]}],"properties":{"mapping":{"type":"object","additionalProperties":false,"required":["known"],"properties":{"known":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2KnownEntry"}}}},"session":{"$ref":"#/components/schemas/PiiV2Id"},"direction":{"type":"string","enum":["restore","forward"],"default":"restore"},"variants":{"type":"object","additionalProperties":false,"properties":{"case":{"type":"boolean","default":true},"parts":{"type":"boolean","default":true},"translit":{"type":"boolean","default":true},"json_ascii":{"type":"boolean","default":true}}},"markers":{"type":"boolean","default":true}},"description":"Compile a map into a restore table. No text is processed; not charged."},"PiiV2ReplacementRequest":{"type":"object","additionalProperties":false,"required":["value","type"],"properties":{"value":{"type":"string","minLength":1,"maxLength":1024},"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"language":{"$ref":"#/components/schemas/PiiV2Language"},"action":{"$ref":"#/components/schemas/PiiV2StrictAction"},"mapping":{"$ref":"#/components/schemas/PiiV2MappingBlock"}},"description":"Mint one replacement for a caller-chosen value (replaces /api/get-replacement)."},"PiiV2SessionCreate":{"type":"object","additionalProperties":false,"properties":{"ttl_s":{"type":"integer","minimum":60,"maximum":86400,"default":3600,"description":"Time to live in seconds from creation, at most 24 hours (capabilities.limits.sessions_max_ttl_s). A session lives at most until its max_expires_at: 24 hours after its creation by default, or up to 7 days when the account enables extended sessions (capabilities.limits.sessions_max_lifetime_s). expires_at never passes max_expires_at: a longer ttl_s is shortened."},"known":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2KnownEntry"}}}},"PiiV2SessionPatch":{"type":"object","additionalProperties":false,"properties":{"ttl_s":{"type":"integer","minimum":60,"maximum":86400,"description":"A new time to live in seconds from now, at most 24 hours (capabilities.limits.sessions_max_ttl_s). A session lives at most until its max_expires_at: 24 hours after its creation by default, or up to 7 days when the account enables extended sessions (capabilities.limits.sessions_max_lifetime_s). A ttl_s beyond it answers 422 validation_failed. The error carries max_expires_at and max_ttl_s."},"known":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2KnownEntry"}},"reserved":{"type":"array","items":{"type":"string","minLength":1}},"expected_rev":{"type":"integer","minimum":0}}},"PiiV2JobCreate":{"type":"object","additionalProperties":false,"required":["kind","inputs"],"properties":{"kind":{"type":"string","description":"text_batch: JSONL lines or inline text, table and json inputs. document: one PDF or DOCX file. audio: one recording (hosted API). image and video answer 501 capability_unavailable where capabilities do not list them for jobs.","enum":["text_batch","document","image","audio","video"]},"inputs":{"type":"array","minItems":1,"maxItems":100000,"items":{"$ref":"#/components/schemas/PiiV2Input"}},"detection":{"$ref":"#/components/schemas/PiiV2Detection"},"policy":{"$ref":"#/components/schemas/PiiV2Policy"},"mapping":{"$ref":"#/components/schemas/PiiV2MappingBlock"},"output":{"type":"object","additionalProperties":false,"properties":{"artifacts":{"type":"array","uniqueItems":true,"description":"The artifacts to produce. text_batch: protected, entities, mapping (default protected and entities). document: protected (the redacted PDF: image-only pages at 144 dpi, a black box over every protected entity, no text layer), text (the protected extracted text), entities, mapping (default protected, text and entities). audio: protected (the redacted WAV), transcript, entities (default all three). A job without protected, text or mapping only detects.","items":{"type":"string","enum":["protected","text","entities","mapping","redaction_plan","transcript","audit"]}},"destination":{"description":"Planned. Deployments that do not serve it answer 501 capability_unavailable; download the artifacts from the job.","$ref":"#/components/schemas/PiiV2Source"},"webhook":{"type":"object","additionalProperties":false,"description":"Planned. Deployments that do not serve it answer 501 capability_unavailable; poll the job.","required":["url"],"properties":{"url":{"type":"string","format":"uri","pattern":"^https://"},"secret_ref":{"type":"string"}}}}},"processing":{"$ref":"#/components/schemas/PiiV2Processing"}}},"PiiV2Usage":{"type":"object","additionalProperties":false,"required":["records","charged"],"properties":{"records":{"type":"number","minimum":0},"weighted_records":{"type":"number","minimum":0},"tier":{"type":"string"},"charged":{"type":"boolean"},"balance_after":{"type":"number"}}},"PiiV2Engine":{"type":"object","additionalProperties":false,"required":["model","layers_requested","layers_run","degraded"],"properties":{"model":{"type":"string"},"layers_requested":{"type":"array","items":{"type":"string","enum":["model","pattern","validated_identifiers","custom","zero_shot","bias","provided"]}},"layers_run":{"type":"array","items":{"type":"string"}},"degraded":{"type":"boolean"},"degraded_reasons":{"type":"array","items":{"type":"string"}},"effective_thresholds":{"type":"object","description":"The confidence floors applied to model entities: default, and per_type or per_language when the request set them.","properties":{"default":{"$ref":"#/components/schemas/PiiV2Probability"},"per_type":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PiiV2Probability"}},"per_language":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PiiV2Probability"}}},"additionalProperties":false}}},"PiiV2RedactionPlan":{"type":"object","additionalProperties":false,"properties":{"intervals":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["t0","t1"],"description":"An Interval (common.schema.json) in the input's time unit, plus the id of the entity it protects.","properties":{"t0":{"type":"number","minimum":0},"t1":{"type":"number","minimum":0},"entity_id":{"type":"string"}}}},"boxes":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["page","box"],"description":"A Box (common.schema.json) plus the id of the entity it protects.","properties":{"page":{"type":"integer","minimum":1},"box":{"type":"array","minItems":4,"maxItems":4,"items":{"type":"number"},"description":"[x, y, width, height] in the input's box unit."},"t0":{"type":"number","minimum":0},"t1":{"type":"number","minimum":0},"entity_id":{"type":"string"}}}}}},"PiiV2Audit":{"type":"object","additionalProperties":false,"properties":{"model":{"type":"string"},"labels_version":{"type":"string"},"policy_hash":{"type":"string"},"input_hmac":{"type":"string","description":"Tenant-keyed HMAC of the input; never a plain hash."},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"timing_ms":{"type":"integer"}}},"PiiV2ItemResult":{"type":"object","additionalProperties":false,"required":["input_id","status"],"properties":{"input_id":{"$ref":"#/components/schemas/PiiV2Id"},"status":{"type":"string","enum":["ok","failed","skipped"]},"output":{"description":"Protected text, table, JSON value or transcript forms, in the input's shape; for an image input an ImageOutput."},"entities":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Entity"}},"entities_omitted":{"type":"integer","minimum":1,"description":"Entities left out of `entities` by `output.max_entities`; they are still protected in `output`."},"annotations":{"type":"array","description":"Non-personal findings (types with `personal: false` in /v2/types: years, amounts, legal references, bias terms), returned with `output.include: [\"annotations\"]`. Protect never changes them.","items":{"$ref":"#/components/schemas/PiiV2Entity"}},"redaction_plan":{"$ref":"#/components/schemas/PiiV2RedactionPlan"},"stats":{"type":"object","additionalProperties":false,"properties":{"chars":{"type":"integer"},"records":{"type":"number"},"types":{"type":"object","additionalProperties":{"type":"integer"}},"max_confidence_by_type":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PiiV2Probability"}}}},"audit":{"$ref":"#/components/schemas/PiiV2Audit"},"linkage_risk":{"type":"object","additionalProperties":false,"description":"A heuristic k-anonymity proxy (`output.include: [\"linkage_risk\"]`): how likely the input singles out a person, from entity rarity tiers, direct identifiers and quasi-identifier cues (age, role, education, relation). Not a cohort count.","required":["level","score","direct_identifiers","k_estimate","signals","method"],"properties":{"level":{"type":"string","enum":["low","medium","high"]},"score":{"type":"integer","minimum":0},"direct_identifiers":{"type":"integer","minimum":0},"k_estimate":{"type":"string","enum":["likely <= 5","uncertain","plausibly > 5"]},"signals":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","weight"],"properties":{"kind":{"type":"string","enum":["rarity","quasi_identifier"]},"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"tier":{"type":["string","null"]},"category":{"type":"string","enum":["age","role","education","relation"]},"weight":{"type":"integer"},"text":{"type":"string","description":"Only with `output.include_text`."}}}},"method":{"type":"string"}}},"error":{"type":"object","additionalProperties":false,"required":["code"],"properties":{"code":{"$ref":"#/components/schemas/PiiV2ErrorCode"},"message":{"type":"string"}}},"text":{"type":"string","description":"The text the service read from the input: for an image the OCR text (only with output.include_text); for an audio body on the hosted API the recognised transcript (always on /v2/detect). Never for other kinds."},"media":{"type":"object","additionalProperties":false,"required":["box_unit"],"description":"Geometry of a page or image input, so boxes can be applied to the source.","properties":{"media_type":{"type":"string"},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"pages":{"type":"integer","minimum":1},"box_unit":{"type":"string","enum":["pt","px","norm"]},"ocr":{"type":"object","additionalProperties":false,"properties":{"languages":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Language"}},"layout":{"type":"string"},"words":{"type":"integer"},"mean_confidence":{"type":"number"}}}}}}},"PiiV2Result":{"type":"object","additionalProperties":false,"required":["request_id","api_version","offset_unit","engine","results"],"properties":{"request_id":{"type":"string"},"api_version":{"type":"string"},"offset_unit":{"$ref":"#/components/schemas/PiiV2OffsetUnit"},"engine":{"$ref":"#/components/schemas/PiiV2Engine"},"results":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2ItemResult"}},"mapping":{"$ref":"#/components/schemas/PiiV2MappingResult"},"restore_table":{"$ref":"#/components/schemas/PiiV2RestoreTable"},"forward_table":{"$ref":"#/components/schemas/PiiV2RestoreTable"},"usage":{"$ref":"#/components/schemas/PiiV2Usage"},"timing_ms":{"type":"object","additionalProperties":{"type":"integer"}}}},"PiiV2RestoreResponse":{"type":"object","additionalProperties":false,"required":["results"],"properties":{"results":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["input_id"],"properties":{"input_id":{"type":"string"},"text":{"type":"string"},"value":{}}}},"restored":{"type":"integer","minimum":0}}},"PiiV2ReplacementResponse":{"type":"object","additionalProperties":false,"required":["replacement","entry"],"properties":{"replacement":{"type":"string"},"entry":{"$ref":"#/components/schemas/PiiV2MappingEntry"},"restore_table":{"$ref":"#/components/schemas/PiiV2RestoreTable"}}},"PiiV2Session":{"type":"object","additionalProperties":false,"required":["id","mapping_rev","expires_at"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"mapping_rev":{"type":"integer"},"entries":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"max_expires_at":{"type":"string","format":"date-time","description":"The end of the session's maximum lifetime: 24 hours after its creation by default, or up to 7 days when the account enables extended sessions. expires_at never passes it."}}},"PiiV2Upload":{"type":"object","additionalProperties":false,"required":["id","bytes","sha256","expires_at"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"media_type":{"type":"string"},"bytes":{"type":"integer"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"expires_at":{"type":"string","format":"date-time"},"retain_until_expiry":{"type":"boolean","description":"true (created with keep=true): the upload stays until expires_at, extended by every job that reads it. false: the upload is deleted when the last job that reads it ends."}}},"PiiV2Job":{"type":"object","additionalProperties":false,"required":["id","kind","status","created_at"],"properties":{"id":{"$ref":"#/components/schemas/PiiV2Id"},"kind":{"type":"string"},"status":{"type":"string","enum":["queued","running","succeeded","failed","cancelled"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"progress":{"type":"object","additionalProperties":false,"properties":{"done":{"type":"integer"},"total":{"type":"integer"}}},"artifacts":{"type":"object","additionalProperties":{"type":"string","description":"Relative URL of /v2/jobs/{id}/artifacts/{name}."}},"error":{"type":"object","additionalProperties":false,"required":["code"],"properties":{"code":{"$ref":"#/components/schemas/PiiV2ErrorCode"},"message":{"type":"string"}}},"usage":{"$ref":"#/components/schemas/PiiV2Usage"}}},"PiiV2JobList":{"type":"object","additionalProperties":false,"required":["jobs"],"properties":{"jobs":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Job"}},"next":{"type":"string"}}},"PiiV2InputCapability":{"type":"object","additionalProperties":false,"required":["standard","realtime","jobs"],"properties":{"standard":{"$ref":"#/components/schemas/PiiV2Status"},"realtime":{"$ref":"#/components/schemas/PiiV2Status"},"jobs":{"$ref":"#/components/schemas/PiiV2Status"}}},"PiiV2Capabilities":{"type":"object","additionalProperties":false,"required":["api_version","profile","mode","inputs","actions","restore"],"properties":{"api_version":{"type":"string"},"profile":{"type":"string","enum":["public","offline"]},"mode":{"type":"string","enum":["local","global","offline"]},"models":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id"],"properties":{"id":{"type":"string"},"status":{"type":"string"},"languages":{"type":"array","items":{"type":"string"}}}}},"languages":{"type":"array","items":{"type":"string"}},"offset_units":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2OffsetUnit"}},"inputs":{"type":"object","additionalProperties":false,"description":"Status per input kind on the standard and realtime tiers and in jobs. audio: the hosted API serves raw audio bodies on /v2/detect and /v2/protect (standard) and jobs of kind audio where the status is ga; audio is not served on the realtime tier.","properties":{"text":{"$ref":"#/components/schemas/PiiV2InputCapability"},"table":{"$ref":"#/components/schemas/PiiV2InputCapability"},"json":{"$ref":"#/components/schemas/PiiV2InputCapability"},"transcript":{"$ref":"#/components/schemas/PiiV2InputCapability"},"page":{"$ref":"#/components/schemas/PiiV2InputCapability"},"image":{"$ref":"#/components/schemas/PiiV2InputCapability"},"file":{"$ref":"#/components/schemas/PiiV2InputCapability"},"audio":{"$ref":"#/components/schemas/PiiV2InputCapability"},"video":{"$ref":"#/components/schemas/PiiV2InputCapability"}}},"actions":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/PiiV2Status"}},"vocabularies":{"type":"array","items":{"type":"string"}},"sessions":{"$ref":"#/components/schemas/PiiV2Status"},"limits":{"type":"object","description":"Integer limits of this deployment. Per tier: <tier>_inputs, <tier>_chars (per input), <tier>_total (per request). Images: image_pixels, image_bytes. Hosted sessions: sessions_max_ttl_s, sessions_max_entries, sessions_max_lifetime_s (the maximum lifetime of a new session of this key). Hosted jobs: jobs_upload_max_bytes, jobs_text_batch_max_lines, jobs_text_batch_max_bytes, jobs_document_max_bytes, jobs_retention_s, jobs_account_budget_bytes (job storage per account), jobs_account_max_uploads (live uploads per account). Hosted audio: audio_standard_max_seconds, audio_standard_max_bytes, audio_jobs_max_seconds, audio_jobs_max_bytes. A key is present only where the feature is served.","additionalProperties":{"type":"integer"}},"restore":{"type":"object","additionalProperties":false,"required":["algorithms"],"properties":{"algorithms":{"type":"array","items":{"type":"string"}},"word_classes":{"type":"array","items":{"type":"string"}}}},"engine":{"type":"object","additionalProperties":false,"properties":{"status":{"type":"string","enum":["ok","degraded","unavailable"],"description":"Whether the model layer can answer now. The public profile reports only this and the default model."},"model":{"type":["string","null"]}},"description":"The model layer: the default model and whether it can answer now."},"tiers":{"type":"object","description":"Hosted and offline: which processing tiers the calling key's plan allows.","additionalProperties":{"type":"string","enum":["allowed","not_in_plan"]}},"metering":{"type":"object","description":"Hosted and offline: how requests are charged.","properties":{"unit":{"type":"string"},"image_minimum_records":{"type":"number","description":"Records one image costs at least."},"audio_minimum_records_per_minute":{"type":"integer","minimum":0,"description":"Records audio costs at least per started minute, before the tier weight; the transcript's records count when they are more."},"weights":{"type":"object","additionalProperties":{"type":"number"}},"free":{"type":"array","items":{"type":"string"}}}},"ocr":{"type":"object","additionalProperties":false,"required":["available"],"description":"The packaged OCR for image inputs.","properties":{"available":{"type":"boolean"},"languages":{"type":"array","items":{"$ref":"#/components/schemas/PiiV2Language"}},"max_pixels":{"type":"integer"},"max_bytes":{"type":"integer"}}}}},"PiiV2TypesResponse":{"type":"object","additionalProperties":false,"required":["canonical"],"properties":{"canonical":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"$ref":"#/components/schemas/PiiV2EntityType"},"description":{"type":"string"},"subtypes":{"type":"array","items":{"type":"string"}},"group":{"type":"string"},"personal":{"type":"boolean","description":"True for personal data. False for findings that are not personal data on their own (years, amounts, legal references, bias terms): they are never replaced by default."},"sources":{"type":"array","items":{"type":"string","enum":["model","pattern","name_completion","user_value","bias"]}},"since":{"type":"string"}}}},"vocabularies":{"type":"object","additionalProperties":{"type":"object","additionalProperties":false,"required":["version","map"],"properties":{"version":{"type":"string"},"map":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"PiiV2UsageResponse":{"type":"object","additionalProperties":false,"properties":{"plan":{"type":["string","null"]},"available_records":{"type":"number"},"last_30_days":{"type":"object","additionalProperties":{"type":"number"}}}}},"securitySchemes":{"BearerApiKey":{"type":"http","scheme":"bearer","description":"Your ShinrAI API key: Authorization: Bearer shr_live_... (sandbox: shr_test_...)."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":128},"description":"Hosted and offline. A retry with the same key and body is answered again and charged once (`X-Records-Charged` 0); the same key with another body answers 409 `idempotency_conflict`."},"RequestId":{"name":"X-Request-Id","in":"header","required":false,"description":"Your own request id for tracing (8 to 64 characters).","schema":{"type":"string","pattern":"^[A-Za-z0-9._-]{8,64}$"}},"Deadline":{"name":"Shinrai-Deadline-Ms","in":"header","required":false,"description":"The longest time you wait, in milliseconds. The service answers 504 when it cannot finish in time; nothing is charged.","schema":{"type":"integer","minimum":100,"maximum":600000}},"QLanguage":{"name":"language","in":"query","required":false,"schema":{"type":"string"},"example":"de","description":"Raw bodies: detection.language (BCP 47, or auto). For images it selects the OCR language; for audio the speech recognition language."},"QModel":{"name":"model","in":"query","required":false,"schema":{"type":"string"},"description":"Raw bodies: detection.model (latest or a version from capabilities.models)."},"QTypes":{"name":"types","in":"query","required":false,"schema":{"type":"string"},"example":"EMAIL,PHONE","description":"Raw bodies: comma-separated detection.types.include."},"QExclude":{"name":"exclude","in":"query","required":false,"schema":{"type":"string"},"description":"Raw bodies: comma-separated detection.types.exclude."},"QTier":{"name":"tier","in":"query","required":false,"schema":{"type":"string","enum":["standard","realtime","batch"]},"description":"Raw bodies: processing.tier. Audio runs on standard only."},"QOnDegraded":{"name":"on_degraded","in":"query","required":false,"schema":{"type":"string","enum":["fail","allow"]},"description":"Raw bodies: processing.on_degraded."},"QGranularity":{"name":"granularity","in":"query","required":false,"schema":{"type":"string","enum":["line","word"]},"description":"Raw image bodies: output.box_granularity (one box per text line or per word)."},"QPreset":{"name":"preset","in":"query","required":false,"schema":{"type":"string","enum":["pseudonymize","mask","label","strict"]},"description":"Raw bodies: policy.preset."},"QAudioOp":{"name":"audio_op","in":"query","required":false,"schema":{"type":"string","enum":["bleep","silence"],"default":"bleep"},"description":"Raw audio bodies on the hosted API: policy.media.audio.op. bleep covers each entity with a 1 kHz tone; silence mutes it."},"QPadMs":{"name":"pad_ms","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":1000,"default":150},"description":"Raw audio bodies on the hosted API: policy.media.audio.pad_ms. Milliseconds added before and after every muted interval."},"SessionId":{"name":"session_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Id"}},"JobId":{"name":"job_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/Id"}}},"headers":{"NoStore":{"description":"Responses are never cached.","schema":{"type":"string","const":"no-store"}},"RequestId":{"description":"The id of this request; quote it in support requests.","schema":{"type":"string"}},"Location":{"description":"The path of the created resource.","schema":{"type":"string"}},"RetryAfter":{"description":"Seconds to wait before the next call.","schema":{"type":"integer"}},"RecordsCharged":{"description":"Hosted and offline. Records charged for this request, tier weight included.","schema":{"type":"string"}},"RecordsRemaining":{"description":"Hosted and offline. Records available on the account after this request.","schema":{"type":"string"}},"UsageRecords":{"description":"Records of a raw-body answer that is not JSON.","schema":{"type":"string"}},"Entities":{"description":"The number of entities found (raw-body and audio answers).","schema":{"type":"string"}},"AudioSeconds":{"description":"Audio bodies (hosted API). The duration of the recording in seconds.","schema":{"type":"string"}},"AudioLanguage":{"description":"Audio bodies (hosted API). The language the speech recognition used.","schema":{"type":"string"}}},"responses":{"Result":{"description":"Per-input results, the detection layers that ran and the usage. For an audio body (hosted API) `results[0].text` is the recognised transcript.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"},"X-Records-Charged":{"$ref":"#/components/headers/RecordsCharged"},"X-Records-Remaining":{"$ref":"#/components/headers/RecordsRemaining"},"Shinrai-Entities":{"$ref":"#/components/headers/Entities"},"Shinrai-Audio-Seconds":{"$ref":"#/components/headers/AudioSeconds"},"Shinrai-Audio-Language":{"$ref":"#/components/headers/AudioLanguage"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Result"},"examples":{"text":{"summary":"One text","value":{"request_id":"3f9c2a7d1b4e6f80","api_version":"2.0.0","offset_unit":"codepoint","engine":{"model":"v1.4","layers_requested":["model","pattern"],"layers_run":["model","pattern"],"degraded":false,"effective_thresholds":{"default":0.35}},"results":[{"input_id":"1","status":"ok","entities":[{"id":"e1","type":"EMAIL","span":{"start":5,"end":21},"confidence":1.0,"source":"pattern"},{"id":"e2","type":"PHONE","span":{"start":30,"end":44},"confidence":1.0,"source":"pattern"}]}],"usage":{"records":1,"weighted_records":1,"tier":"standard","charged":true,"balance_after":999}}},"audio":{"summary":"An audio body (hosted API)","value":{"request_id":"1a992e81ee0eb425","api_version":"2.0.0","offset_unit":"codepoint","engine":{"model":"v1.4","layers_requested":["model","pattern"],"layers_run":["model","pattern"],"degraded":false},"results":[{"input_id":"1","status":"ok","text":"Bitte rufen Sie Anna Weber an.","entities":[{"id":"e1","type":"PERSON","span":{"start":16,"end":26},"confidence":0.97,"source":"model","evidence":"argmax","coords":{"intervals":[{"t0":1260,"t1":1560},{"t0":1560,"t1":1980}]}}]}],"usage":{"records":1,"weighted_records":1,"tier":"standard","charged":true,"balance_after":998}}}}}}},"ProtectResult":{"description":"Per-input results as JSON. For a raw body that accepts it, the protected content itself: `Accept: text/plain` the protected text, `Accept: image/*` the filled image, and for an audio body (hosted API) the redacted WAV unless `Accept` is `application/json`. The headers carry the summary.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"},"X-Records-Charged":{"$ref":"#/components/headers/RecordsCharged"},"X-Records-Remaining":{"$ref":"#/components/headers/RecordsRemaining"},"Shinrai-Usage-Records":{"$ref":"#/components/headers/UsageRecords"},"Shinrai-Entities":{"$ref":"#/components/headers/Entities"},"Shinrai-Audio-Seconds":{"$ref":"#/components/headers/AudioSeconds"},"Shinrai-Audio-Language":{"$ref":"#/components/headers/AudioLanguage"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Result"},"examples":{"pseudonymize":{"summary":"Pseudonymised text with the mapping","value":{"request_id":"5b1e0c9d2a7f4e31","api_version":"2.0.0","offset_unit":"codepoint","engine":{"model":"v1.4","layers_requested":["model","pattern"],"layers_run":["model","pattern"],"degraded":false},"results":[{"input_id":"1","status":"ok","output":"Julia Brandt lives in Freiburg.","entities":[{"id":"e1","type":"PERSON","span":{"start":0,"end":10},"confidence":0.98,"source":"model","evidence":"argmax","action":"surrogate","replacement":"Julia Brandt","output_span":{"start":0,"end":12},"mapping_id":"mp_1"},{"id":"e2","type":"CITY","span":{"start":20,"end":29},"confidence":0.95,"source":"model","evidence":"argmax","action":"surrogate","replacement":"Freiburg","output_span":{"start":22,"end":30},"mapping_id":"mp_2"}]}],"mapping":{"rev":1,"delta":[{"id":"mp_1","type":"PERSON","original":"Anna Weber","replacement":"Julia Brandt","reversible":true},{"id":"mp_2","type":"CITY","original":"Darmstadt","replacement":"Freiburg","reversible":true}]},"usage":{"records":1,"weighted_records":1,"tier":"standard","charged":true,"balance_after":997}}},"audio":{"summary":"An audio body with Accept application/json (hosted API)","value":{"request_id":"idem6a2273a52c3fce239dc89a8945fa","api_version":"2.0.0","offset_unit":"codepoint","engine":{"model":"v1.4","layers_requested":["model","pattern"],"layers_run":["model","pattern"],"degraded":false},"results":[{"input_id":"1","status":"ok","output":{"display":"Bitte rufen Sie Julia Brandt an."},"entities":[{"id":"e1","type":"PERSON","span":{"start":16,"end":26},"confidence":0.97,"source":"model","evidence":"argmax","coords":{"intervals":[{"t0":1260,"t1":1560},{"t0":1560,"t1":1980}]},"action":"surrogate","replacement":"Julia Brandt","output_span":{"start":16,"end":28},"mapping_id":"mp_1"}],"redaction_plan":{"intervals":[{"t0":1260,"t1":1560},{"t0":1560,"t1":1980}]}}],"usage":{"records":1,"weighted_records":1,"tier":"standard","charged":true,"balance_after":996}}}}},"text/plain":{"schema":{"type":"string"},"example":"Mail [EMAIL_1] or call [PHONE_1]."},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}}}},"Error":{"description":"Typed error. Never echoes input values.","headers":{"Cache-Control":{"$ref":"#/components/headers/NoStore"},"X-Request-Id":{"$ref":"#/components/headers/RequestId"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"validation":{"summary":"422 validation_failed","value":{"error":{"code":"validation_failed","message":"Unknown field.","request_id":"3f9c2a7d1b4e6f80","retryable":false,"details":[{"pointer":"/output/inclde","reason":"unknown field"}]}}},"too_large":{"summary":"413 too_large for audio longer than 300 seconds","value":{"error":{"code":"too_large","message":"This audio is longer than 300 seconds. Send it as a job.","request_id":"9d0e7a61c2b3f4a5","retryable":false,"use":"/v2/jobs","limit_name":"max_audio_seconds","limit":300}}},"insufficient_records":{"summary":"402 insufficient_records","value":{"error":{"code":"insufficient_records","message":"Not enough records on this account.","request_id":"7c1d2e3f4a5b6c7d","retryable":false,"records_required":3,"records_available":1}}}}}}}}},"externalDocs":{"description":"Native PII API v2 guide","url":"https://goshinrai.com/docs/guides/v2"}}