Build with the O My Syria interfaces available today
Use the implemented REST contract and restricted web Widget safely. This documentation is explicit about what is available now and what remains planned.
Quick start
Check the API in one request
The public system ping is the smallest safe request for checking that the API is reachable and ready. It needs no key.
- 1Open a terminal (or point the request at your own deployment's origin).
- 2Send the request from your terminal.
- 3Expect a 200 response with the standard data envelope.
curl --request GET "https://omysyria.com/v1/system/ping"Authentication boundaries
Choose credentials by endpoint, not by convenience
Every operation in the reference declares its actual security scheme. Credentials remain scoped to one purpose and must never be exchanged for another.
Server secret API key
Trusted backends call POST /v1/answers with X-AHS-API-Key and no browser Origin. An optional exact IP allowlist can restrict the source. Never place this secret in browser or mobile code.
Management session
Dashboard and management routes use the secure ahs_session cookie. State-changing browser requests also require the paired X-CSRF-Token header. These routes are not a server-key API.
Publishable Widget key
Widget routes accept X-AHS-Publishable-Key only from an allowed browser origin. Conversation operations also use a short-lived X-AHS-Conversation-Token. A publishable key is restricted, browser-visible, and not an administrative secret.
Trusted backend storage only
Never send the server key or conversation reference to browser code, mobile apps, or logs. Treat conversation_ref as opaque metadata and do not place customer questions or O My Syria answers in operational logs.
Base URLs and environments
Test and Production share one base URL; the server key you send decides which environment answers.
Production environment
Productionhttps://omysyria.com
Requires an ahs_sk_live_... server key.
Test environment
Testhttps://omysyria.com
Same base URL with an ahs_sk_test_... key for the Test environment.
Available Messages endpoints
These are the endpoints your platform or mobile app uses to send customer questions and receive answers grounded in your knowledge.
Send a message and get the answer
Send a customer question and receive a grounded answer, with multi-turn context and idempotent retries.
End and delete a conversation
Delete retained conversation history by its opaque reference when the session ends or the customer asks.
Code samples and ready client helpers
Pick a scenario and a language to copy integration code or a full client wrapper.
curl --request POST "https://omysyria.com/v1/answers" \
--header "Content-Type: application/json" \
--header "X-AHS-API-Key: ahs_sk_live_••••••••••••" \
--data '{
"message_id": "support-msg-101",
"question": "كيف أسحب رصيدي من المحفظة؟",
"language": "ar"
}'Response envelope (200 OK)
200 OK{
"data": {
"status": "grounded",
"answer": "يمكنك سحب الرصيد المتاح من صفحة المحفظة في التطبيق: اختر طلب سحب ثم أدخل البيانات البنكية المطلوبة.",
"conversation_ref": "ahs_conv_live_9f83a27e01b44298a0c6d9124e8371b29a8f",
"message_id": "support-msg-101",
"handoff_suggested": false,
"citations": [
{
"citation_id": "cite_01",
"source_filename": "wallet-and-payouts.md"
}
]
}
}Conversation flow
How multi-turn memory works across requests with the opaque conversation_ref.
- 1
First turn
Send question and a unique message_id without conversation_ref. O My Syria returns the answer and a conversation_ref.
- 2
Store the reference
Your server stores conversation_ref next to the customer’s support session.
- 3
Follow-up turns
Send the next question with conversation_ref and a new message_id so the dialogue context is kept.
- 4
Handoff or end
If handoff_suggested is true, route the customer to a human agent; call DELETE when the session ends.
Parameters and fields
Field constraints, accepted patterns and payload limits for each request and response.
Request headers
| Header | Status | Description and constraints |
|---|---|---|
| X-AHS-API-Key | Required | Server secret API key (ahs_sk_live_... or ahs_sk_test_...). Never expose it to browser or mobile code. |
| Content-Type | application/json | The request body must be sent as application/json. |
| X-AHS-Conversation-Ref | Required for DELETE only | Sent with DELETE /v1/server-conversations to name the conversation to delete. |
Request body (POST /v1/answers)
| Field | Type | Status | Description and constraints |
|---|---|---|---|
| question | string | Required | The customer’s message text. At most 8 KB of UTF-8 text. |
| message_id | string | Recommended | Unique client message ID (pattern ^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$, 1–128 characters) for idempotent retries and ordering. |
| conversation_ref | string | Optional | Opaque conversation reference (pattern ^ahs_conv_live_[A-Za-z0-9_-]{43}$) returned by an earlier turn, used to resume the dialogue. |
| language | string | Optional | Answer language, "ar" or "en". Defaults to "ar". |
Response fields (data object)
| Field | Type | Meaning and possible values |
|---|---|---|
| status | string | Answer status: grounded (answered from your knowledge), insufficient_context (the knowledge is not enough), out_of_scope, or safety_flagged. |
| answer | string | The customer-facing answer, built from your documents and policies. |
| conversation_ref | string | The opaque conversation reference to store and send with follow-up turns. |
| message_id | string | The client message ID from the request. |
| handoff_suggested | boolean | True when a human agent should take over. |
| citations | array | Sources the answer is based on: [{ citation_id, source_filename }]. |
Error codes
Every failed response uses the standard ErrorEnvelope.
| Code | HTTP | Meaning |
|---|---|---|
| invalid_api_key | 401 | The server API key is missing, invalid, or revoked. |
| invalid_input | 422 | The request does not match the schema or size limit (empty question or more than 8 KB). |
| invalid_message_id | 422 | message_id does not match the accepted pattern. |
| conversation_not_found | 404 | The conversation reference is unknown, expired (after 30 days) or deleted. |
| request_in_progress | 409 | The message is still being processed. Read the Retry-After header and retry. |
| idempotency_conflict | 409 | The same message_id was reused with a different payload. |
| rate_limited | 429 | Rate limit exceeded (200 requests per minute per server key and 60 per minute per IP address). |
| grounded_answer_unavailable | 503 | Answer generation or the knowledge base is temporarily unavailable. |