Precandidates API Guide
Este conteúdo não está disponível em sua língua ainda.
A precandidate is a person record that still needs extra input before full processing can begin. Use the precandidates API when you know which checks you want to run, but you still need Emptor to collect missing data from the candidate. If you want Sol to call the candidate for a screening or their references, start with a precandidate so Emptor can collect the necessary information.
When to use precandidates
Section titled “When to use precandidates”Precandidates are useful when:
- You have contact information (such as email or phone), but you still need fields such as
document_idor another report-specific input. - You want Emptor to host the data-collection form instead of building your own intake flow.
- You want to identify the person record early, then continue the normal BGC flow after the candidate fills the missing information.
- You want to run workflows such as
candidate_screeningorreference_check, where the candidate must first provide information that is collected through the precandidate flow.
Report-specific use cases
Section titled “Report-specific use cases”Some reports depend on the precandidate workflow as part of the operational process, not just as a convenience:
candidate_screening: create a precandidate with aphonenumber, because Emptor must call the candidate as part of the workflow.reference_check: use a precandidate workflow so the candidate can provide the referee information before the check runs.
End-to-end flow
Section titled “End-to-end flow”- Create the precandidate.
- Store
person_id,precandidate_id,form_url, andcountry_code. - Optionally fetch the form schema to learn which fields Emptor will ask for.
- Share the hosted
form_urlwith the candidate, or let Emptor Sol collect the missing data by phone. - Poll the precandidate until it is submitted.
- Continue with the standard person and report endpoints using the same
person_id.
1. Create a precandidate
Section titled “1. Create a precandidate”Use POST /precandidate to create the record and get the hosted form URL.
export API_KEY="your_api_key"export BASE_URL="https://api.emptor.io/v3"
curl --request POST \ --url "$BASE_URL/precandidate" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --header "X-Api-Key: $API_KEY" \ --data '{ "country_code": "PE", "pipeline_name": "test-pipeline-pe", "email": "candidate@example.com", "phone": "+51987654321" }'Example response:
{ "person_id": "09a3446b-bae9-4a03-8a4a-fcec24f784e4", "precandidate_id": "test-precandidate-id", "form_url": "https://dashboard.emptor.io/forms/test-precandidate-id", "reports_enabled": ["document_id_status"], "report_settings": {}, "email": "candidate@example.com", "phone": "+51987654321", "country_code": "PE", "precandidate_status": "CREATED", "pipeline_id": "0ujsszwN8NRY24YaXiTIE2VWDTS", "pipeline_name": "test-pipeline-pe", "created_at": "2023-01-01T12:00:00.000000", "updated_at": "2023-01-01T12:00:00.000000"}The most important fields to persist are:
person_id: the identifier you will later use with the normal person and report endpoints.precandidate_id: the precandidate record identifier.form_url: the hosted Emptor form that collects the missing input.country_code: needed when you switch back to the standard BGC endpoints.
If you are not using a pipeline, you can create a precandidate with
reports_enabled plus report_settings instead.
2. Read the form schema before sending the form
Section titled “2. Read the form schema before sending the form”Use GET /precandidate/{person_id}/schema/{form_id} to see exactly which
fields the hosted form expects.
export PERSON_ID="09a3446b-bae9-4a03-8a4a-fcec24f784e4"export PRECANDIDATE_ID="test-precandidate-id"
curl --request GET \ --url "$BASE_URL/precandidate/$PERSON_ID/schema/$PRECANDIDATE_ID" \ --header "Accept: application/json" \ --header "X-Api-Key: $API_KEY"Example response:
{ "type": "object", "properties": { "document_id": { "type": "string" }, "city_locode": { "description": "2 letter country code and 3 letter city location code.", "type": "string" } }, "required": ["document_id", "city_locode"]}This endpoint is useful when you want to:
- show the candidate which information will be requested,
- validate your own pre-filled data before sending the form,
- understand which fields are missing for the selected pipeline or reports.
3. Track whether the precandidate has been completed
Section titled “3. Track whether the precandidate has been completed”Use GET /precandidate/{person_id} to retrieve the current precandidate
records for that person.
curl --request GET \ --url "$BASE_URL/precandidate/$PERSON_ID" \ --header "Accept: application/json" \ --header "X-Api-Key: $API_KEY"Example response:
[ { "person_id": "09a3446b-bae9-4a03-8a4a-fcec24f784e4", "precandidate_id": "test-precandidate-id", "form_url": "https://dashboard.emptor.io/forms/test-precandidate-id", "reports_enabled": ["document_id_status"], "report_settings": {}, "email": "candidate@example.com", "phone": "+51987654321", "country_code": "PE", "precandidate_status": "SUBMITTED", "pipeline_id": "0ujsszwN8NRY24YaXiTIE2VWDTS", "pipeline_name": "test-pipeline-pe", "created_at": "2023-01-01T12:00:00.000000", "updated_at": "2023-01-01T12:10:00.000000" }]Two integration details matter here:
- This endpoint returns an array, not a single object.
- The public examples show
CREATEDafter creation andSUBMITTEDafter the form is completed. The public spec does not publish a full enum, so your client should handle unknown statuses safely.
4. Resume the normal BGC flow after submission
Section titled “4. Resume the normal BGC flow after submission”User input is completed through the hosted Emptor Dashboard form or by phone with Emptor Sol.
Once the precandidate has been submitted, continue with the standard person and
report endpoints using the same person_id returned at creation time.
Check the person status:
export COUNTRY_CODE="PE"
curl --request GET \ --url "$BASE_URL/$COUNTRY_CODE/persons/$PERSON_ID/status" \ --header "Accept: application/json" \ --header "X-Api-Key: $API_KEY"Get the current report states:
curl --request GET \ --url "$BASE_URL/$COUNTRY_CODE/reports/$PERSON_ID" \ --header "Accept: application/json" \ --header "X-Api-Key: $API_KEY"That lets you keep the same downstream handling you already use for regular BGC persons.
Recommended integration pattern
Section titled “Recommended integration pattern”- Create the precandidate as soon as you know the contact details of a candidate.
- Persist both IDs and the
form_url. - Fetch the schema if you want to show or validate required fields in your own UI.
- Send the candidate to
form_url. - Poll
GET /precandidate/{person_id}until the record is submitted. - Switch to the normal person status and reports endpoints for the rest of the lifecycle.
Common errors
Section titled “Common errors”404 Pipeline not found: the suppliedpipeline_idorpipeline_namedoes not exist for your account.404 Precandidate form not found: theperson_idorform_idpair does not match an existing hosted form.422 Validation failed: the payload shape is valid JSON, but one or more fields do not pass API validation.