Make your first request
List your workers, send a message, and upload a document — in about five minutes.
This walks through your first few REST API calls. You'll need a full-scope Agent API Token.
The base URL for every endpoint is:
https://mcp.onkey.chat/functions/v1/rest-api
1. List your active mobile users
curl "https://mcp.onkey.chat/functions/v1/rest-api/users" \
-H "Authorization: Bearer okm_<your-token-here>"const res = await fetch("https://mcp.onkey.chat/functions/v1/rest-api/users", {
headers: { Authorization: "Bearer okm_<your-token-here>" },
});
if (!res.ok) {
const { error, message } = await res.json();
throw new Error(`${res.status} ${error}: ${message}`);
}
const { users, count } = await res.json();
console.log(`Found ${count} users`);You'll get back { "users": [...], "count": N }. See the API Reference for every filter (query, location, role, active).
2. Send a targeted message
Message everyone at a location right now. There's no confirmation step — the request sends as written.
curl -X POST "https://mcp.onkey.chat/functions/v1/rest-api/messages" \
-H "Authorization: Bearer okm_<your-token-here>" \
-H "Content-Type: application/json" \
-d '{
"body": "Please submit your hours by Friday.",
"filter": { "location": "Glendale" }
}'const res = await fetch("https://mcp.onkey.chat/functions/v1/rest-api/messages", {
method: "POST",
headers: {
Authorization: "Bearer okm_<your-token-here>",
"Content-Type": "application/json",
},
body: JSON.stringify({
body: "Please submit your hours by Friday.",
filter: { location: "Glendale" },
}),
});
const { sent_to, message_id } = await res.json();
console.log(`Sent to ${sent_to} workers`);The filter must set at least one of name, location, or role. If it matches nobody, you still get a 200 with "sent_to": 0 — not an error.
3. Upload a document to the Knowledge Base
Uploads are multipart and processed asynchronously. You get a batch_id back immediately; poll for status.
# Upload
curl -X POST "https://mcp.onkey.chat/functions/v1/rest-api/files" \
-H "Authorization: Bearer okm_<your-token-here>" \
-F "[email protected]"
# → { "batch_id": "..." }
# Poll
curl "https://mcp.onkey.chat/functions/v1/rest-api/files/<batch_id>" \
-H "Authorization: Bearer okm_<your-token-here>"The Admin the token was issued for also gets an email when processing finishes.
Next steps
- API Reference — the full interactive endpoint list with a "Try It" console.
- Errors — the error format and every status code.
- Payroll-managed rosters — when user writes are blocked.
Updated about 1 hour ago

