API documentation - Helpdesk Export

The All Tickets Dump API returns the ticket-level data behind Helpdesk Analytics. For each ticket you get its category, status, priority, assignee, SLA and escalation details, key dates, and the profile of the person it was raised for. Use it to feed your own data warehouse, BI tool or reporting pipeline instead of exporting from the dashboard by hand.

The API is region-specific: you call the authentication and analytics hosts of the region your workspace is hosted in.

📘

Before you start

You need an API credential with the Read Analytics Data scope, created in Admin Console → API credentials. See API credentials.

How it works

  1. Create an API credential in the Admin Console with the Read Analytics Data scope.
  2. Generate an access token from your region's authentication URL.
  3. Call the analytics endpoint for your region with the access token, a date range and pagination parameters.
  4. Page through the results until you have fetched all tickets.

Step 1: Create an API credential

  1. In the Admin Console, go to API credentials.
  2. Click Add credentials.
  3. Enter an Auth name (up to 50 characters).
  4. In Allowed scope, select Read Analytics Data.
  5. Click Create credentials.
  6. Copy the Client ID, Client secret, Username and Password, and store them in a secure location such as a secrets manager.
🚧

Use Read Analytics Data, not Download Ticket Report

This API requires the Read Analytics Data scope. A credential that only has the Download Ticket Report scope is rejected with an Invalid scope error.

🚧

Secrets are shown only once

The client secret and password cannot be viewed again after you leave the page — not by you and not by Leena AI support. If you lose them, create a new credential and revoke the old one.

👍

Find your region

The How to use this key command shown on the credential screen already contains your region's authentication URL (for example https://us-east-1-acl.leena.ai/...). Use the same region for the analytics URL below.

📘

Already using the All Events Dump API?

You can use the same credential and access token. Both APIs need the same scope. Only the metricId is different.

Step 2: Choose your regional base URLs

Use the Auth URL to generate tokens and the Analytics URL to fetch data. Both must belong to the same region — a token issued in one region is not valid in another.

RegionAuth URLAnalytics URL
US East (us-east-1)https://us-east-1-acl.leena.aihttps://us-east-1-analytics-api.leena.ai
EU West (eu-west-1)https://eu-west-1-acl.leena.aihttps://eu-west-1-analytics-api.leena.ai
EU Central (eu-central-1)https://eu-central-1-acl.leena.aihttps://eu-central-1-analytics-api.leena.ai
Canada Central (canadacentral)https://canadacentral-acl.leena.aihttps://canadacentral-analytics-api.leena.ai
Asia Pacific – Singapore (ap-southeast-1)https://ap-southeast-1-acl.leena.aihttps://ap-southeast-1-analytics-api.leena.ai
Asia Pacific – India (ap-south-1)https://acl.leena.aihttps://analytics-api.leena.ai
Qatar Central (qatarcentral)https://qatarcentral-acl.leena.aihttps://qatarcentral-analytics-api.leena.ai
Middle East Central 2 (me-central2)https://me-central2-acl.leena.aihttps://me-central2-analytics-api.leena.ai
📘

Dedicated instances

If your workspace runs on a dedicated instance, your hosts use your instance name instead of a region code. Contact your Leena AI representative for the exact URLs.

In the examples below, replace <AUTH_URL> and <ANALYTICS_URL> with the values for your region.

Step 3: Generate an access token

Send a POST request to your region's token endpoint. The Authorization header is HTTP Basic auth built from clientId:clientSecret, Base64-encoded. The username and password go in the request body.

Endpoint

POST <AUTH_URL>/api/v1.0/oauth/token

Request

curl --location '<AUTH_URL>/api/v1.0/oauth/token' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Basic <base64(clientId:clientSecret)>' \
  --data '{
    "username": "<username>",
    "password": "<password>",
    "grant_type": "password"
  }'

Response — 200 OK

{
  "token_type": "Bearer",
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_in": 1800,
  "refresh_token": "82e2cbfa-4d1a-42fc-857e-7da2faad7b70"
}
🚧

