Skip to main content

Quick Start

The only thing you need to start using Palenca is a user account and an API Key. You can get them here.

info

We have 2 environments: Sandbox and Production. For a complete reference on all our API routes click here.

https://sandbox.palenca.com/v1
https://api.palenca.com/v1

1. Get your API Key

In order to make any request to the API, you will need to identify yourself using your private API Key. This should be sent in the headers as x-api-key.

--header 'x-api-key:private_api_key'\
--header 'Content-Type: application/json'

2. Create your first connection

In this step we will create a user (which represents a worker) and an account (which represents a connection to the IMSS) by making a POST request to the endpoint /users /accounts. This request must include in the payload the CURP of the worker (identifier parameter) and the platform where we will establish the connection (in this case IMSS). Don't forget to include the private key in the headers.

curl --location --request POST 'https://sandbox.palenca.com/v1/users/accounts' \
--header 'x-api-key: YOUR_PRIVATE_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"identifier": "WORKER_CURP",
"country": "mx",
"platform": "imss"
"widget_id": "YOUR_WIDGET_ID" // if empty, the default widget will be used
}'

If everything worked correctly, you should see a response like this and the process to obtain employment data has started:

{
"success": True,
"error": None,
"data": {
"user_id": "054d0a9d-38ec-40cb-a31c-09b483242e4a",
"country": "mx",
"platform": "imss",
"account_id": "472f02e8-6b24-43a7-b529-3f71d6ecc81c"
}
}

3. Get employment data

The process of obtaining the worker's employment data depends on each platform (on average 10 seconds). Once this time has passed, we are ready to recover the worker's employment history. To do this, we need to make a GET request to /accounts/{account_id}/employment. You will be able to see a list of the companies in which this user has worked, the federal entities and their salaries.

curl --location --request GET 'https://sandbox.palenca.com/v1/accounts/:account_id/employment' \
--header 'x-api-key: YOUR_PRIVATE_API_KEY' \
--header 'Content-Type: application/json'

4. Integrate a Webhook

In order not to depend on Palenca's response time (~10 seconds) and have to wait for the employment data to be ready, we recommend implementing a Webhook that will allow you to receive a notification once the data is available for consultation.

info

See the guide for implementing webhooks here. If you need help in your implementation, click here