DELETE - Remove

Note: The Custom Data API is a feature included in Premier and Enterprise plans.

Request structure

The users data endpoint allows you to delete user data either for one user, or for multiple users.

Important Note: Any data changed by calling this API will not be available in real time: processing time can be requires. See this section for more info.

Route

The custom data API exposes two DELETE endpoints:

  • https://api.batch.com/1.0/BATCH_API_KEY/data/users/YOUR_USER_ID for a single delete
  • https://api.batch.com/1.0/BATCH_API_KEY/data/users for bulk deletes

NOTE: YOUR_USER_ID is a custom id as described here for iOS and here for Android.

Bulk delete allow you to remove custom data for multiple users with one API call.

Here are two valid cURL examples.

Single delete:

curl -H "Content-Type: application/json" -H "X-Authorization: BATCH_REST_API_KEY" -X DELETE "https://api.batch.com/1.0/BATCH_API_KEY/data/users/YOUR_USER_ID"

Bulk deletes:

curl -H "Content-Type: application/json" -H "X-Authorization: BATCH_REST_API_KEY" -X DELETE -d "@payload.json" "https://api.batch.com/1.0/BATCH_API_KEY/data/users"

The BATCH_API_KEY value is either your Live, Dev or SDK Batch API key from the settings page of your app within the dashboard (Settings → General). You can find it in ⚙ Settings → General.

Headers

In order to authenticate with the API, you need to provide your company REST API Key as the value of the X-Authorization header. You can find it in ⚙ Settings → General.

Single delete

For a single delete, there is no payload. You only need to provide the user id in the route.

Bulk deletes

For bulk deletes, you need to provide a valid JSON payload containing the list of user ids for whom to remove the custom data.

Here is a how a complete JSON payload looks like:

["user1", "user2", "user3"]

NOTE: there is a limit of 10000 user ids per API call.

Responses

Success

If the DELETE to the API endpoint is successful you will receive an HTTP 200 confirmation and a unique token reprensenting the transaction.

{ "token": "fd576e9f-8b07-4844-91f9-ecfc2137c6f8" }

Please keep this token: it will be useful for upcoming features, and it will also help in getting faster support.

Failure

If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at support@batch.com if you need further support.

  • AUTHENTICATION_INVALID (Http status code: 401, Error code: 10)
  • API_MISUSE (Http status code: 403, Error code: 12)
  • ROUTE_NOT_FOUND (Http status code: 404, Error code: 20)
  • MISSING_PARAMETER (Http status code: 400, Error code: 30)
  • MALFORMED_PARAMETER (Http status code: 400, Error code: 31)
  • MALFORMED_JSON_BODY (Http status code: 400, Error code: 32)
  • SERVER_ERROR (Http status code: 500, Error code: 1)
  • MAINTENANCE_ERROR (Http status code: 503, Error code: 2)