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>"

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" }
  }'

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.

Did this page help you?