Send messages
The message item
Section titled “The message item”An item is one message to one recipient. SendServiceMessage and SendServiceMessages both send items.
| Item field | Rule |
|---|---|
to.type, to.value |
Required. The recipient’s identifier. See the table below. |
idempotencyKey |
Recommended. Your own key for this message, at most 128 characters. |
content |
Required. The body: {"text":{"text":"…","textAr":"…"}}. |
serviceUpdate |
Optional. Without it the item is a plain message. With it the item is a notice, or a one-time code with kind SERVICE_KIND_CODE. See Notices and one-time codes. |
to.type |
to.value |
Example |
|---|---|---|
SERVICE_RECIPIENT_TYPE_MSISDN |
The phone number in E.164 format | +971501234567 |
SERVICE_RECIPIENT_TYPE_EMIRATES_ID |
The 15 digits of the Emirates ID, with or without separators | 784-1990-1234567-1 |
SERVICE_RECIPIENT_TYPE_USERNAME |
The resident’s 1.ae handle, with or without @ |
omar |
SERVICE_RECIPIENT_TYPE_ACCOUNT_ID |
A 1.ae account ID | 3f2b… |
The outcome of an item
Section titled “The outcome of an item”Each item gets its own result with an outcome. The values have the prefix SERVICE_SEND_OUTCOME_. A failed item does not stop the other items.
| Outcome | Meaning | What to do |
|---|---|---|
SENT |
The message is in the resident’s conversation. A notice has a noticeId. |
Store the noticeId to read the state later. |
QUEUED |
Batch only. 1.ae accepted the item and has not sent it yet. | Read the batch later. |
NO_ACCOUNT |
No active 1.ae resident has this identifier. 1.ae records a failed notice. | Use your other channels for this person. |
REFUSED |
The resident has blocked your organization. 1.ae records a failed notice. | Do not send again on 1.ae. |
INVALID |
The item breaks a rule. errorCode is invalid_argument and error says why. |
Correct the item. |
ERROR |
The send failed for another reason, for example the daily limit for this resident. errorCode says which. |
See Errors and retries. |
EXPIRED |
Batch only. The item’s expiresAt passed before its turn. Not sent. |
Send again with a new expiry if it still matters. |
CANCELLED |
Batch only. You cancelled the batch before this item was sent. | Nothing. |
The API does not tell you which account an identifier belongs to. It tells you only whether the message reached the resident.
Idempotency keys
Section titled “Idempotency keys”If you send an item again with the same idempotencyKey, 1.ae returns the first result and sends nothing. A retry after a timeout or a network error is therefore safe.
- A key is used once for your organization, across all the send calls.
- A repeat of a failed item returns the same failure. 1.ae does not look up the recipient again. To try that recipient again later, use a new key.
- Make the key from your own job and record numbers, for example
<job id>/<row number>. Do not put a phone number, an Emirates ID or a name in it.
Send one message
Section titled “Send one message”SendServiceMessage takes one item and answers when the message is in the resident’s conversation.
curl -s https://api.1.ae/horizon.apis.chat.v1.ChatService/SendServiceMessage \ -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \ -H "Connect-Protocol-Version: 1" \ -d '{"item": { "to": {"type": "SERVICE_RECIPIENT_TYPE_MSISDN", "value": "+971501234567"}, "idempotencyKey": "signin-88231", "content": {"text": { "text": "Use this code to sign in to the services portal.", "textAr": "استخدم هذا الرمز لتسجيل الدخول إلى بوابة الخدمات."}}, "serviceUpdate": {"kind": "SERVICE_KIND_CODE", "title": "Your sign-in code", "titleAr": "رمز تسجيل الدخول", "code": "482913"}}}'{"result": {"outcome": "SERVICE_SEND_OUTCOME_SENT", "conversationId": "ee9a94fa-…", "messageId": "…", "noticeId": "a4247258-…", "position": {"conversationId": "ee9a94fa-…", "seq": "4"}}}A result that is not SENT gives the outcome and the reason, as in the outcome table. The call fails only for a problem with the whole request, for example a wrong key or a quota. See Errors and retries.
Send a batch
Section titled “Send a batch”SendServiceMessages takes up to 500 items. 1.ae checks each item and answers at once with a batchId. Each valid item gets QUEUED and a noticeId. Each refused item gets INVALID. 1.ae sends nothing before the answer.
curl -s https://api.1.ae/horizon.apis.chat.v1.ChatService/SendServiceMessages \ -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \ -H "Connect-Protocol-Version: 1" \ -d '{"batchKey": "renewals-2026-10-29/1", "items": [ {"to": {"type": "SERVICE_RECIPIENT_TYPE_EMIRATES_ID", "value": "784-1990-1234567-1"}, "idempotencyKey": "renewals-2026-10-29/000001", "content": {"text": {"text": "Your licence renewal is approved.", "textAr": "تمت الموافقة على تجديد رخصتك."}}, "serviceUpdate": {"title": "Licence renewed", "titleAr": "تم تجديد الرخصة", "reference": "REN-2026-004211"}}, {"to": {"type": "SERVICE_RECIPIENT_TYPE_USERNAME", "value": "omar"}, "idempotencyKey": "renewals-2026-10-29/000002", "content": {"text": {"text": "Your renewal needs one more document.", "textAr": "يحتاج تجديدك إلى مستند واحد إضافي."}}, "serviceUpdate": {"title": "Document needed", "titleAr": "مطلوب مستند"}}]}'{"batchId": "b81f…", "state": "SERVICE_BATCH_STATE_ACCEPTED", "accepted": 2, "results": [ {"outcome": "SERVICE_SEND_OUTCOME_QUEUED", "noticeId": "a4247258-…"}, {"index": 1, "outcome": "SERVICE_SEND_OUTCOME_QUEUED", "noticeId": "72920666-…"}]}- 1.ae sends the items at your batch rate. Your organization’s batches run one at a time, in the order that 1.ae accepted them.
- A one-time code is
INVALIDin a batch, because it can expire while it waits. Send codes withSendServiceMessage. - An item with an
expiresAtthat passes while it waits ends asEXPIREDand is not sent. batchKeyis optional. For 24 hours, a repeat with the same key and the same items returns the first answer and queues nothing. A repeat with the same key and different items fails withalready_exists.- The request is at most 4 MiB. 500 items fit when each text has about 500 characters in each language. For longer texts, send smaller batches.
Read the batch
Section titled “Read the batch”GetServiceBatch returns the batch state, the count for each outcome, and a page of item results in index order.
curl -s https://api.1.ae/horizon.apis.chat.v1.ChatService/GetServiceBatch \ -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \ -H "Connect-Protocol-Version: 1" \ -d '{"batchId": "b81f…", "fromIndex": 0, "limit": 500}'{"batchId": "b81f…", "state": "SERVICE_BATCH_STATE_DONE", "itemCount": 2, "counts": {"sent": 1, "noAccount": 1}, "results": [ {"outcome": "SERVICE_SEND_OUTCOME_SENT", "conversationId": "…", "messageId": "…", "noticeId": "a4247258-…"}, {"index": 1, "outcome": "SERVICE_SEND_OUTCOME_NO_ACCOUNT", "noticeId": "72920666-…"}], "createdAt": "2026-10-29T09:00:00Z", "finishedAt": "2026-10-29T09:00:01Z"}| State | Meaning |
|---|---|
ACCEPTED |
The batch is queued. No item has run yet. |
RUNNING |
1.ae is sending the items. |
DONE |
Every item has an outcome. |
CANCELLED |
You cancelled the batch. Items not sent are CANCELLED. |
- When
nextIndexis in the response, read the next page withfromIndexset to it. - 1.ae keeps the item results for 7 days. After that,
itemsExpiredis true. 1.ae keeps the counts for 90 days. - Read a batch at most once every few seconds. Read a large batch less often.
To stop a batch, call CancelServiceBatch with {"batchId":"b81f…"}. Every item not yet sent ends as CANCELLED. Items already sent stay sent.