Appearance
Authentication
To use the realay.io API, you must provide a valid API key with each request.
Obtaining Your API Key
- Log in to your realay.io Dashboard.
- Navigate to the API Keys section from the main menu.
- Click "Generate New Key".
- Copy the generated key immediately and store it in a secure location. For security reasons, the full key will not be shown again.
Treat your API key like a password. Do not expose it in client-side code or commit it to version control.
Using Your API Key
The API uses Bearer Token authentication. You must include your API key in the Authorization header of every request.
The header should be formatted as follows:
Authorization: Bearer YOUR_API_KEY
Replace YOUR_API_KEY with the key you generated in your dashboard.
Example: Authenticated cURL Request
bash
curl -X POST https://api.realay.io/v1/api/send/sms \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d
"{
"recipient": "+61400123456",
"originator": "realay.io",
"text": "This is an authenticated request."
}"Handling Authentication Errors
If your API key is missing, invalid, or expired, the API will return a 401 Unauthorized HTTP status code with an error response like this:
json
{
"errorCode": "UNAUTHORIZED",
"message": "Authentication required. Invalid or expired token."
}If you receive this error, please verify that you are using the correct API key and that it is correctly formatted in the Authorization header.
