Delete Users and Companies

Userpilot supports data deletion to comply with right to be forgotten under (GDPR), under this right a European user can request to delete all his data. Userpilot supports this right not only for European users, but for all users. You can use Deletion APIs to schedule a job to delete the user data.

These APIs can be called in any language that supports HTTP requests, you only need to specify your api_key and a list of users or companies ids whose data should be deleted.

Authorization

Userpilot API uses API tokens to authenticate requests. You can view your API key in the Environment Page.

Your API key carries many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas.

Authentication to the API is performed via HTTP custom auth token, use -H 'Authorization: token <your API key here>' to add your token.

Note: All API requests must be made over HTTPS.

Version

You have to send the api version in Headers. 

-H 'X-API-Version: 2020-09-22'

A note about base url

for most customers the API base url is https://api.userpilot.io as the examples show.
However, if you are on the Growth or Enterprise plan which uses a custom endpoint, refer to the Installation page in Settings to retrieve your base url.

Delete users API

Send a Delete request to delete users:

curl -X DELETE https://api.userpilot.io/v1/users \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token API_key' \
  -H 'X-API-Version: 2020-09-22' \
  -d '{"users": ["user_id", "user_id2",... // List of users IDs]}'

Delete companies API

Send a Delete request to delete companies:

curl -X DELETE https://api.userpilot.io/v1/companies \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Token API_key' \
  -H 'X-API-Version: 2020-09-22' \
  -d '{"companies": ["company_id", "company_id2",.... // List of companies IDs]}'

Response

Delete APIs will trigger a background job to delete users or companies, a success request will return the job id that corresponds to your delete request.

A success response will have a status of  202 accepted and the following body:

{
    "job": {
        "id": "job_1huAx0ZQLpb2xOkPN6RdflWs0Ub",
        "created_at": 1600850845515,
	"updated_at": 1600850845515,
        "status": "queued"
    },
    "message": "2 users have been scheduled for deletion"
}

View job details

You can follow the status of the job by calling this api, it will return the status of the background job. you need to replace {id} with the value returned in delete API

curl https://api.userpilot.io/v1/jobs/{id} \
  -H 'Authorization: Token API_key' \
  -H 'X-API-Version: 2020-09-22'

Response

{
    "job": {
	"id": "job_1huAx0ZQLpb2xOkPN6RdflWs0Ub",
        "created_at": 1600850845515,
	"updated_at": 1600850845515,   
        "status": "completed"
    }
}

Note: it may take several minutes until we reflect the changes on Userpilot web app (run.userpilot.io) even though the job status is completed.

Rate limit

Please note that these APIs are limited by 600 requests per minute, you can check the limits on response header. If you exceeded the limit we'll return  429 too many requests error

x-ratelimit-limit: 600,
x-ratelimit-remaining: 599,
x-ratelimit-reset: 1600854660000

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.