REST endpoints
Every endpoint is under /v1 and takes an API key as a Bearer token in the Authorization header. Send and expect JSON. A successful response holds its result in data; a failed one holds an error, described under Errors.
POST /v1/messages
Send a transactional or OTP SMS from a Sender ID to a list of phone numbers.
- Scopes:
messages.send - Success:
202
Headers
| Name | Type | Required | Rules | Description |
|---|---|---|---|---|
Idempotency-Key |
string | Yes | max:100 |
repeating the send with the same key within 24 hours returns the first result |
Body
| Name | Type | Required | Rules | Description |
|---|---|---|---|---|
sender |
string | Yes | max:20 |
a masking name such as "DELIVA", or a number |
messageCategory |
string: transactional, otp |
Yes | "transactional" or "otp"; promotional text goes in a Campaign | |
text |
string | Yes | max:2000 |
up to 10 Parts; Bangla and other non-GSM characters make it Unicode |
recipients |
array of string | Yes | list, max:10000, each: max:32 |
phone numbers, such as "01712345678" or "+8801712345678" |
Response data
| Field | Type | Description |
|---|---|---|
batchIds |
array of string | the Batches the send was split into; webhook events name them as batch_id |
recipients |
integer | how many Messages were accepted, one per Recipient |
parts |
integer | the Parts of all of them together |
reservedMicroTaka |
integer | the money set aside for them, in millionths of a taka; charged on Submission |
status |
string | "queued": accepted, not yet delivered; "held": waiting for GioSMS to review it |
holdReason |
string or null | why it was held: its text, or a send unusually large or fast for the Account |
Errors: idempotency_key_required, unauthenticated, forbidden, ip_not_allowed, idempotency_key_in_progress, validation_failed, idempotency_key_reused, rate_limited, server_error
GET /v1/messages/{messageId}
Show one of this Account’s messages and what happened to it.
- Scopes:
messages.view - Success:
200
Path parameters
| Name | Type | Required | Rules | Description |
|---|---|---|---|---|
messageId |
string | Yes | uuid |
the Message ID a send’s webhook events name as message_id |
Response data
| Field | Type | Description |
|---|---|---|
id |
string | the Message ID |
recipient |
string | E.164, such as "+8801712345678" |
sender |
string | the Sender ID it was sent from |
text |
string | the text it carried |
messageCategory |
string | "transactional", "otp" or "promotional" |
operator |
string | the Recipient's mobile Operator, such as "grameenphone" |
parts |
integer | the Parts its text takes |
status |
string | "queued", "submitted", "delivered", "undelivered", "unknown" or "not_sent" |
reason |
string or null | why it was not sent, for a not_sent Message |
errorCode |
string or null | the Operator's error code from an undelivered report |
price |
string | every Part at the Customer price, in taka, such as "0.70" |
campaignId |
string or null | the Campaign that sent it, if one did |
acceptedAt |
string | when GioSMS accepted it, ISO 8601 |
submittedAt |
string or null | when it was handed to a Provider, ISO 8601 |
reportedAt |
string or null | when the Operator reported on it, ISO 8601 |
Errors: unauthenticated, forbidden, ip_not_allowed, not_found, rate_limited, server_error
GET /v1/balance
Show this Account’s Wallet balance: available, reserved and any credit limit.
- Scopes:
billing.view - Success:
200
Response data
| Field | Type | Description |
|---|---|---|
walletId |
string or null | null before the first Recharge opens the Wallet |
available |
string | what may be spent |
reserved |
string | held for messages accepted but not yet charged |
creditLimit |
string | how far below zero available may go; "0.00" when prepaid |
Errors: unauthenticated, forbidden, ip_not_allowed, rate_limited, server_error
Scopes
An API key holds one or more scopes. Each endpoint above lists the scopes that let a key call it.
| Scope | Lets a key |
|---|---|
messages.send |
Send messages |
messages.view |
Read message status |
billing.view |
Read the balance |
Errors
Every error has the same shape. error.errors appears only with validation_failed, listing the messages for each invalid field. Quote the correlationId when you contact support.
{
"error": {
"code": "validation_failed",
"message": "The request is invalid.",
"errors": { "sender": ["The sender field is required."] }
},
"correlationId": "0193a6f3-1c2d-7e3f-9a4b-6c7d8e9f0a1b"
}
| Code | Status | When |
|---|---|---|
bad_request |
400 | The request is malformed in a way no other code covers. |
idempotency_key_required |
400 | A sending endpoint was called without an Idempotency-Key header, or with one longer than 100 characters. |
unauthenticated |
401 | The Authorization header holds no API key, or one that is unknown, revoked or expired. |
forbidden |
403 | The API key lacks the scope the endpoint needs. |
ip_not_allowed |
403 | The API key has an IP allowlist and the request came from another address. |
not_found |
404 | Nothing exists at that path, or it belongs to another Account. |
method_not_allowed |
405 | The path exists but not with that HTTP method. |
idempotency_key_in_progress |
409 | An earlier request with the same Idempotency-Key is still running. Retry shortly. |
validation_failed |
422 | A field is missing or invalid. error.errors lists the messages for each field. |
idempotency_key_reused |
422 | The Idempotency-Key was already used with a different body. |
rate_limited |
429 | The key or the Account made too many requests this minute. Wait for Retry-After seconds. |
server_error |
500 | GioSMS failed. Retrying with the same Idempotency-Key is safe. |