§ LLM round trip
Tokenize PII API
Replaces each distinct value with a reversible placeholder and hands you the mapping. Send the tokenized text to a model, then post the reply to /text/restore with that same mapping. The mapping is returned to you and held nowhere here, so the round trip needs no session, no job id, and no coordination — the two calls can land on different workers.
- Endpoint
- POST /text/tokenize
- Inputs
- Exactly 1 UTF-8 text file
- Returns
- application/json
- Limits
- 2 MB per file, 5,000 distinct tokens per request.
- Price
- $0.001
§ 01 The request
One POST, and the file comes back.
curl -sS --fail-with-body \
-H "Authorization: Bearer $OHMYWRAP_KEY" \
-F "file=@prompt.txt" \
-F 'options={"detect":["email-address","ssn"],"tokenFormat":"[%T_%n]"}' \
https://api.ohmywrap.com/text/tokenizeOptions
| Option | Type | Default | What it does |
|---|---|---|---|
| detect | string[] | the 13 defaults | Which detectors to run. Omitting it means the defaults; sending [] means none of them, which is how you ask for `terms` and nothing else. `date`, `age`, `zip-code` and `url` exist but are off by default, because they fire constantly in ordinary prose. |
| tokenFormat | string | [%T_%n] | `%T` is the detector in upper snake case, `%n` the per-detector counter. `%n` is required. |
| mode | string | token | `token` for placeholders, or `surrogate` for realistic stand-ins the model reads as ordinary prose. |
| terms | string[] | — | An inline dictionary of exact phrases to treat as sensitive. Up to 1,000 terms of 256 bytes each. Every entry is another pass over the input, bought for the same single call. |
| caseSensitive | bool | false | Applies to `terms` only. The built-in detectors set their own case rules per pattern. |
| onlyValidCreditCardNumbers | bool | false | Run a Luhn check before reporting a card. Trades a little recall for far fewer false positives on long digit runs. |
Worth knowing
`tokenFormat` must contain `%n`, or every value of one type collapses onto one token — the exact failure this endpoint exists to prevent. The redaction options are rejected rather than ignored: four of the six strategies map many values onto one string and cannot be reversed at all, and `random` can collide. Tokenization does its own replacement, and checks.
Your first /text/tokenize call takes one line of curl.
Ten thousand calls cost ten dollars, the pack never expires, and nothing you send is kept.
10,000 calls for $10. No subscription, no expiry.