Help

Analytics Api

Airgentic Help

Use the Analytics API to export raw records for AI customer service conversations from your Airgentic service.


Before You Start

You need:

  • Your account ID
  • Your service ID
  • An Insights API key created on the Security screen

The API key must be passed in the api-key request header.


Endpoint

Use the following endpoint:

GET https://admin.airgentic.com/api/insights/raw

This endpoint returns the raw analytics records for a single Airgentic service over a date range.


Query Parameters

Parameter Required Description
account_id Yes Your Airgentic account ID
service_id Yes The service ID to query
start_date Yes Start date in YYYY-MM-DD format
end_date No End date in YYYY-MM-DD format. If omitted, the API uses start_date

Date handling:

  • start_date is inclusive
  • end_date is inclusive
  • Dates are interpreted in UTC

Request Header

Header Required Description
api-key Yes The Insights API key from the Security screen

Example Request

curl -H "api-key: <API Key>" \
  "https://admin.airgentic.com/api/insights/raw?account_id=<account ID>&service_id=<service ID>&start_date=2026-01-01&end_date=2026-01-20"

For a single day, you can omit end_date:

curl -H "api-key: <API Key>" \
  "https://admin.airgentic.com/api/insights/raw?account_id=<account ID>&service_id=<service ID>&start_date=2026-01-20"

Response Format

The response is a JSON object with request metadata and a data array of raw analytics records:

{
  "account_id": "bcit",
  "service_id": "web",
  "start_date": "2026-01-01",
  "end_date": "2026-01-20",
  "record_count": 2,
  "data": [
    {
      "account_id": "bcit",
      "service_id": "web",
      "partition_id": "bcit_web",
      "date_time": "2026-01-20T03:14:15.123456+00:00",
      "browser_url": "https://www.example.com/help",
      "session_id": "8b4d6c57-8b5a-4b1d-a442-6a85e7e3958c",
      "user_id": "GA1.1.123456789.1234567890",
      "thread_id": "9f5901d0-5da2-4b92-b587-3f83d58640d6",
      "opening_question": "How do I reset my password?",
      "lang": "en-AU",
      "thread_concluded": true,
      "thread_chat_history": "...",
      "full_chat_history": null,
      "city": "Vancouver",
      "region": "British Columbia",
      "country": "Canada",
      "latitude": 49.2827,
      "longitude": -123.1207,
      "expert_agent": "default",
      "citation_urls": [
        "https://www.example.com/help/reset-password"
      ],
      "billable": true,
      "moderated_hate": "Safe",
      "moderated_selfharm": "Safe",
      "moderated_sexual": "Safe",
      "moderated_violence": "Safe",
      "completeness": "Full",
      "sentiment": "Neutral",
      "product": null,
      "class_custom1": false,
      "class_custom2": null,
      "class_custom3": null,
      "class_custom4": null,
      "class_custom5": null,
      "user_rating": "Good",
      "question_type": null,
      "error_code": null,
      "needs_review": false
    }
  ]
}

Records are returned in descending order by date_time (newest first).


Record Fields

Each record in data can include the following fields:

Field Description
account_id Account ID for the record
service_id Service ID for the record
partition_id Internal partition key, usually <account_id>_<service_id>
date_time Timestamp of the record in ISO 8601 format
browser_url Page URL where the conversation originated
session_id Session ID for the visitor session
user_id Optional external user identifier, if configured and captured
thread_id Conversation thread ID
previous_thread_id Previous thread ID when a thread continues from an earlier one
opening_question The first question asked in the thread
lang Browser or conversation language
thread_concluded Whether the thread was concluded
thread_chat_history Raw chat history for the thread
full_chat_history Full multi-thread chat history when available
city Detected city of the user
region Detected region or state
country Detected country
latitude Latitude of detected location
longitude Longitude of detected location
expert_agent Specialist agent that handled the conversation
citation_urls URLs cited in the AI answer
billable Whether the interaction counted as billable
moderated_hate Hate-safety moderation result
moderated_selfharm Self-harm moderation result
moderated_sexual Sexual-content moderation result
moderated_violence Violence moderation result
completeness Whether the answer was complete, partial, or unanswered
sentiment Detected user sentiment
product Product associated with the conversation, when available
class_custom1 to class_custom5 Internal custom classification fields
user_rating User feedback such as thumbs up or thumbs down
question_type Optional classified question type
error_code Internal error code, if an error occurred
needs_review Whether the interaction has been flagged for review

Common Errors

Status Meaning
400 Bad Request A date parameter is invalid. Use YYYY-MM-DD
401 Unauthorized The api-key header is missing or invalid
403 Forbidden The Insights API is not enabled for this service
404 Not Found The account/service combination was not found
500 Internal Server Error Airgentic could not retrieve the records

Notes

  • The API returns raw analytics records related to AI customer service conversations.
  • Historical records may contain null values for fields that were added after the conversation took place.
  • The API is designed for programmatic export and downstream reporting, not for interactive filtering in the browser.

See Also

You have unsaved changes