Skip to main content
Use API client v2 credentials for analytics, ticket list APIs, ticket exports, voice call exports, customer read APIs, and new platform integrations.

Base URL

  • Global region: https://app.sagepilot.ai
  • Europe region: https://eu.sagepilot.ai

Create an API client

1

Open API Details

In the Sagepilot dashboard, go to Settings > API Details.
2

Create a v2 client

In API client v2, select Create key.
3

Add client details

Fill in the label, principal type, and description so the client is identifiable later.
4

Choose scopes

Select only the actions this integration needs.
5

Choose datasets

Select only the datasets this integration needs.
6

Copy the token

Copy the generated sp_... token. It is shown once.

Create form fields

label
string
required
Human-readable name for the client, such as BI warehouse sync or Support MCP client.
principal_type
string
default:"external"
Principal category for the client. Use external for third-party systems, customer-managed automations, and external integrations. Use internal for Sagepilot-managed internal services.
description
string
Optional description of what the client is used for.
scopes
string[]
Action permissions granted to the client.
datasets
string[]
Dataset grants that restrict which data the client can read or export.

Current scopes

The API Details page currently exposes these API client v2 scope options:
ScopeUse
analytics.queryRun analytics catalog and query endpoints on granted datasets.
analytics.raw.readReserved for future raw analytics row access.
ticket.readLegacy UI-visible ticket read scope. For new ticket APIs, use tickets:read.
tickets.exportExport raw ticket rows as CSV.
tickets:readRead ticket lists, ticket details, and ticket messages.
tickets:writeUpdate ticket status and writable ticket fields.
tickets:assignAssign tickets to agents, AI agents, teams, or unassigned state.
customers:readSearch and read customer profile data.

Current datasets

The API Details page currently exposes these dataset grants:
DatasetUse
ticketsTicket list APIs and ticket analytics.
customersCustomer search and customer profile APIs.
messagesMessage analytics.
workforce_activityWorkforce activity analytics.
csatCSAT analytics.
outbound_messagesOutbound message and delivery analytics.
marketing_attributionMarketing attribution analytics.
tickets.rawRaw ticket and voice call CSV export.
New API clients should use these canonical dataset names.

Send credentials

Send the API client token in either header form:
Authorization: Bearer sp_<public_key_id>.<secret>
X-API-Key: sp_<public_key_id>.<secret>
X-Workspace-Id
string
Optional for API client v2 requests. If you send it, it must match the workspace bound to the API client. Find the current workspace ID in Settings > API Details > Channels.
Treat sp_... API client tokens as secrets. Do not commit them to source control or expose them in client-side code.

Required access by API

API areaRequired scopeRequired dataset
Analytics catalog and queryanalytics.queryMatching analytics dataset, such as tickets, messages, outbound_messages, marketing_attribution, csat, or workforce_activity.
Ticket list APIstickets:readtickets
Mark ticket read-tickets
Ticket assignmenttickets:assigntickets
Ticket status updatestickets:writetickets
Ticket messagesAny ticket scope: tickets:read, tickets:write, tickets:assign, or tickets:replymessages
Ticket exportstickets.exporttickets.raw
Voice call exportstickets.exporttickets.raw
Customer read APIscustomers:readcustomers

Resource IDs

Use Settings > API Details in the Sagepilot dashboard to find the IDs used in API requests.
ResourceWhere to find itUsed for
Workspace IDSettings > API Details > ChannelsX-Workspace-Id headers and optional workspaceId body fields. This is the current workspace UUID.
Channel IDSettings > API Details > Channelschannel_id, filters.channel_ids, and channel filters.
Human agent IDSettings > API Details > Agentsagent_id, assignee_id when assignee_type is agent, and agent assignment filters.
AI agent ID / pilot IDSettings > API Details > Agentspilot_id, assignee_id when assignee_type is pilot, and AI agent assignment filters.
Team ID-assignee_id when assignee_type is team, and team filters.
Customer IDCustomer moduleOpen a customer profile and use the last UUID in the URL: /dashboard/[workspace_id]/customers/[customer_id].
Use Settings > API Details > Channels as the current reference for workspace IDs.