Mask Text (Async)
Submit a text masking request for background processing, then use its tracking ID to check the job status and retrieve the result.
Endpoint
Mask long texts or many text items in the background and retrieve the results using a tracking ID.
| Method | Route | Headers |
|---|---|---|
| PUT | {baseurl}/vault/mask/async | Authorization: Bearer YOUR_AUTH_TOKEN |
The API key needs the mask permission.
Request body
Each request masks one or more text items using one policy. Place policy_name, effort, and identify_excluded_entities at the top level of the request, next to mask, not inside its items.
| Field | Type | Required | Description |
|---|---|---|---|
mask | array | Yes | Text items to mask. The array must not be empty. Results keep the same order. |
mask[].value | string | Yes | Text to mask. |
policy_name | string | No | Name of the policy to apply from your namespace. If omitted, the default namespace policy applies. An unknown name is rejected without falling back to the default. |
effort | string (medium, high) | No | Detection effort for every item. Defaults to medium. |
identify_excluded_entities | boolean | No | Whether to report entities excluded by the policy in excluded_entities. Defaults to true. |
The job keeps the policy chosen when the request was accepted.
Example request
{
"mask": [
{"value": "Arjun is my name here from DataLoop. Our official site is www.dataloop.ai and my email is arjun@gmail.com"}
],
"policy_name": "customer_mask_policy",
"effort": "high",
"identify_excluded_entities": true
}
Submission response
Once the request is validated and stored, the call returns HTTP 200 with a tracking ID and the status PENDING. Detection and masking happen afterwards.
| Field | Type | Description |
|---|---|---|
data | array | Contains the submitted job's tracking ID and status. |
data[].tracking_id | string | Tracking ID for the submitted job. |
data[].status | string | The job status. A submission response returns PENDING. |
success | boolean | Whether the submission succeeded. |
error.message | string | Error message. |
Example response
{
"data": [{"tracking_id": "f58f73cd-8128-4213-827e-79473a5c85ca13112026065517", "status": "PENDING"}],
"success": true,
"error": {"message": ""}
}
Retrieve the result
Pass the tracking_id to PUT /async-status and poll Text Job Status until the job reaches a terminal state. A successful result has the same fields as a PUT /mask response.
Masking behavior
The active policy controls which entities are detected, how they are tokenized, and which tags wrap them.
Entities excluded by the policy are never masked. When identify_excluded_entities is true, excluded entities are reported in excluded_entities.
Errors
Invalid requests are rejected immediately with HTTP 500, success: false, and the reason in error.message. No tracking ID is created.
The validation rules are the same as for Mask Text. If an item contains file_content, send it to Mask File using PUT /mask/file/async.
After a job is accepted, a later failure, such as a detection error, appears in the Text Job Status response as FAILED with an error_msg.