Create User - POST
This endpoint allows you to create a new user. You can then use this user_id
to create an account or retrieve the accounts that have already been created.
Once you complete your onboarding with Palenca, you'll be given the API Keys and also a widget_id
(It can be found in your console also). This widget_id
is a mandatory field to create Users. You will be able to create more than one widget and organize your users by creating them under different values of widget_id
.
This endpoint is only useful for creating accounts in IMSS or ISSSTE. All other platforms will require the use of Palenca Link or its widget in order to create an account.
To create a user, you need to make a POST
request to the endpoint
POST https://api.palenca.com/v1/users
Here are some examples in different languages:
- JavaScript
- Python
- curl
const axios = require('axios')
const data = JSON.stringify({
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
});
const config = {
method: 'POST',
url: 'https://api.palenca.com/v1/users',
headers: {
'x-api-key': 'private_api_key',
'Content-Type': 'application/json'
},
data: data
};
(async () => {
try {
const {data} = await axios(config)
console.info(JSON.stringify(response.data))
} catch (error) {
console.error(error)
}
})()
import requests
url = 'https://api.palenca.com/v1/users'
payload = {
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
}
headers = {
'x-api-key': 'private_api_key',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
curl --location --request POST 'https://api.palenca.com/v1/users' \
--header 'x-api-key: private_api_key' \
--header 'Content-Type: application/json'
--data-raw '{
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
}'
Returns a JSON structured like this:
{
"success": true,
"error": null,
"data": {
"user_id": "054d0a9d-38ec-40cb-a31c-09b483242e4a",
"external_id": "4a0e32bd-c3df-4172-a89d-f173d6816926",
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
}
}
You will need this user_id
later on to make other requests to the API so make sure you save it.
Payload
Parameter | Description | Type | Required | Example |
---|---|---|---|---|
widget_id | Widget ID | uuid | True | feecb679-a3cc-47ef-8fd4-600799f12a39 |
Specifying User External ID
You can specify your own internal id when creating a user.
We will keep this information and return it to you when you get the user later on.
Just add the key external_id
to the request payload.
import requests
url = 'https://api.palenca.com/v1/users'
payload = {
"external_id": "12345",
"widget_id": "feecb679-a3cc-47ef-8fd4-600799f12a39"
}
headers = {
'x-api-key': 'private_api_key',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)