API Reference
OpenEdge production API:
text
https://api.open4x.comApplication services are mounted under:
text
/v1/appsAuthentication
API Key
Use API keys for server-side integrations:
http
X-API-Key: sk_xxxAPI keys are shown once and stored as hashes.
JWT
Use JWT for console-authenticated workflows:
http
Authorization: Bearer <token>Do not hardcode JWTs in long-running production services.
Recommended Scopes
| Scope | Capability |
|---|---|
bot:send | Send bot messages and replies. |
file:read | Read or download files. |
file:write | Upload or mutate files. |
push:send | Send Webhook Push messages. |
tron:lease | Quote, create, and query TRON energy lease orders. |
ai:invoke | Call AI chat, streaming, and embeddings endpoints. |
socialops:write | Ingest SocialOps webhook events. |
socialops:read | Read SocialOps inbox threads and messages. |
Standard Errors
Some current endpoints return a simple error object:
json
{
"error": "Insufficient balance"
}Newer APIs should move toward structured errors:
json
{
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance",
"request_id": "req_xxx"
}
}Recommended error codes:
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The request body or parameters are invalid. |
| 401 | unauthorized | Missing or invalid credentials. |
| 402 | insufficient_balance | The account does not have enough balance. |
| 403 | forbidden | The key or user is missing required permission. |
| 404 | not_found | The resource was not found. |
| 409 | cost_limit_exceeded | The request exceeds max_cost or quote constraints. |
| 422 | verification_failed | Business verification failed. |
| 429 | rate_limit_exceeded | Rate limit or budget exceeded. |
| 502 | upstream_failed | Upstream provider failed. |
Service Endpoints
| Service | Endpoint |
|---|---|
| AI chat | POST /v1/apps/ai/:alias/chat |
| AI streaming | POST /v1/apps/ai/:alias/chat/stream |
| AI embeddings | POST /v1/apps/ai/:alias/embeddings |
| Webhook Push | POST /v1/apps/webhook-push/:alias/send |
| TRON quote | POST /v1/apps/tron/quote |
| TRON lease | POST /v1/apps/tron/lease |
| TRON lease list | GET /v1/apps/tron/leases |
| TRON lease detail | GET /v1/apps/tron/leases/:id |
| SocialOps webhook | POST /v1/apps/socialops/:alias/webhook/:provider |
| SocialOps inbox | GET /v1/apps/socialops/:alias/inbox |
| SocialOps thread messages | GET /v1/apps/socialops/:alias/threads/:thread_id/messages |
| SocialOps reply queue | POST /v1/apps/socialops/:alias/threads/:thread_id/replies |
| File service | /v1/apps/file/* |
| Bot service | /v1/apps/bot/* |
Health Check
bash
curl https://api.open4x.com/healthExpected response:
json
{
"status": "ok",
"db": "ok",
"ts": "2026-06-19T14:48:46.146Z"
}