The five paths
Named secrets
Define a credential once, then reference it from any action header as{{secrets.<name>}} — or pick it from the header editor’s secret picker. Unlike global variables, a secret is sent only on the requests whose headers reference it, so one workspace can talk to many upstream systems without every call carrying every key.
Values are write-only: encrypted at rest, never returned by any API or screen after creation, and decrypted only at the moment a request actually fires. Forgot a value? Type a replacement — there is no way to read the old one back. MCP server auth headers accept the same {{secrets.<name>}} references.
1
Create the secret
Go to Settings → General → Secrets, choose a name, paste the value. The name is permanent — actions reference secrets by name.
2
Reference it from a header
In the action’s header editor, set the value to
{{secrets.<name>}} or use the picker. A header whose secret is missing is dropped, never sent raw.Global variables
Store once, OpenCX injects the value into every action call for your organization. Values are encrypted at rest and decrypted per request.1
Open the variables page
2
Add a variable
Set a key and value. The key becomes the HTTP header name on every outbound action call.
3
Reference from an action
Nothing further to wire up — any action whose endpoint sits behind that header will authenticate.
Use a full
Authorization header value (e.g. Bearer <token>) when your API expects Bearer auth — OpenCX sends the value verbatim, it does not prepend Bearer .Widget headers
Pass per-user credentials from your frontend at widget-init time. OpenCX uses them only for that contact’s action calls and does not persist them.Session values
Put the session’s identity into an action header, so your API can return only the data that belongs to the customer in the session. OpenCX fills these in when the action runs; the AI never sees or sets them, so a customer cannot talk it into fetching someone else’s data.
Type
{{ in an action header value to pick one. Placeholders combine with text and secrets:
- Trusted identity only.
{{contact.*}}and{{session.channel_contact_id}}have no value for an anonymous web visitor.{{contact.*}}is filled on every other session: any non-web channel, API-created sessions included, and web visitors who signed in through widget user authentication. - Per-channel ID.
{{session.channel_contact_id}}follows the table above, so it has no value on Slack, API, Twitter, app review and internal sessions even when the contact is trusted. - No value, no header. A header with a placeholder that has no value, or a value a header can’t carry (non-ASCII characters, line breaks), is not sent, and no global variable or widget header of the same name is sent in its place; the rest of the request still goes out. Make your API reject a call without the header rather than fall back to something the AI provided.
- Header values only. Placeholders are not filled in the URL, query parameters or body.
- HTTP actions only. An MCP server’s headers don’t fill these placeholders. To send the same values to an MCP server, use its tool call metadata.
- Testing. In the action editor’s Test dialog, paste a session ID under Test session to fill these values from that session. Headers that could not be filled are marked as not sent.
Context headers
When your org has context headers enabled, OpenCX adds four identifying headers to every action call:
Your API can use these to:
- Trace an action call back to a specific conversation in the OpenCX inbox — the session ID is a clickable link.
- Rate-limit per org without customers passing their own org ID as a parameter.
- Scope responses — e.g. return a contact’s orders based on
x-opencx-external-user-idinstead of trusting a query parameter the AI extracted.
Context headers are opt-in at the org level. If you need them on, ask support to enable automatic action headers for your org.
User-Agent: OpenCX so your firewall and logs can filter.
Choosing a path
Security best practices
Validate context headers server-side
Validate context headers server-side
Treat
x-opencx-org-id as a signal, not a credential — pair it with a global-variable shared secret your API also checks. That way a leaked URL alone can’t forge OpenCX traffic.Don't log full header values
Don't log full header values
Redact anything matching
Authorization, *-Token, *-Key in your access logs. OpenCX does not replay headers, but your own log pipeline and dashboards can.HTTPS only
HTTPS only
OpenCX refuses to call
http:// URLs. If your endpoint isn’t behind TLS today, put it behind a gateway that is.Rotate secrets without losing conversations
Rotate secrets without losing conversations
Update the global variable value — no action edit needed. Existing in-flight tool calls finish against the old value; the next call uses the new one.
Related Documentation
Build An Action
Form fields, headers, parameters, test.
Execution
How headers reach your API at call time.
Troubleshooting
401s, 403s, and signal-header gotchas.
Widget Authentication
Full widget auth model including identity verification.