Authentication
Galatext uses API keys for the developer SMS and account endpoints, and bearer JWTs for the customer workspace APIs.
| Credential | Header | Endpoints |
|---|---|---|
| API key | x-api-key: YOUR_API_KEY | /sms/send-api, /developer/balance, /developer/messages, /developer/purchases, /developer/credits/*, /developer/senderids* |
| Access token | Authorization: Bearer YOUR_ACCESS_TOKEN | /sms/campaigns*, /ussd/*, /airtime/*, customer /whatsapp/*, /senderids/download-form |
Obtain an API key
Create a developer account through POST /api/developer/register. Required fields are email, password (at least eight characters), firstName, and lastName. companyName and phoneNumber are optional.
curl -X POST https://api.galatext.com/api/developer/register \
-H 'Content-Type: application/json' \
-d '{"email":"developer@example.com","password":"YOUR_PASSWORD","firstName":"Jane","lastName":"Doe"}'The response contains apiKey, user, and balances. Developer accounts created through this endpoint are active immediately. Existing users can call POST /api/developer/login with email and password to retrieve their API key.
Use the key for SMS:
curl https://api.galatext.com/api/developer/balance \
-H "x-api-key: $GALATEXT_API_KEY"Obtain a bearer token
Call POST /api/auth/login with your account credentials:
const response = await fetch('https://api.galatext.com/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: process.env.GALATEXT_EMAIL,
password: process.env.GALATEXT_PASSWORD,
}),
});
if (!response.ok) throw new Error('Galatext login failed');
const { tokens } = await response.json();
const accessToken = tokens.accessToken;Login returns { user, tokens }. tokens contains accessToken, refreshToken, and expiresIn. The developer login endpoint returns an API key; use /auth/login when you need a JWT.
Send the access token as a bearer header:
curl https://api.galatext.com/api/ussd/applications \
-H "Authorization: Bearer $GALATEXT_ACCESS_TOKEN"For renewal, POST /api/auth/refresh with { "refreshToken": "YOUR_REFRESH_TOKEN" } returns replacement token fields. The SDK does not log in or renew tokens automatically; call client.setAccessToken(newAccessToken) after renewal.
Store credentials
Keep API keys, passwords, and refresh tokens in server environment variables or a secrets store. Browser SDK bundles do not protect embedded credentials. Only use bearer tokens in a browser as part of your authenticated application session.
Request limits
The current gateway applies a burst limit of 10 requests per second and 200 per minute. Registration and login have tighter limits. Handle HTTP 429 and avoid polling rapidly; deployments may configure different limits.