Every request must carry your account credentials. There are two ways to send them:
| Method | Header | Use it when |
|---|---|---|
| X-API-Key (recommended) | X-API-Key: <key> | You are building a new integration. It is one value with no encoding step. |
| HTTP Basic | Authorization: Basic <base64> | Your HTTP client or platform only supports username and password. |
Get your credentials
Open Integrations → API Keys in DirectIQ. You will find:
- X-API-Key, for X-API-Key authentication.
- Client ID and Client Secret, for HTTP Basic authentication.
Option 1: X-API-Key (recommended)
Send your key in the X-API-Key header:
curl https://api.directiq.com/v2/senders \
-H "X-API-Key: YOUR_X_API_KEY"
One key, two usesThe X-API-Key is also the password for the DirectIQ SMTP gateway. If you regenerate it, update both your API integration and your SMTP settings.
Option 2: HTTP Basic
Use your Client ID as the username and your Client Secret as the password. Most HTTP clients build the header for you:
curl https://api.directiq.com/v2/senders \
-u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"To build the header yourself, Base64-encode client_id:client_secret and send it with the Basic scheme:
Authorization: Basic WU9VUl9DTElFTlRfSUQ6WU9VUl9DTElFTlRfU0VDUkVU
Send one method per requestIf a request includes both headers, the API uses
X-API-Keyand ignoresAuthorization.
When authentication fails
Missing or invalid credentials return 401 Unauthorized. Check that:
- the header name is spelled exactly
X-API-Key, or that the scheme isBasic; - the value has no extra spaces or line breaks;
- the key has not been regenerated since you copied it.
Repeated failed attempts from the same IP address can get that address blocked for a while.
Keep your credentials secure
- Call the API from your server only. Never put credentials in browser code, mobile apps or public repositories.
- Store them in environment variables or a secrets manager, not in source code.
- If a credential leaks, regenerate it on the API Keys page. The old value stops working immediately, so deploy the new value right away.

