Authentication
Authenticate every request with your application's API key; each environment has its own key, channels and permissions.
Every request carries your API key in the Authorization header:
Authorization: Bearer <your-api-key>
One key per environment
Each application gets two independent API keys, one per environment. The key defines the environment, the sender and the enabled channels.
| Environment | Prefix | Behavior |
|---|---|---|
| UAT | dlv_test_ |
Real sending only to recipients authorized by Piensa IT. Any other recipient is recorded with status blocked and does not go out. |
| PRD | dlv_live_ |
Real sending, without restriction. |
Use the UAT key in your development and test environments, and the PRD key only in production.
What a key allows
- Channels: a key can only send on the channels enabled for it. Otherwise the API answers
403withCANAL_NO_PERMITIDO. - Free-form content: sending
contentwithout a template requires permission on the key. Otherwise the API answers403withCONTENIDO_LIBRE_NO_PERMITIDO.
Check your key
GET /v1/me tells you which application, sender, environment and channels the key has. The responses of GET /v1/me and POST /v1/messages also carry the x-deliver-ambiente header.
curl https://deliver.piensait.com/api/v1/me -H "Authorization: Bearer $DELIVER_API_KEY"
# 200 OK
{
"aplicacion": "app-lynx",
"emisor": "piensa-it",
"ambiente": "uat",
"canales": ["email", "sms"],
"permite_contenido_libre": false
}Never ship a key to the browser
Keys are secrets. Call Deliver from your backend, never from a web or mobile client.
Getting or revoking a key
Piensa IT issues and revokes keys. Ask for a new key when you add an application or environment, and for revocation if a key may have leaked. A revoked key answers 401 with CLAVE_INVALIDA.