Docs
Authentication
Your programs use an API key. AI assistants and third-party apps use OAuth 2.1 so users grant access themselves.
API keys
Each key has 2 parts: the key ID ock_… and the secret ocs_…. The secret is shown only once at creation; store it safely and never ship it to a browser.
curl https://chat.orova.vn/api/chat/v1/me \ -H "X-Api-Key: ock_…" \ -H "X-Api-Secret: ocs_…"
curl https://chat.orova.vn/api/chat/v1/me \ -H "Authorization: Bearer ock_…:ocs_…"
OAuth 2.1 for assistants and apps
AI assistants (Claude, ChatGPT…) and third-party apps register dynamically, send the user to a consent page, then receive an access token ocha_…. PKCE is required S256.
| Step | Endpoint |
|---|---|
| Authorization server metadata | https://chat.orova.vn/.well-known/oauth-authorization-server |
| Protected resource metadata | https://chat.orova.vn/.well-known/oauth-protected-resource/mcp |
| Dynamic client registration | https://chat.orova.vn/oauth/register |
| User consent (authorize) | https://chat.orova.vn/oauth/authorize |
| Exchange code, refresh token | https://chat.orova.vn/oauth/token |
| Revoke a token | https://chat.orova.vn/oauth/revoke |
- Access tokens last
3600seconds; refresh tokens last 30 days and rotate on every use. - Send the access token in the header
Authorization: Bearer ocha_…. - Users grant only the scopes the app requests and can revoke at any time.
Scopes
API keys and OAuth tokens can only do what their scopes allow. Pick as few as you can. Scopes marked Dangerous can delete or change important data.
| Scope | Allows | |
|---|---|---|
| profile | ||
profile:read |
View your profile (name, photo, Chat ID) | |
profile:write |
Edit your profile | |
| settings | ||
settings:read |
View your Chat settings | |
settings:write |
Change your Chat settings | |
| contacts | ||
contacts:read |
View your contacts | |
contacts:write |
Add, edit and remove contacts | |
| conversations | ||
conversations:read |
View your conversation list | |
conversations:write |
Create and manage conversations and groups | |
| messages | ||
messages:read |
Read your messages | |
messages:write |
Send, edit and unsend messages | |
| files | ||
files:read |
View and download files and photos | |
files:write |
Upload and delete files and photos | |
| calls | ||
calls:read |
View your call history | |
calls:write |
Place and answer calls on your behalf | Dangerous |
| ai | ||
ai:read |
View your Orova AI history | |
ai:write |
Use Orova AI (charged to your wallet quota) | Dangerous |
| wallet | ||
wallet:read |
View your wallet balance and quota | |
| devices | ||
devices:read |
View your signed-in devices | |
devices:write |
Link new devices and sign devices out | Dangerous |
| business | ||
business:read |
View your business pages and customer care messages | |
business:write |
Manage business pages and message your customers | Dangerous |
| events | ||
events:read |
Receive new events (messages, calls) in real time | |
| workspace_admin | ||
workspace_admin:read |
View workspace admin data | Dangerous |
| pockets | ||
pockets:read |
View your Pockets and the ones you publish (catalog, versions, stats) | |
pockets:write |
Create, edit, upload versions, submit for review and publish Pockets | |
| account | ||
account:delete |
Request account deletion (needs an email OTP code) | Dangerous |
Scope presets
| Preset | Includes |
|---|---|
read_only | profile:read settings:read contacts:read conversations:read messages:read files:read calls:read ai:read wallet:read devices:read business:read events:read pockets:read |
messaging | profile:read contacts:read conversations:read conversations:write messages:read messages:write files:read files:write events:read |
full | profile:read profile:write settings:read settings:write contacts:read contacts:write conversations:read conversations:write messages:read messages:write files:read files:write calls:read calls:write ai:read ai:write wallet:read devices:read devices:write business:read business:write events:read workspace_admin:read pockets:read pockets:write account:delete |
Conventions
These apply to every REST and MCP operation.
Errors
Errors return JSON with error (machine code) and message. 422 errors also include details[].
{"error": "out_of_scope", "message": "…"}
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_idempotency_key | Idempotency-Key is malformed (1–64 characters A–Z a–z 0–9 _ . : -). |
| 401 | invalid_token | The key is missing, invalid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the scope this operation needs. |
| 403 | not_enabled | The Orova Chat API is not enabled for this account. |
| 403 | ip_not_allowed | This key cannot be used from your IP address. |
| 404 | not_found | The resource does not exist or you cannot see it. |
| 409 | idempotency_conflict | This Idempotency-Key was already used with a different request. |
| 409 | idempotency_in_progress | A request with this Idempotency-Key is still running; retry later. |
| 422 | invalid_request | The request is invalid; details[] lists each bad field. |
| 429 | rate_limited | Too many requests; wait for Retry-After seconds, then retry. |
| 500 | server_error | Orova server error; retry later. |
| 502 | upstream_error | An upstream service failed; retry later. |
Pagination
List endpoints take limit (1–200, default 50) and cursor. Responses include next_cursor; when it is null you have reached the end.
{"data": [ … ], "next_cursor": "eyJpZCI6…"}
Idempotency-Key
Send the header Idempotency-Key on create/send operations to retry safely. The same key within 24 hours replays the original result with Idempotent-Replayed: true; the same key with a different body returns 409 idempotency_conflict.
curl -X POST https://chat.orova.vn/api/chat/v1/… \
-H "Authorization: Bearer ock_…:ocs_…" \
-H "Idempotency-Key: 7f3c2a90-…" \
-H "Content-Type: application/json" \
-d '{…}'
Rate limits
600 requests per 60 seconds per key. Going over returns 429 with Retry-After (seconds to wait).
CORS and X-Request-ID
The API accepts requests from any origin (Access-Control-Allow-Origin: *), with no cookies; the key always travels in a header. Browsers can read the headers Retry-After, Idempotent-Replayed, WWW-Authenticate and X-Request-ID.
- Every response carries
X-Request-ID; include it when you contact support. - Never put the secret
ocs_…in code that runs in your users' browsers — call from your server, or use OAuth.