The ProteusAI Messaging API uses tokens to authenticate requests. You can view and manage your tokens in the Setup page for your ProteusAI account.
Click on the Add User Token button to add a new token for your account. You can always delete a token; API calls based on the deleted token will no longer work.
REST requests
Send the token in the Authorization header of the request as a bearer token. User tokens are prefixed with user- and plugin-instance tokens with inst-.
curl --request GET \
--url "https://messaging-api.useproteus.ai/api/chats/77542a3587659db1a6ce5058/messages" \
--header "Authorization: Bearer user-3a4d80a9c3cca7ffd1bc341f.ede04d00e4b168bed35d9fcde8c2f92f.00d7fecf89201691f94b01e5b294da65.e7ea4c191b2c9a059ce5658deb7349c26a931ed8b7a04bf0"Realtime connection
The same token authenticates the realtime (socket.io) connection. Provide it as the token field of the connection's auth option. The SDK does this for you when you pass apiKey.
import ProteusAI from '@proteus-ai/sdk';
const proteus = new ProteusAI({ apiKey: 'user-3a4d80a9c3cca7ffd1bc341f...' });
await proteus.connect();If you make calls to protected API endpoints without a token or with an invalid token, you will receive a 401 Unauthorized response. A realtime connection with an invalid token is rejected with an error event and disconnected.
Your API tokens carry many privileges, so be sure to keep them secure! Do not share your tokens in publicly accessible areas such as GitHub, client-side code, and so forth.