Skip to main content
Docs

One endpoint,
every model.

Tare is an OpenAI-compatible gateway in front of every model you use — ours and the ones you bring yourself. One base URL, one key, and every token accounted for.

SecurityCustom DLP rules

Custom DLP rules

What this solves: Detect your own identifiers (employee numbers, project names, internal ticket formats) with rules you write, for the whole account or for a single key, and try them on sample text before saving.

A custom rule is built from a fixed set of parts: one way to match, plus an optional checksum and optional context words. The parts and their limits come from one place, GET /v1/dlp/capabilities; the console form, the API and this page all read from it.

Custom rules run only while data protection is on for the call (see Data protection (DLP)). They are added on top of the built-in types and the recommended rules; they do not replace them.

Where a rule applies

ScopeApplies toLimit
TENANTEvery call of the account, including calls that go directly to a Local Node50 rules
KEYCalls made with that key only. The key must belong to your account20 rules per key

Rules from both scopes run together on a key's calls. The scope is fixed when the rule is created.

Console: Security → Custom rules. The selector at the top switches between the whole account and one key.

Ways to match

kindFieldsNotes
KEYWORDSkeywords.words (up to 100, each up to 64 characters), keywords.wholeWordAlways case-insensitive. With wholeWord, Apollo does not match inside Apollos
FORMATformat.prefix, format.charset, format.length.min/max, format.boundary, format.suffixPrefix + characters of one set + bounded length. Prefix and suffix up to 32 characters, length up to 512, prefix plus minimum length at least 6
REGEXregex (up to 500 characters)Java regular expression syntax

charset is one of ALNUM, UPPER_DIGIT, LOWER_DIGIT, HEX, DIGITS, B64URL, B64. boundary is WORD (the match may not touch a letter, digit, _ or - on either side) or NONE.

A regular expression is checked when saved: it must compile, must not match empty text, and must stay fast on long input. Patterns that start with .* or nest repetition such as (a+)+ are refused with the reason. At scan time a rule that runs out of its time budget fails the call instead of letting it through.

Keywords and formats are compiled into a pattern that runs in linear time, so prefer them over a hand-written regex when they fit.

Checksum

checksum keeps only matches whose digits pass a check. Separators (spaces and -) are ignored when checking.

NameCheck
LUHNLuhn mod 10 (bank card numbers)
IBAN_MOD97IBAN mod 97
CN_RESIDENT_IDChina resident ID, GB 11643
TW_NATIONAL_IDTaiwan national ID
TW_RESIDENT_CERTTaiwan resident certificate (old and new format)
TW_UBNTaiwan unified business number

Context words

context keeps only matches that have one of the words within window characters before or after them. Up to 20 words, each up to 32 characters, window from 1 to 200 (default 40). Words are compared case-insensitively.

Use it for bare numbers: an 8-digit number is everywhere, an 8-digit number within 20 characters of "member no." is not.

Action

action is MASK (replace with a placeholder and continue), BLOCK (fail the call, not billed) or ALERT (forward unchanged, record and notify). The result of each is the same as for built-in types; see Data protection (DLP).

Rule schema

Code / Terminal
{
  "id": 12,
  "scope": "TENANT",
  "keyId": null,
  "name": "Member number",
  "kind": "REGEX",
  "regex": "\\b\\d{8}\\b",
  "keywords": null,
  "format": null,
  "checksum": null,
  "context": { "words": ["member no", "會員編號"], "window": 20 },
  "action": "MASK",
  "enabled": true,
  "description": "Loyalty programme",
  "updatedAt": "2026-11-20T14:02:11"
}

Only the fields of the rule's kind are set. name is up to 64 characters and unique within its scope; description is up to 255 characters.

When a rule blocks a call, the error returned to the caller says CUSTOM_RULE without the rule's name, so your rule names never reach the application that made the call. Test scans and the console show the name.

Endpoints

Console session: /v1/dlp/.... Management key: the same paths under /v1/manage/dlp/....

MethodPathWhat it does
GET/v1/dlp/capabilitiesThe parts, names and limits above
GET/v1/dlp/rules?scope=TENANTAccount rules. scope=KEY&keyId=N for one key, scope=ALL for both
POST/v1/dlp/rulesCreate. Body: scope, keyId (for KEY), and the rule fields
PUT/v1/dlp/rules/{id}Change. Fields you send replace the stored ones; scope and keyId cannot change
DELETE/v1/dlp/rules/{id}Delete
POST/v1/dlp/rules/testTest scan, nothing is saved

The test scan takes text (up to 20,000 characters). With rule it runs only that draft rule. Without rule it runs everything in effect for keyId (or the account): built-in types, recommended rules and saved custom rules.

Code / Terminal
curl -X POST https://tare.jamerly.ai/v1/dlp/rules/test \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Refund for member no 40271536, order 99812733",
    "rule": {
      "name": "Member number",
      "kind": "REGEX",
      "regex": "\\b\\d{8}\\b",
      "context": { "words": ["member no"], "window": 20 },
      "action": "MASK"
    }
  }'
Code / Terminal
{
  "code": 200,
  "data": {
    "hits": [{ "label": "CUSTOM:Member number", "action": "MASK", "start": 21, "end": 29, "matched": "40271536" }],
    "blocked": false,
    "blockedLabel": null,
    "maskedText": "Refund for member no [CUSTOM_REDACTED], order 99812733"
  }
}

More examples

Project code names, whole words only:

Code / Terminal
{ "scope": "TENANT", "name": "Project names", "kind": "KEYWORDS",
  "keywords": { "words": ["Apollo", "Gemini", "Artemis"], "wholeWord": true }, "action": "MASK" }

An internal token format on one key, blocked:

Code / Terminal
{ "scope": "KEY", "keyId": 314, "name": "Internal token", "kind": "FORMAT",
  "format": { "prefix": "itk_", "charset": "B64URL", "length": { "min": 32, "max": 40 }, "boundary": "WORD", "suffix": null },
  "action": "BLOCK" }

Card numbers only next to the word "card", checked with Luhn, alert only:

Code / Terminal
{ "scope": "TENANT", "name": "Card near label", "kind": "REGEX", "regex": "\\b(?:\\d[ -]?){15}\\d\\b",
  "checksum": "LUHN", "context": { "words": ["card"], "window": 30 }, "action": "ALERT" }

On a Local Node

Account rules also run on calls that go directly to your Local Node. A node runs them through its DLP sidecar. A sidecar from before custom rules gained checksums and context words runs only the pattern part of such a rule, so it may catch more than the same rule does in Tare. Update the sidecar to the current release to get the same result on both paths.

Next steps

Docs last updated Nov 27, 2026, 12:56 (UTC+8)