Tokens expire after 30 minutes

expires_in is in seconds. Generate a new token, or use the refresh token with POST <AUTH_URL>/api/v1.0/oauth/refresh-token, before the access token expires. Long exports that page through many results should check token age between requests.

For more on grant types, refresh tokens and credential rotation, see API credentials – token generation.

Step 4: Fetch all tickets

Endpoint

GET <ANALYTICS_URL>/api/analytics/query/external

Headers

HeaderValue
AuthorizationBearer <access_token>

You don't need to pass a bot ID. The workspace is identified from the access token.

Query parameters

ParameterTypeRequiredDescription
metricIdstringYesFixed value: cm:allTicketsDump (URL-encoded: cm%3AallTicketsDump).
isCustomMetricbooleanYesFixed value: true.
responseTypestringYesFixed value: table.
fromstring (ISO 8601)YesStart of the date range, e.g. 2026-01-01 or 2026-01-01T00:00:00+05:30. A date without a time is read as 00:00 UTC.
tostring (ISO 8601)YesEnd of the date range, in the same format as from. To cover all of January, use from=2026-01-01&to=2026-02-01.
pageintegerNoPage number, starting at 1. Default: 1.
limitintegerNoNumber of tickets per page. Default: 10.
timezonestring (IANA)NoTimezone used to render date and time values, e.g. America/New_York. Default: Asia/Calcutta.

Request

Replace <ANALYTICS_URL> with your region's Analytics URL and <access_token> with the token from Step 3.

curl --location --request GET '<ANALYTICS_URL>/api/analytics/query/external?metricId=cm%3AallTicketsDump&isCustomMetric=true&responseType=table&from=2026-01-01&to=2026-02-01&page=1&limit=100' \
--header 'Authorization: Bearer <access_token>'

For example, for a workspace in US East (us-east-1):

curl --location --request GET 'https://us-east-1-analytics-api.leena.ai/api/analytics/query/external?metricId=cm%3AallTicketsDump&isCustomMetric=true&responseType=table&from=2026-01-01&to=2026-02-01&page=1&limit=100' \
--header 'Authorization: Bearer <access_token>'
📘

Import into Postman

You can paste either command into Postman with Import → Raw text. Postman sets up the request, query parameters and header for you.

Response — 200 OK

The example below shows the response structure, with the columns and tableData arrays shortened.

{
  "isSuccess": true,
  "result": {
    "current": 1,
    "page": 1,
    "limit": 100,
    "total": 8421,
    "isManageColumnsEnabled": true,
    "columns": [
      {
        "key": "<column key>",
        "label": "Ticket Id",
        "type": "string",
        "sortable": true,
        "isDynamicColumn": false,
        "isMandatory": true,
        "isVisible": true,
        "sticky": false
      }
    ],
    "tableData": [
      { "<column key>": "<value>" }
    ]
  }
}
FieldTypeDescription
isSuccessbooleantrue if the query succeeded.
result.tableDataarrayThe tickets on this page. Each element is one ticket, with one property for each column in result.columns.
result.columnsarrayColumn metadata. Each entry's key is the property name used in tableData, and label is its display name. Use label to match a key to the columns described in Response columns.
result.totalintegerTotal number of tickets across all pages for the date range.
result.pageintegerPage number returned. result.current holds the same value.
result.limitintegerPage size returned.
result.isManageColumnsEnabledbooleanDashboard display setting. Can be ignored.
📘

Read values as strings

Values in tableData are returned as display-formatted strings. Empty fields contain "". The type property in result.columns describes how the dashboard renders a column, not the data type of its values. Don't use it to parse the data.

Response columns

Each ticket in tableData contains the following columns. The labels below match label in result.columns. Read each column's key from result.columns and use it to read values from the rows.

Ticket fields

These columns are always present.

