Authentication
How to call the MessageOS API.
Send Authorization: Bearer <key> with every request.
A client key starts with mosc_. It is shown once, when it is created. Only a hash is stored. A key can have an expiry, and it can be revoked. A missing, unknown, expired, or revoked key returns 401 unauthorized.
Each key has scopes, which the dashboard calls permissions. A request without the scope its route needs returns 403 forbidden, and message names the scope.
| Scope | Allows |
|---|---|
contacts:read | Listing and reading contacts |
contacts:write | Creating and updating contacts |
conversations:read | Listing and reading conversations and their messages |
messages:write | Sending messages, reading a sent message, and working with drafts. Where MessageOS has turned them on: checking a phone number for RCS, showing the typing indicator, and taking a message back |
messages:send_ai_without_approval | Sending crafted text without a draft ("approval": "none") |
webhooks:manage | Registering webhooks and inbound event sources |
events:write | Submitting events |
knowledge:read | Listing knowledge entries |
knowledge:write | Creating, editing, and approving knowledge entries |
gaps:read | Listing gaps |
usage:read | Reading daily usage |
Permissions you can give a key
An owner or admin of your brand makes a key on the Developers page of the dashboard, and can give it any of these:
contacts:readandcontacts:writeconversations:readmessages:writewebhooks:manageevents:writeusage:readgaps:readandknowledge:read, which belong to the assistant. The dashboard does not offer them for an agent whose own system answers.
MessageOS sets the other two. messages:send_ai_without_approval is always set by MessageOS. knowledge:write is set by MessageOS while MessageOS manages your approved answers, which is how every brand starts. If your integration needs one of them, ask MessageOS.
A key's permissions cannot be changed. To change them, make a new key and revoke the old one.
What a key can do
GET /v1/whoami returns the client id, name, key prefix, scopes, environment, time zone, quiet hours and whether they hold your sends (quietHoursEnforced), whether rich messages are accepted (richMessages), whether message expiry, traffic type, the capability check, the typing indicator, and taking a message back are turned on (rcsExtras), allowed message classes, whether bounded workflows are switched on for that client, the reply window, and any limit MessageOS has set on requests and sends (limits, where each limit is null while none is set, described on Rate limits).
environment names the MessageOS environment that answered. It is production for a key used at https://api.messageos.ai. When your own system answers reads this answer field by field.
