Create bulk document deletion job
Changed onCreates an asynchronous job that deletes all documents in a data entity that match a given filter.
This request does not delete any documents by itself. It creates a job and returns a JobId, which you must use to track the job with the Get bulk document deletion job status endpoint.
❗ This action cannot be undone. Deleted documents will be permanently lost.
Filter rules
- The filter field is required.
- Wildcards are not allowed. For example, email = *@gmail.com is rejected.
- Every field used in the filter must be indexed. Internal fields, such as createdIn, are already indexed.
- Filtering on a custom field also requires sending the schema that declares it as indexed in the request body. A custom field is declared as indexed for filtering in the v-indexed array of its schema.
- Only one active job per account and data entity is allowed at a time.
ℹ️ Confirm how many documents match your filter before deleting them, so you can compare that number with the DocumentsDeleted value returned by the job status endpoint.
Errors
{field}, {schema}, and {entity} are placeholders for values from your request, and any quotation marks around them are part of the message returned by the API. Messages marked as truncated continue beyond the text shown.
| Status code | Message or cause | What to do |
|---|---|---|
| 400 | The 'filter' field is required. | Send the filter field in the body. |
| 400 | Wildcard filters are not allowed for bulk delete. | Rewrite the filter using exact or range conditions over indexed fields. |
| 400 | The field '{field}' is not an internal indexed field, so the 'schema' that declares it as indexed must be provided. | Send the schema field in the body. |
| 400 | The field '{field}' is not indexed in the schema '{schema}'... (truncated) | Mark the field as indexed in the schema and wait for reindexing, or filter on an already indexed field. |
| 400 | Invalid data entity name. | Correct the data entity name in the URL. Invalid characters are rejected. |
| 400 | The request body is empty or is not valid JSON. This response uses the standard validation error format and does not include the Message field. | Send a valid JSON body. |
| 409 | Bulk deletion job creation failed for entity {entity}, returned when a job is already InProgress for this account and data entity. | Track the existing job and resend once its status is Success or Failed. If a job appears stuck, the data entity automatically accepts new jobs after 12 hours. |
| 415 | The Content-Type: application/json header is missing or the media type is not supported. | Send the Content-Type: application/json header. |
| 5xx | Transient infrastructure failure during job creation. | No residual state is left behind, so you can resend the request. |
Permissions
This request requires a valid user token, sent in the VtexIdclientAutCookie header.
Request
- Base URLhttps://apiexamples.vtexcommercestable.com.br
- URLhttps://apiexamples.vtexcommercestable.com.br/api/dataentities/{dataEntityName}/delete
- Auth
- API key in header X-VTEX-API-AppKey and API key in header X-VTEX-API-AppToken
- or API key in header VtexIdclientAutCookie
Path parameters
Name of the data entity.
Query parameters
Name of the VTEX account that owns the data entity (for example, apiexamples).
Headers
Type of the content being sent.
Request body
Response
Accepted
Changes
- info
endpoint added
- info
- breaking
api path removed without deprecation
- breaking