To use Dfns API endpoints, you will generally need to:Documentation Index
Fetch the complete documentation index at: https://docs.dfns.co/llms.txt
Use this file to discover all available pages before exploring further.
1. Get an authentication token
Login and obtain an Authentication tokens (also referred to as token) to present when calling our API.| Header | Description |
|---|---|
Authorization: Bearer <token> | Authentication token (see Authentication flows) |
- as a User (human 👨)
- Follow the Login flow. You’ll get a authentication token at the end of this flow, which expires after a relatively short period of time.
- Create a Personal Access Token (PAT) 1, which is a long-lived authentication token for the User, and that you can use as an authentication token directly.
- as a Service Account (machine 🤖)
- Create a Service Account Token 1, which is a long-lived authentication token for the Service Account, and that you can use as an authentication token directly.
Authorization header for the next step of the registration (example).
2. Sign API requests (User Action Signing)
Sign a User Action Challenge using a cryptographic key that you own (referred to Credential Key or just Credentials). This is only required for actions which mutate state (non-readonly API calls). We call that process: “User Action Signing”.| Header | Description |
|---|---|
X-DFNS-USERACTION: <user-action-signature> | One time signature (see User Action Signing flows) |
- You tell Dfns “I want to perform this exact request”
- Dfns sends you back a challenge to be signed with your Credential.
- You sign the challenge with your Credentials, and send it to Dfns.
- Dfns gives you back a “user action signature”, which you’ll need include in the headers when you perform the actual request (
X-DFNS-USERACTIONheader)
Getting current user info
There is no/me or /whoami API endpoint. Instead, decode the JWT token to extract user information. You can use jwt.io for debugging or any JWT library in your code.
Decoding the token
| Field | Description |
|---|---|
https://custom/username | The user’s email address |
https://custom/app_metadata.userId | The user’s ID |
https://custom/app_metadata.orgId | The organization ID |
exp | Token expiration time (Unix timestamp) |
Common errors
See Error codes for a full list of errors. Here are the most common authentication errors:401 Unauthorized
YourAuthorization header is missing, malformed, or the token is invalid/expired.
Solutions:
- Verify the token is included as
Authorization: Bearer <token> - Check the token hasn’t expired - decode it at jwt.io and check the
expfield - Ensure you’re using the correct region (
api.dfns.iovsapi.uae.dfns.io)
403 User action signature is missing
You’re calling a state-changing endpoint (POST, PUT, DELETE) without theX-DFNS-USERACTION header.
Solutions:
- Follow the User Action Signing flow to get the signature
- If using Postman, ensure the pre-request script is running - see Postman setup
- If using the SDK, ensure you’ve configured a signer - see SDKs
