Authentication
Both public APIs identify your workspace by an API key sent in the X-VoiceCX-Key header. Follow-up calls in a chat or web call use a short-lived session token instead. You create keys in the console under Settings → Developers → API Keys. See API keys for the steps.
Key types
Section titled “Key types”| Type | Prefix | Where it may be used | What it can do |
|---|---|---|---|
| Publishable | vcx_pk_ |
In web pages, only from the websites you list for it | Start chats and web calls |
| Secret | vcx_sk_ |
On your server only | Start chats and web calls, name your users, and use the Workflows API |
A full key looks like vcx_sk_key_<32 hex characters>_<secret>. The console shows it once, when you create it. Store it in your secret manager straight away. Afterwards the console shows only a short hint.
Both types belong to one workspace and only reach agents, use cases and workflows in that workspace.
Limiting a key to some agents
Section titled “Limiting a key to some agents”When you create a key you can limit it to some agents. Such a key is refused (403 agent_not_allowed) for any other agent, and for a use case whose entry agent is not on its list. A key limited to agents cannot be used with the Workflows API (403 key_limited_to_agents); create a separate secret key with no agent limit for workflows.
Expiry and revoking
Section titled “Expiry and revoking”A key can have an expiry date. An expired or revoked key answers 401 invalid_api_key. Revoking takes effect within a few seconds, because key checks are cached briefly.
Allowed websites (publishable keys)
Section titled “Allowed websites (publishable keys)”A publishable key must list at least one website origin, such as https://www.example.com. An origin is a scheme and host, with a port only if it is not the default. It has no path.
When a browser starts a chat or call, NuacemOne compares the page’s Origin header with the key’s list. If it is not on the list, the request fails with 403 origin_not_allowed. Add each origin separately: https://example.com and https://www.example.com are different origins.
The allowed-websites check stops other sites from using your key in a browser. It is not a secret: anyone can read a publishable key from your page. That is why a publishable key can only start conversations with your live agents and nothing else.
Never put a secret key in a browser
Section titled “Never put a secret key in a browser”A secret key can start workflows and can name any user. Treat it like a password:
- Keep it on your server and read it from an environment variable or secret manager.
- Never put it in web pages, mobile apps, browser extensions or a code repository.
- If a secret key leaks, revoke it in the console at once and create a new one.
The SDKs refuse to call the Workflows API from a browser or with a publishable key.
Sending the key
Section titled “Sending the key”curl -X POST "https://api.nuacem.dev/voice-gw/public/v1/text/sessions" \ -H "X-VoiceCX-Key: $NUACEMONE_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{"agentId": "agt_xxxx"}'The Workflows API takes the same header:
curl "https://api.nuacem.dev/workflow-api/public/v1/runs/run_xxxx" \ -H "X-VoiceCX-Key: $NUACEMONE_SECRET_KEY"The Workflows API accepts only secret keys. A publishable key answers 403 secret_key_required.
Session tokens
Section titled “Session tokens”Starting a chat (POST /public/v1/text/sessions) returns a token for that one chat. Use it, not your key, for every later call in the chat:
POST /public/v1/text/sessions/{sessionId}/messagesAuthorization: Bearer <token>The same token works for files, voice notes, feedback, the live agent events and ending the chat. It is valid only for the session it was issued for. A copied publishable key therefore buys a new chat, never access to someone else’s.
expiresInin the start response is the token’s lifetime in seconds.- A chat that stays idle past your organisation’s idle limit is forgotten. Its token then gets
404 session_not_found. Start a new chat. - A token that is wrong, expired or for another session gets
401 invalid_session_token.
A web call returns a callToken in the same way. Use it as Authorization: Bearer <callToken> to rate the call or read its summary.
Signed users (identity)
Section titled “Signed users (identity)”You can tell NuacemOne which of your signed-in users is chatting, so the conversation is linked to that customer.
With a secret key, from your server, send userId when you start the chat. Your server vouches for the user.
With a publishable key, from a page, send userId and userHash:
userHash = hex( HMAC-SHA256( key = workspace identity secret, message = userId ) )Compute userHash on your server and render it into the page for the signed-in user. Never send the identity secret to the browser. Create the identity secret in the console under Settings → Developers → User verification.
// Node, on your serverconst crypto = require('node:crypto');const userHash = crypto.createHmac('sha256', process.env.NUACEMONE_IDENTITY_SECRET) .update(user.id).digest('hex');# Python, on your serverimport hashlib, hmac, osuser_hash = hmac.new(os.environ["NUACEMONE_IDENTITY_SECRET"].encode(), user.id.encode(), hashlib.sha256).hexdigest()What happens:
- A valid
userHash: the chat is linked to that user. - A
userHashthat does not match:403 invalid_user_hash. Fix your signing code; the page is misconfigured. - A
userHashbut no identity secret in the workspace:403 identity_not_configured. - A
userIdwithoutuserHashfrom a publishable key: the user id is ignored and the chat stays anonymous.
Rotating keys and secrets
Section titled “Rotating keys and secrets”To rotate an API key without downtime:
- Create a new key with the same settings.
- Deploy it to your servers (or your page, for a publishable key).
- Revoke the old key once traffic has moved.
Rotating the identity secret, the inbound hook secret or a webhook signing secret in the console replaces it straight away; there is no overlap period. Requests signed with the old secret stop working within a minute, so update your server at the same time.