Authentication
Exchange your service account credentials for a short-lived token, then use it on every API call.
Credentials
Create a service account in the portal to get a pair of credentials:
| Credential | Format | Notes |
|---|---|---|
api_key_id | mvk_id_... | Identifies the service account. Safe to store alongside your config |
api_key_secret | mvk_sec_... | Shown once, at creation. Store it in a secret manager and never commit it |
If you lose the secret you cannot recover it, but you can regenerate the pair from the portal. Regenerating invalidates the old secret immediately.
Get a token
Exchange the credentials for a JWT. Tokens are valid for 1 hour.
curl -X POST https://api.mailverick.com/v1/token \
-H "Content-Type: application/json" \
-d '{
"api_key_id": "mvk_id_xxxxxxxxxx",
"api_key_secret": "mvk_sec_xxxxxxxxxx"
}' {
"access_token": "eyJhbGciOi...",
"expires_in": 3600,
"token_type": "Bearer"
} | Field | Type | Description |
|---|---|---|
access_token | string | The bearer token to send on subsequent requests |
expires_in | number | Lifetime in seconds |
token_type | string | Always Bearer |
Use the token
Pass it in the Authorization header on every call to a protected endpoint.
curl -X POST https://api.mailverick.com/v1/send-email \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{ ... }' Exchange a new token before the old one expires. Do not request one per API call: the exchange is deliberately slower than a normal request, and a token is reusable for its full hour. Our Node.js SDK handles the exchange and refresh for you.
Permissions
Each service account carries its own set of permissions, so you can scope a key to exactly what it needs. A key embedded in a signup form should not be able to send mail.
| Permission | Grants |
|---|---|
email:send | Send Email, and SMTP submission |
email:validate | Email Validation |
A call to an endpoint the key is not scoped for returns 403, whatever the token's other permissions are. You can create up to 3 service accounts per organization.
Errors
| Status | When |
|---|---|
400 | Missing or malformed credentials in the exchange request |
401 | Unknown key ID or wrong secret |
401 | On a protected endpoint: missing, malformed, or expired token |
403 | Valid token, but the service account lacks the permission for that endpoint |
503 | We could not check the credentials right now. The key is fine, so retry rather than rotate it |
SMTP
SMTP submission does not use tokens. Authenticate with the same credentials directly, using the key ID as the username and the secret as the password. See Send Email for host and port settings.
What's next
With a token in hand you can send email or validate an address.