API keys

Create the secret keys your servers use, choose what each one can do, and change or revoke them later.

An API key lets software you run, such as a booking app's backend, a property system or a reporting job, call the Careflow API for your workspace. Keys are created, changed and revoked in the dashboard only. The API can't create, list or change keys.

A key belongs to the workspace, not to one agent. Each key has its own access: you choose which areas of the API it can reach, and whether it can only read or can also make changes. Careflow shows the full key once, when it's created, and keeps only a hash after that.

You need the Manager role to create, change or revoke keys. See Roles and permissions.

Create a key

  • Go to SettingsChannelsAPI.
  • Choose Add API. The Create an API key dialog opens.
  • Enter a Key name that says what will use it, such as PMS sync.
  • Under What this key can do, choose a level for each area.
  • Choose Create key, then Copy, and put the key in your secret manager.
  • Choose Done.

The key starts with sk_live_. Once you close the dialog it can't be shown again, so if it's lost, create a new key and revoke the old one. Copy curl gives you a ready-made test message to hand to your developer.

Choose what a key can do

What this key can do lists each area of the API with its own setting. No access keeps the key out of that area, Read lets it look but not change anything, and Read & write lets it make changes too.

AreaChoicesWhat it covers
ConversationsNo access, SendSend customer messages to your agents
AgentsNo access, Read, Read & writeAgents' settings and persona, and publishing
KnowledgeNo access, Read, Read & writeSources, documents, search, and attaching knowledge to agents
AnalyticsNo access, ReadOverview, trends, sessions and exports
ToolsNo access, Read, Read & writeTools, and testing them
VariablesNo access, Read, Read & writeWorkspace variables
IntegrationsNo access, Read, Read & writeConnected integrations and their activity, and disconnecting them

A new key starts with Send for Conversations and nothing else. Give it only what the system using it needs, and at least one area, or Create key stays unavailable. A reporting job only needs Analytics. A system that keeps your help content current needs Read & write on Knowledge.

Within the areas you choose, a key acts with a Manager's permissions, so Read & write on Integrations lets it disconnect an integration. Developers will see these as scopes such as knowledge:write. Authentication lists exactly what each one allows.

Change a key's access

You can widen or narrow a key at any time without replacing it.

  • Go to SettingsChannelsAPI and open the key.
  • Under What this key can do, change the levels.
  • Choose Save access.

The new access applies to the key's next request, so your developer doesn't need to redeploy anything. A request the key can no longer make gets 403 with insufficient_scope, and the error names the scope it needs. Members can see a key's access but only Managers can change it.

Keys created before you could choose access can only send conversation messages. Open one and save new access if your developer needs more.

Use the key

Your server sends the key in the Authorization header:

curl https://api.trycareflow.com/assistants \
  -H "Authorization: Bearer sk_live_xxx"

Keep keys on servers. A key in a web page or a mobile app can be copied, and whoever has it can do everything its access allows. For a chat on your website, use the web widget's publishable key instead. See Embed the web widget.

Check your keys

  • Go to SettingsChannelsAPI.
  • Read each row: the key's name, its first few characters, what it can do, and Last used with a date, or Never used.

Last used is a quick way to spot keys nothing needs any more, and to confirm a service has moved to a new key before you revoke the old one. Changes a key makes show in Audit logs under API key: and the key's name.

Revoke a key

  • Go to SettingsChannelsAPI.
  • Open the key and choose Revoke, or choose the bin icon on its row, then confirm.

The key stops working at once, and requests that use it get 401 with invalid or revoked API key. To replace a key without breaking anything, create the new key with the same access and deploy it before you revoke the old one. See Rotate an API key.

Where to go next