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.

MethodRouteHeaders
PUT{baseurl}/vault/mask/asyncAuthorization: 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.

FieldTypeRequiredDescription
maskarrayYesText items to mask. The array must not be empty. Results keep the same order.
mask[].valuestringYesText to mask.
policy_namestringNoName 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.
effortstring (medium, high)NoDetection effort for every item. Defaults to medium.
identify_excluded_entitiesbooleanNoWhether 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.

FieldTypeDescription
dataarrayContains the submitted job's tracking ID and status.
data[].tracking_idstringTracking ID for the submitted job.
data[].statusstringThe job status. A submission response returns PENDING.
successbooleanWhether the submission succeeded.
error.messagestringError 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.