Skip to main content
Use the AI for Work public APIs to send notifications, retrieve audit logs, and retrieve trace logs from your own applications and reporting tools.
The sample requests and responses on this page use placeholder values in place of real data:
  • Values in double braces, such as {{host}} and {{PersonalToken}}, are placeholders that you replace with your own values.
  • IDs keep their prefix, if any, and replace the remaining characters with x. For example, u-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is a user ID and xxxxxxxxxxxxxxxxxxxxxxxx is a record ID.
  • Names and email addresses are fictitious, such as John Doe and john.doe@example.com.

Authentication

All AI for Work public API requests go to https://{{host}}/api/public/, where {{host}} is the AI for Work environment URL for your account. Each API uses one of two credentials.

Generate a Personal API Key

The Audit Log API and the Trace Log API accept only a Personal API Key that an admin generates. Keys generated by users without the Admin role do not work with these APIs. To generate a Personal API Key:
  1. Sign in to AI for Work.
  2. Open the profile menu and select Personal API Key.
  3. Copy the generated key and store it securely.

Notify API

The Notify API sends interactive notifications to users. Notifications can include customizable response options and action buttons. To know how agents pause and resume conversations around alerts, see Handling Alert Tasks.
Applicable only for Bot, Autonomous, and Workflow Agents.

Endpoint Reference

  • Method: POST
  • Endpoint: https://{{host}}/api/public/agents/{agentId}/notify
  • Content-Type: application/json
  • Authorization: authorization: {{AgentAccessToken}} — The access token obtained from the agent settings page.
  • API Scope: Notification

Path Parameters

Request Body Parameters

The API validates only to and message. It does not validate the properties inside actions, so check that each button includes the fields your agent needs to handle the response.

Sample Request

Sample Response

Key Points

  • The to email address must belong to a valid application user.
  • The to key accepts a single email address in the initial implementation.
  • Use custom payload data for tracking and response handling.
  • Include actions in the request payload to present users with interactive buttons. If you omit actions, the user receives the notification without buttons.

Audit Log API

The Audit Log API retrieves log data programmatically for custom reporting, SIEM integration, or compliance workflows. For what the audit log records and where to view it in the product, see Audit Log.

Endpoint Reference

  • Method: GET
  • Endpoint: https://{{host}}/api/public/auditlogs
  • Content-Type: application/json
  • Authorization: auth: {{PersonalToken}} — A Personal API Key generated by an Admin. See Generate a Personal API Key.

Query Parameters

The startTime and endTime parameters are required. The API returns HTTP 400 if either is missing. All other parameters are optional; combine them to filter results.

Supported Entities and Actions

Entity values are case-sensitive. Use them exactly as shown, for example, agent, not Agent. Action values are uppercase.

Sample Request

Sample Response

Trace Log API

The Trace Log API retrieves trace log records for a specified date range. Each record captures a single user request and includes response time, token consumption, the models and LLM events involved, and the source that answered the request, such as an agent, a project, an attachment, or an AI model. Use this API to pull usage, latency, and token data into your own reporting tools, data warehouses, or internal dashboards. For what a trace log shows in the product, see Trace Logs.

Endpoint Reference

  • Method: GET
  • Endpoint: https://{{host}}/api/public/analytics
  • Content-Type: application/json
  • Authorization: auth: {{PersonalToken}} — A Personal API Key generated by an Admin. See Generate a Personal API Key.
  • Required Role: Admin

Headers

Query Parameters

All query parameters are optional. Date range behavior
Trace log records include the questions that users submit, which can contain personal or confidential information. Store and share the response according to your organization’s data protection policies.

Sample Request

Sample Response

The following sample shows a request that an agent answered. The agent made an API call to an external agent platform and received an asynchronous response.

Response Reference

The API returns all trace log records in the selected date range in a single response. The API does not support pagination. Top-level response Trace log record Each object in the analytics array contains the following fields.
The agentInfo field is deprecated and no longer appears in trace log records. To identify the agent that answered a request, use respContext. When respContext.type is agent, respContext.sources[].sourceId contains the agent ID and respContext.sources[].name contains the agent name.
Response context object The respContext object identifies the source that answered the request. The following examples show respContext for each source type.
LLM event object Each object in the llmStats array contains the following fields. Some fields apply only to certain event types.