Authentication¶
Every request needs your API key in the Authorization header:
Generate the key on the dashboard under Settings. See Generate your API key.
The key¶
Keys look like dlp_aH4sp2Ki.Xb7Qm2Kp9Lr4…:
| Part | Meaning |
|---|---|
dlp_ |
Marks it as a DIYLaw Partners key, which helps secret scanners find leaked keys. |
aH4sp2Ki |
The key's public prefix. The dashboard shows it so you can tell keys apart. |
after the . |
The secret. It's shown once, when you generate the key. |
Send the whole key, prefix included, exactly as copied.
Check your key¶
Call Me to confirm which account a key belongs to:
GEThttps://partners.diylaw.ng/api/account/v1/Me
{
"organization": "Acme Payments",
"email": "[email protected]",
"key": "dlp_7KQ2MX4R.••••••••"
}
Keep the key safe¶
Anyone with your key can create orders on your account and read their personal data.
- Call the API only from your server. Never put the key in a website, mobile app or anything else a customer can download.
- Store it as a secret: an environment variable or a secrets manager. Not in source code or a shared Postman workspace.
- Don't log it. Strip the
Authorizationheader from request logs and error reports. - Use HTTPS only. If a request ever goes out over plain
http://, treat the key as exposed. - Regenerate it if you think it has leaked, and when people with access to it leave. See Regenerate or revoke your key.
When authentication fails¶
The API returns 401 Unauthorized with a detail message:
detail |
Cause |
|---|---|
Authentication credentials were not provided. |
No Authorization header, or it doesn't start with Bearer. |
Invalid API key. |
The key is wrong, incomplete, or has been regenerated or revoked. |
API access is not enabled for this account. |
DIYLaw has paused API access for your account. Contact your DIYLaw account manager. |
Invalid Authorization header. Expected: Bearer <api key>. |
Extra spaces or words in the header. |
Don't retry a 401 automatically. It won't succeed until the key is fixed.