Skip to content
Last updated

Authentication

All API requests to the WhatsApp Gateway must be authenticated using both Basic Auth credentials and an API key provided by Namirial support.

How to authenticate

Basic Auth

Include your credentials in every request using HTTP Basic Authentication:

Authorization: Basic <base64(username:password)>

API key

Include your API key in every request using the X-Api-Key header:

X-Api-Key: <your-api-key>

Example (curl)

curl -X POST "https://wa.namirialtsp.com/api/services/send" \
  -H "Authorization: Basic <base64(username:password)>" \
  -H "X-Api-Key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Troubleshooting authentication issues

HTTP StatusError codeError typeSolution
4011AuthenticationFailedExceptionVerify your Basic Auth credentials for the target environment
4019MissingApiKeyExceptionThe X-Api-Key header is missing. Add it to your request
4019InvalidApiKeyExceptionThe X-Api-Key value is not valid. Verify the key for the target environment
4036ForbiddenExceptionYour account does not have the required permissions. Contact Namirial support

Example — invalid credentials (code 1):

{
  "type": "AuthenticationFailedException",
  "code": 1,
  "message": "Invalid credentials"
}

Example — insufficient role (code 6):

{
  "type": "ForbiddenException",
  "code": 6,
  "message": "Current role [USER], missing role [ADMIN, TEMPLATE_ADMIN]"
}

HTTP 403 is returned when the account is authenticated but does not have the required role.

Example — missing API key (code 9):

{
  "type": "MissingApiKeyException",
  "code": 9,
  "message": "Missing API key"
}

Example — invalid API key (code 9):

{
  "type": "InvalidApiKeyException",
  "code": 9,
  "message": "Invalid API Key"
}

How to get API credentials

Submit a request through the Namirial support portal.