Developer documentation
1AI API
Everything you need to call 1AI agents from your own code. The API is in beta — endpoints and responses may change.
Base URL
https://1ai-gateway.sojibahmmed.workers.devAll endpoints below are relative to this URL.
Authentication
Send your key in the X-API-Key header on every request. API keys are issued per user — keep yours secret and never put it in browser code. The API is currently in beta.
X-API-Key: $ONEAI_API_KEYQuick start
cURL
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/ai/chat" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message":"আমাকে একটি স্বাগত বার্তা লিখে দিন"}'JavaScript (fetch)
const res = await fetch("https://1ai-gateway.sojibahmmed.workers.dev/v1/ai/chat", {
method: "POST",
headers: {
"X-API-Key": process.env.ONEAI_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ message: "Hello from Bangladesh" }),
});
const data = await res.json();
console.log(data);Endpoints
/v1/healthCheck that the gateway is up.
curl "https://1ai-gateway.sojibahmmed.workers.dev/v1/health" \
-H "X-API-Key: $ONEAI_API_KEY"/v1/agentsList the agents available to your key.
curl "https://1ai-gateway.sojibahmmed.workers.dev/v1/agents" \
-H "X-API-Key: $ONEAI_API_KEY"/v1/ai/chatSend a chat message to an AI model.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/ai/chat" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message":"আমাকে একটি স্বাগত বার্তা লিখে দিন"}'/v1/notify/sendSend an SMS or email notification.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/notify/send" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"channel":"sms","to":"+8801XXXXXXXXX","message":"Your order has shipped"}'/v1/events/publishPublish an event for workflows to react to.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/events/publish" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"order.created","data":{"order_id":"1001"}}'/v1/memory/writeStore a memory item for an agent.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/memory/write" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"key":"customer:42","value":"Prefers Bangla"}'/v1/payments/bkash/createCreate a bKash payment request.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/payments/bkash/create" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount":499,"currency":"BDT","reference":"INV-1001"}'/v1/courier/steadfast/createBook a Steadfast courier delivery.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/courier/steadfast/create" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"recipient_name":"Rahim","recipient_phone":"01XXXXXXXXX","address":"Dhaka","cod_amount":1200}'/v1/courier/pathao/createBook a Pathao courier delivery.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/courier/pathao/create" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"recipient_name":"Karim","recipient_phone":"01XXXXXXXXX","address":"Chattogram","cod_amount":850}'/v1/mcp/connectConnect an MCP server to your account.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/mcp/connect" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/mcp"}'/v1/mcp/callCall a tool on a connected MCP server.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/mcp/call" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"tool":"search","arguments":{"q":"hello"}}'/v1/automation/buildBuild a workflow from a plain-language description.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/automation/build" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"When an order is paid, book a courier and SMS the customer"}'/v1/support/chatAsk the website FAQ / support agent a question.
curl -X POST "https://1ai-gateway.sojibahmmed.workers.dev/v1/support/chat" \
-H "X-API-Key: $ONEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message":"What are your delivery charges?"}'/v1/workflows/runsList recent workflow runs.
curl "https://1ai-gateway.sojibahmmed.workers.dev/v1/workflows/runs" \
-H "X-API-Key: $ONEAI_API_KEY"Plans & quotas
| Plan | Requests / month |
|---|---|
| Free | 100 |
| Pro | 10,000 |
| Team | 100,000 |
| Enterprise | 1,000,000 |