The Three Paths
| Path | Use it for | Where it lives |
|---|---|---|
| Global variables | Credentials every customer shares — a server-to-server API key, a signing secret | Settings → Variables |
| Widget headers | Credentials that differ per customer — a session token, a per-user JWT | Your frontend, passed to the widget at init |
| Context headers | Identifying the OpenCX-side session / org / contact to your API | Attached automatically by OpenCX |
Global Variables
Store once, OpenCX injects the value into every action call for your organization. Values are encrypted at rest and decrypted per request.Open the variables page
Go to Settings → Variables.
Add a variable
Set a key and value. The key becomes the HTTP header name on every outbound action call.
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.Context Headers
When your org has context headers enabled, OpenCX adds four identifying headers to every action call:| Header | Value |
|---|---|
x-opencx-org-id | Your organization UUID |
x-opencx-session-id | The conversation session UUID — the trace key |
x-opencx-ticket-number | Numeric ticket ID for the session |
x-opencx-external-user-id | The contact’s external ID if they’re authenticated |
- 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
| Situation | Path |
|---|---|
| Every customer hits the same backend with the same server-to-server key | Global variable |
| Each signed-in customer has their own scoped token | Widget header (with a global variable for any shared service-account header) |
| Your API needs to know which OpenCX session / org / contact made the call | Context headers |
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.