#LabelDescription
1Ticket IdUnique ID of the ticket, as shown in Helpdesk. Use it as the primary key when storing or de-duplicating tickets.
2InstanceThe Helpdesk instance (department) the ticket belongs to. Returned as the instance's display name.
3CategoryTicket category.
4Sub CategoryTicket sub-category.
5Request TypeType of request.
6StatusCurrent status of the ticket, e.g. open, resolved or closed.
7PriorityPriority assigned to the ticket.
8Created OnDate and time the ticket was created.
9Closing DateDate and time the ticket was closed. Empty if the ticket is still open.
10Reopen DatetimeDate and time the ticket was last reopened. Empty if it was never reopened.
11Reopen CountNumber of times the ticket has been reopened.
12Assignee NameAgent the ticket is assigned to.
13Assignee EmailEmail address of the assignee.
14Assignee GroupGroup or queue the ticket is assigned to.
15Raised For NamePerson the ticket was raised for.
16Raised For EmailEmail address of the person the ticket was raised for.
17Raised For Employee IdEmployee ID of the person the ticket was raised for.
18Raised By NamePerson who raised the ticket. Differs from Raised For when someone raises a ticket on another person's behalf.
19Raised By EmailEmail address of the person who raised the ticket.
20Raised By Employee IdEmployee ID of the person who raised the ticket.
21Intake ChannelChannel the ticket was raised through, e.g. Web, Microsoft Teams, Email.
22SLA LevelSLA tier that applies to the ticket.
23Is Response EscalatedWhether the ticket breached its response SLA and was escalated.
24Is Resolution EscalatedWhether the ticket breached its resolution SLA and was escalated.
25Agent Comments CountNumber of comments agents added to the ticket.
26RatingFeedback rating the requester gave on the ticket. Empty if no rating was given.
27DeletedWhether the ticket has been deleted.

User profile fields

After the ticket fields, each ticket includes profile fields for the person the ticket was raised for. Which fields appear depends on your workspace's user profile configuration, so the set varies between workspaces. For example:

LabelDescription
CountryUser's country.
StateUser's state or region.
LocationUser's work location.
Business UnitUser's business unit.
Business SegmentUser's business segment.
Manager NameName of the user's manager.
Management Chain Level 03 – 05The user's management hierarchy at levels 3, 4 and 5.
Termination StatusWhether the user is active or has left the organization.
VIP MembershipWhether the user is marked as a VIP.

Read result.columns to get the exact list of fields for your workspace. Fields that aren't filled in for a user are returned as "".

For how ticket metrics are calculated in the dashboard, see Ticket Volume Trend.

Paginating through results

Results are paginated. To fetch all tickets for a date range:

  1. Request page=1 with your chosen limit.
  2. Read result.total and calculate the number of pages: ceil(total / limit).
  3. Request each following page by incrementing page until you have fetched all pages.
👍

Best practices

  • Pull data in smaller date windows (for example one week or one month at a time) for high-volume workspaces. Large ranges and page sizes increase response time.
  • Tickets change after they're created: their status, assignee, SLA escalation and closing date are updated over time. For scheduled syncs, re-fetch recent windows and update existing rows by Ticket Id instead of only appending new ones.
  • Responses are not cached, so every call returns the latest processed data. Recent ticket updates can take some time to be processed before they appear.
  • Store credentials in a secrets manager. Don't share them in documents, email or chat.

Errors

StatusMessageWhat to do
401You are not authorized to perform this actionThe Authorization header is missing, or the token is invalid or expired. Generate a new token. Check that the token and analytics URLs are from the same region.
401Invalid authorization header. Must be a bearer tokenSend the header as Authorization: Bearer <access_token>.
401You are not authorized to perform this action. Invalid scope.The credential doesn't have the Read Analytics Data scope. Create a credential with that scope.
401 (token endpoint)—Wrong client ID, client secret, username or password, or the credential has been revoked.
500Metric not foundCheck that metricId=cm:allTicketsDump and isCustomMetric=true are both set.

Did this page help you?