Configure API Access for a Single Agent
When to Use API Access
Create API access under an agent when a business system needs to call that specific agent through its backend. For example, a distributor portal can use one analysis agent for different distributors. The credential is bound to that agent; changing an Agent ID cannot authorize another agent.
To embed an assistant in a BI Super App, use Embed Agents in Super Apps instead. That workflow configures organization access and does not require these steps first.
Prerequisites
Prepare the agent and confirm that you can edit it. The third-party app needs a backend to store credentials, identify signed-in users, and send requests.
Create Access and Credentials
Choose an Execution Identity
Decide whose permissions the agent should use. This determines what the backend must send.
| Identity | Scenario | Preparation |
|---|---|---|
| Channel owner (default) | All calls use the access creator's permissions, BI credentials, and memory. A service account can provide a fixed query scope. | Verify its resource access. The app must control who can call it and view results. |
| System user | Each user uses their own identity and BI permissions, such as distributors accessing only their authorized data. | Obtain the signed-in user's BI user ID and valid BI token, and verify access to the agent. |
System-user access validates against the target BI environment. Galaxy deployments use the organization's built-in BI environment. Internal deployments use the agent's specified environment, or the organization default if unspecified. That environment must be enabled.
Add Agent Access
- In the agent configuration, open Publishing and Integration > Channels, then add API access.
- Enter an access name, such as Distributor Portal - Production, and choose the execution identity.
- Configure the optional settings, then create the access:
- Allowed browser origins: Backend calls are recommended. Requests without an
Originheader need no entry. For direct browser calls, enter one origin per line, such ashttps://portal.example.com, without a page path. - Allow execution details: Enable only for trusted callers that need diagnostics. Details may expose commands, business output, and errors. An origin allowlist does not replace user authorization.
- Allowed browser origins: Backend calls are recommended. Requests without an
Generate and Save a Credential
Generate a credential under the new access entry and immediately save it in the backend's secure configuration. The full credential appears only once. Never put it in browser code, URLs, or logs. Send Authorization: Bearer <credential> to identify the access entry.
Verify Initial and Follow-Up Requests
Prepare User Identity
The third-party backend supplies:
DECIDEX_BASE_URL: The instance address without a trailing/.SERVICE_AGENT_TOKEN: The generated credential. Verify it withGET /api/service-agent/access; the returnedscopeshould beAGENT. This validates the credential, not an individual business user's authorization.EXTERNAL_USER_ID: A stable app-assigned user ID in channel-owner mode. In system-user mode, use the BI user ID matching the identity validated from the user's token.
The commands below use channel-owner mode. In system-user mode, add -H "Decidex-External-User-Token: $BI_USER_TOKEN" to both commands. This is the current user's valid BI token, not the access credential or a separate DecideX login token. History, traces, and files also require user validation.
Start a Conversation
Pass newSession to the synchronous chat endpoint. The single-agent credential already identifies the target; no agentId is needed.
curl -sS "$DECIDEX_BASE_URL/api/service-agent/chat" \
-H "Authorization: Bearer $SERVICE_AGENT_TOKEN" \
-H "Decidex-External-User-Id: $EXTERNAL_USER_ID" \
-H "Content-Type: application/json" \
-d '{"newSession":{"title":"Distributor Business Analysis"},"message":"Which business questions can you help me analyze?"}'
Check assistantMessage.content and save sessionId. If a response already contains a session ID, inspect that conversation before retrying to avoid duplicates.
Continue a Conversation
Pass the returned sessionId, with the same access entry and user identity. Omit newSession.
curl -sS "$DECIDEX_BASE_URL/api/service-agent/chat" \
-H "Authorization: Bearer $SERVICE_AGENT_TOKEN" \
-H "Decidex-External-User-Id: $EXTERNAL_USER_ID" \
-H "Content-Type: application/json" \
-d '{"sessionId":"REPLACE_WITH_RETURNED_SESSION_ID","message":"What data should I prepare for that analysis?"}'
Confirm that the reply continues the same conversation. For system-user access, also test with an actual business user and check that visible data matches their BI permissions.
Additional Capabilities
For asynchronous chat, history, run traces, stopping runs, feedback, or delivery files, open the current instance's integration documentation from the API access area. When listing conversations through single-agent access as a system user, explicitly send executionIdentity=EXTERNAL_USER. Internal deployments also require the target biEnvironmentId.
Manage Access and Credentials
- Change execution identity: Applies only to new conversations. Existing conversations retain their original execution and validation identity.
- Rotate credentials: Generate a replacement, update the backend, and verify calls before revoking the old credential. Revoked credentials cannot be re-enabled.
- Disable or delete: Disable access or a credential temporarily. Delete access only when no longer needed; existing conversations cannot continue through a deleted entry. Disabling or revoking does not stop active runs. Use the stop endpoint when needed.
Troubleshooting
| Symptom | Check first |
|---|---|
| Credential rejected | The backend uses this access entry's credential; both are enabled and the credential is not revoked. |
| A system user can start but cannot continue | Check the access entry, session ID, and external user ID. Include that user's valid BI token again. |
| Responses contain unexpected data | In channel-owner mode, check the creator's permissions and connectors. In system-user mode, check the environment, actual user's permissions, and agent resources. |
| Browser calls fail but backend calls work | Match the page's protocol, hostname, and port against allowed origins. |