Batch CPF lookup
POST/v1/cpf/batch
Sends up to 1,000 CPFs at once. Processing is asynchronous: the API answers 202 with a batch_id and you follow the progress or wait for the webhook.
Request body
- []arrayrequired
- List of 1 to 1,000 items. Repeated CPFs count once.
- [].cpfstringrequired
- CPF, with or without punctuation.
- [].birthdatestringrequired
- Date of birth,
YYYY-MM-DD.
1 credit per item found.
- Your balance must cover the whole batch, unless your plan allows overage. Without enough balance the answer is 402 and the batch does not start.
- Invalid items, not found items and provider failures are not charged. You can resend only the ones that failed.
How a batch is processed
You send the list
The API validates each item and queues the work. The 202 response carries the
batch_id.Fast answers
Whatever was looked up recently is resolved right away. The rest goes to the official source in the background.
You follow progress
Poll
GET /v1/cpf/batch/{id}until the status iscompleted, or receive thebatch.completedevent on your webhook.You read the results
Results come paginated and stay available for 24 hours.
202 response fields
- batch_idstring
- Batch identifier. Use it to follow progress.
- statusstring
processingorcompleted.- totalnumber
- Number of items in the batch.
- processednumber
- Items already resolved.
- found / not_found / invalid / errorsnumber
- Counters per outcome so far.
- status_urlstring
- Path to follow the batch. Also sent in the
Locationheader. - credits_remainingnumber
- Balance after the items already charged. Can be hidden in the dashboard.
cURL
1curl -X POST https://api.brazid.com/v1/cpf/batch \2 -H "x-api-key: $BRAZID_API_KEY" \3 -H "Content-Type: application/json" \4 -d '[{"cpf":"529.982.247-25","birthdate":"1982-11-26"},{"cpf":"11144477735","birthdate":"1990-05-02"}]'
1const res = await fetch('https://api.brazid.com/v1/cpf/batch', {2 method: 'POST',3 headers: {4 'x-api-key': process.env.BRAZID_API_KEY,5 'Content-Type': 'application/json',6 },7 body: JSON.stringify([8 {9 "cpf": "529.982.247-25",10 "birthdate": "1982-11-26"11 },12 {13 "cpf": "11144477735",14 "birthdate": "1990-05-02"15 }16 ]),17});18 19const data = await res.json();20console.log(res.status, data);
1import os2import requests3 4res = requests.post(5 "https://api.brazid.com/v1/cpf/batch",6 headers={"x-api-key": os.environ["BRAZID_API_KEY"]},7 json=[8 {9 "cpf": "529.982.247-25",10 "birthdate": "1982-11-26"11 },12 {13 "cpf": "11144477735",14 "birthdate": "1990-05-02"15 }16 ],17)18 19print(res.status_code, res.json())
1$ch = curl_init("https://api.brazid.com/v1/cpf/batch");2curl_setopt_array($ch, [3 CURLOPT_RETURNTRANSFER => true,4 CURLOPT_CUSTOMREQUEST => "POST",5 CURLOPT_HTTPHEADER => [6 "x-api-key: " . getenv("BRAZID_API_KEY"),7 "Content-Type: application/json",8 ],9 CURLOPT_POSTFIELDS => '[{"cpf":"529.982.247-25","birthdate":"1982-11-26"},{"cpf":"11144477735","birthdate":"1990-05-02"}]',10]);11 12$data = json_decode(curl_exec($ch), true);13$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
202 Accepted
1{2 "success": true,3 "batch_id": "0c1e7f3a-5b2d-4e8a-9c41-6d3f0a8b7e12",4 "status": "processing",5 "total": 2,6 "processed": 1,7 "found": 1,8 "not_found": 0,9 "invalid": 0,10 "errors": 0,11 "status_url": "/v1/cpf/batch/0c1e7f3a-5b2d-4e8a-9c41-6d3f0a8b7e12",12 "credits_remaining": 1913}