Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.augmentcode.com/llms.txt

Use this file to discover all available pages before exploring further.

Preview FeatureThe Analytics API is currently in preview and is available exclusively to Enterprise customers.
Important: Timezone and Data AvailabilityAll dates in requests and responses are interpreted and returned in UTC timezone. The most recent queryable date is “yesterday” (UTC), and data for the previous day becomes available at approximately 02:00 UTC each day.
Data FreshnessAnalytics metrics endpoints (DAU, usage, activity) are updated once daily. Data for a given day becomes available the following day at approximately 02:00 UTC. Budget override endpoints (get-user-budget-overrides, set-user-budget-overrides) read and write configuration in real time.

GET /analytics/v0/dau-count

Returns daily active user counts over a date range.

Query Parameters

ParameterTypeRequiredDescription
start_datestringNoStart date in YYYY-MM-DD format (UTC)
end_datestringNoEnd date in YYYY-MM-DD format (UTC)

Date Range Behavior

ScenarioBehavior
Neither date providedReturns last 7 days ending at yesterday (UTC)
Only start_date providedReturns 7 days starting from start_date, capped at yesterday
Only end_date providedReturns 7 days ending at end_date
Both dates providedReturns the specified inclusive range

Constraints

ConstraintValue
Maximum date range90 days
Maximum historical lookback2 years
Today and future datesNot allowed (data available at ~02:00 UTC next day)
TimezoneAll dates interpreted as UTC

Example Request

curl -X GET "https://api.augmentcode.com/analytics/v0/dau-count?start_date=2025-10-15&end_date=2025-10-20" \
  -H "Authorization: Bearer <your-api-token>"

Example Response

{
  "daily_active_user_counts": [
    {"date": "2025-10-15", "user_count": 100},
    {"date": "2025-10-16", "user_count": 120},
    {"date": "2025-10-17", "user_count": 95},
    {"date": "2025-10-18", "user_count": 140},
    {"date": "2025-10-19", "user_count": 88},
    {"date": "2025-10-20", "user_count": 110}
  ],
  "metadata": {
    "effective_start_date": "2025-10-15",
    "effective_end_date": "2025-10-20",
    "generated_at": "2025-10-21T10:30:00Z",
    "total_days": 6
  }
}

Response Fields

FieldTypeDescription
daily_active_user_countsarrayArray of daily user counts, one per day
daily_active_user_counts[].datestringCalendar date (YYYY-MM-DD)
daily_active_user_counts[].user_countintegerNumber of unique active users
metadata.effective_start_datestringActual start date used (UTC, after defaults/clamping)
metadata.effective_end_datestringActual end date used (UTC, after defaults/clamping)
metadata.generated_atstringResponse generation timestamp (ISO 8601)
metadata.total_daysintegerNumber of days in the range

GET /analytics/v0/dau

Returns the list of active users for a specific date. Supports pagination.

Query Parameters

ParameterTypeRequiredDescription
datestringNoDate to query in YYYY-MM-DD format (UTC)
cursorstringNoPagination cursor from previous response
page_sizeintegerNoNumber of results per page

Date Behavior

ScenarioBehavior
Date not providedDefaults to yesterday (UTC)
Date providedReturns users active on that date (must be yesterday or earlier)

Pagination

ParameterDefaultMaximum
page_size100250
To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

ConstraintValue
Maximum historical lookback2 years
Today and future datesNot allowed (data available at ~02:00 UTC next day)
TimezoneAll dates interpreted as UTC

Example Request (First Page)

curl -X GET "https://api.augmentcode.com/analytics/v0/dau?date=2025-10-15&page_size=50" \
  -H "Authorization: Bearer <your-api-token>"

Example Response

{
  "users": [
    {"user_email": "alice@example.com"},
    {"user_email": "bob@example.com"},
    {"service_account_name": "ci-bot"}
  ],
  "pagination": {
    "next_cursor": "eyJsYXN0X2lkIjoidXNlcjUwIn0=",
    "has_more": true
  },
  "metadata": {
    "effective_date": "2025-10-15",
    "generated_at": "2025-10-16T10:30:00Z",
    "returned_user_count": 3
  }
}

Example Request (Next Page)

curl -X GET "https://api.augmentcode.com/analytics/v0/dau?date=2025-10-15&page_size=50&cursor=eyJsYXN0X2lkIjoidXNlcjUwIn0=" \
  -H "Authorization: Bearer <your-api-token>"

Response Fields

FieldTypeDescription
usersarrayArray of active users
users[].user_emailstringUser’s email address (for regular users)
users[].service_account_namestringService account name (for service accounts)
pagination.next_cursorstringCursor for fetching next page (empty if no more results)
pagination.has_morebooleantrue if more results are available
metadata.effective_datestringActual date used (UTC, after defaults)
metadata.generated_atstringResponse generation timestamp (ISO 8601)
metadata.returned_user_countintegerNumber of users returned in this page
Each user has either user_email or service_account_name, never both.

GET /analytics/v0/daily-usage

Returns daily usage metrics for your organization over a date range. Days with no activity are omitted from the response.

Query Parameters

ParameterTypeRequiredDescription
start_datestringNoStart date in YYYY-MM-DD format (UTC)
end_datestringNoEnd date in YYYY-MM-DD format (UTC)

Date Range Behavior

ScenarioBehavior
Neither date providedReturns last 7 days ending at yesterday (UTC)
Only start_date providedReturns 7 days starting from start_date, capped at yesterday
Only end_date providedReturns 7 days ending at end_date
Both dates providedReturns the specified inclusive range

Constraints

ConstraintValue
Maximum date range90 days
Maximum historical lookback2 years
Today and future datesNot allowed (data available at ~02:00 UTC next day)
TimezoneAll dates interpreted as UTC

Example Request

curl -s -X GET "https://api.augmentcode.com/analytics/v0/daily-usage?start_date=2025-10-15&end_date=2025-10-20" \
  -H "Authorization: Bearer <your-api-token>" | jq .

Example Response

{
  "daily_usage": [
    {
      "date": "2025-10-15",
      "metrics": {
        "total_modified_lines_of_code": 1250,
        "total_messages": 340,
        "total_tool_calls": 890,
        "completions_count": 1500,
        "completions_accepted": 1120,
        "completions_lines_of_code": 980,
        "chat_messages": 85,
        "remote_agent_messages": 0,
        "remote_agent_lines_of_code": 0,
        "ide_agent_messages": 150,
        "ide_agent_lines_of_code": 95,
        "cli_agent_interactive_messages": 40,
        "cli_agent_interactive_lines_of_code": 35,
        "cli_agent_non_interactive_messages": 20,
        "cli_agent_non_interactive_lines_of_code": 20
      }
    }
  ],
  "metadata": {
    "effective_start_date": "2025-10-15",
    "effective_end_date": "2025-10-20",
    "generated_at": "2025-10-21T10:30:00Z",
    "total_days": 1
  }
}

Response Fields

FieldTypeDescription
daily_usagearrayArray of daily usage data points (days with no activity omitted)
daily_usage[].datestringCalendar date (YYYY-MM-DD)
daily_usage[].metricsobjectUsage metrics for this date
daily_usage[].metrics.total_modified_lines_of_codeintegerTotal lines of code modified across all interactions
daily_usage[].metrics.total_messagesintegerTotal messages across all interaction types
daily_usage[].metrics.total_tool_callsintegerTotal tool calls across all agent types
daily_usage[].metrics.completions_countintegerNumber of completion requests
daily_usage[].metrics.completions_acceptedintegerNumber of completions accepted by users
daily_usage[].metrics.completions_lines_of_codeintegerLines of code from completions
daily_usage[].metrics.completions_suggested_lines_of_codeintegerLines of code suggested by completions (before acceptance)
daily_usage[].metrics.chat_messagesintegerNumber of chat messages
daily_usage[].metrics.remote_agent_messagesintegerNumber of Remote Agent messages. Remote Agent has been removed from IDE extensions; this field is retained for historical data.
daily_usage[].metrics.remote_agent_lines_of_codeintegerLines of code from Remote Agent. Remote Agent has been removed from IDE extensions; this field is retained for historical data.
daily_usage[].metrics.ide_agent_messagesintegerNumber of IDE Agent messages
daily_usage[].metrics.ide_agent_lines_of_codeintegerLines of code from IDE Agent
daily_usage[].metrics.cli_agent_interactive_messagesintegerNumber of CLI Agent interactive messages
daily_usage[].metrics.cli_agent_interactive_lines_of_codeintegerLines of code from CLI Agent interactive mode
daily_usage[].metrics.cli_agent_non_interactive_messagesintegerNumber of CLI Agent non-interactive messages
daily_usage[].metrics.cli_agent_non_interactive_lines_of_codeintegerLines of code from CLI Agent non-interactive mode
metadata.effective_start_datestringActual start date used (UTC, after defaults/clamping)
metadata.effective_end_datestringActual end date used (UTC, after defaults/clamping)
metadata.generated_atstringResponse generation timestamp (ISO 8601)
metadata.total_daysintegerNumber of days with data in the response

GET /analytics/v0/user-activity

Returns aggregated usage metrics per user over a date range. Users with no activity are omitted. Supports pagination.

Query Parameters

ParameterTypeRequiredDescription
start_datestringNoStart date in YYYY-MM-DD format (UTC)
end_datestringNoEnd date in YYYY-MM-DD format (UTC)
cursorstringNoPagination cursor from previous response
page_sizeintegerNoNumber of results per page

Date Range Behavior

ScenarioBehavior
Neither date providedReturns last 7 days ending at yesterday (UTC)
Only start_date providedReturns 7 days starting from start_date, capped at yesterday
Only end_date providedReturns 7 days ending at end_date
Both dates providedReturns the specified inclusive range

Pagination

ParameterDefaultMaximum
page_size50100
To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

ConstraintValue
Maximum date range90 days
Maximum historical lookback2 years
Today and future datesNot allowed (data available at ~02:00 UTC next day)
TimezoneAll dates interpreted as UTC

Example Request

curl -s -X GET "https://api.augmentcode.com/analytics/v0/user-activity?start_date=2025-10-15&end_date=2025-10-20&page_size=3" \
  -H "Authorization: Bearer <your-api-token>" | jq .

Example Response

{
  "users": [
    {
      "user_email": "alice@example.com",
      "active_days": 5,
      "metrics": {
        "total_modified_lines_of_code": 450,
        "total_messages": 65,
        "total_tool_calls": 120,
        "completions_count": 320,
        "completions_accepted": 280,
        "completions_lines_of_code": 350,
        "chat_messages": 25,
        "remote_agent_messages": 0,
        "remote_agent_lines_of_code": 0,
        "ide_agent_messages": 30,
        "ide_agent_lines_of_code": 40,
        "cli_agent_interactive_messages": 8,
        "cli_agent_interactive_lines_of_code": 10,
        "cli_agent_non_interactive_messages": 5,
        "cli_agent_non_interactive_lines_of_code": 5
      }
    },
    {
      "user_email": "bob@example.com",
      "active_days": 3,
      "metrics": {
        "total_modified_lines_of_code": 280,
        "total_messages": 70,
        "total_tool_calls": 75,
        "completions_count": 150,
        "completions_accepted": 120,
        "completions_lines_of_code": 180,
        "chat_messages": 40,
        "remote_agent_messages": 0,
        "remote_agent_lines_of_code": 0,
        "ide_agent_messages": 20,
        "ide_agent_lines_of_code": 55,
        "cli_agent_interactive_messages": 3,
        "cli_agent_interactive_lines_of_code": 15,
        "cli_agent_non_interactive_messages": 2,
        "cli_agent_non_interactive_lines_of_code": 5
      }
    },
    {
      "service_account_name": "ci-bot",
      "active_days": 6,
      "metrics": {
        "total_modified_lines_of_code": 200,
        "total_messages": 50,
        "total_tool_calls": 85,
        "completions_count": 0,
        "completions_accepted": 0,
        "completions_lines_of_code": 0,
        "chat_messages": 0,
        "remote_agent_messages": 0,
        "remote_agent_lines_of_code": 0,
        "ide_agent_messages": 0,
        "ide_agent_lines_of_code": 0,
        "cli_agent_interactive_messages": 0,
        "cli_agent_interactive_lines_of_code": 0,
        "cli_agent_non_interactive_messages": 50,
        "cli_agent_non_interactive_lines_of_code": 200
      }
    }
  ],
  "pagination": {
    "next_cursor": "eyJsYXN0X2lkIjoidXNlcjMifQ==",
    "has_more": true
  },
  "metadata": {
    "effective_start_date": "2025-10-15",
    "effective_end_date": "2025-10-20",
    "generated_at": "2025-10-21T10:30:00Z",
    "total_days": 6,
    "returned_user_count": 3
  }
}

Response Fields

FieldTypeDescription
usersarrayArray of user activity records (users with no activity omitted)
users[].user_emailstringUser’s email address (for regular users)
users[].service_account_namestringService account name (for service accounts)
users[].active_daysintegerNumber of distinct days with activity in the date range
users[].metricsobjectUsage metrics for this user (summed over date range)
users[].metrics.total_modified_lines_of_codeintegerTotal lines of code modified across all interactions
users[].metrics.total_messagesintegerTotal messages across all interaction types
users[].metrics.total_tool_callsintegerTotal tool calls across all agent types
users[].metrics.completions_countintegerNumber of completion requests
users[].metrics.completions_acceptedintegerNumber of completions accepted
users[].metrics.completions_lines_of_codeintegerLines of code from completions
users[].metrics.completions_suggested_lines_of_codeintegerLines of code suggested by completions (before acceptance)
users[].metrics.chat_messagesintegerNumber of chat messages
users[].metrics.remote_agent_messagesintegerNumber of Remote Agent messages. Remote Agent has been removed from IDE extensions; this field is retained for historical data.
users[].metrics.remote_agent_lines_of_codeintegerLines of code from Remote Agent. Remote Agent has been removed from IDE extensions; this field is retained for historical data.
users[].metrics.ide_agent_messagesintegerNumber of IDE Agent messages
users[].metrics.ide_agent_lines_of_codeintegerLines of code from IDE Agent
users[].metrics.cli_agent_interactive_messagesintegerNumber of CLI Agent interactive messages
users[].metrics.cli_agent_interactive_lines_of_codeintegerLines of code from CLI Agent interactive mode
users[].metrics.cli_agent_non_interactive_messagesintegerNumber of CLI Agent non-interactive messages
users[].metrics.cli_agent_non_interactive_lines_of_codeintegerLines of code from CLI Agent non-interactive mode
pagination.next_cursorstringCursor for fetching next page (empty if no more results)
pagination.has_morebooleantrue if more results are available
metadata.effective_start_datestringActual start date used (UTC, after defaults/clamping)
metadata.effective_end_datestringActual end date used (UTC, after defaults/clamping)
metadata.generated_atstringResponse generation timestamp (ISO 8601)
metadata.total_daysintegerTotal number of days in the queried date range
metadata.returned_user_countintegerNumber of users returned in this page
Each user has either user_email or service_account_name, never both.

GET /analytics/v0/daily-user-activity-by-editor-language

Returns user activity metrics broken down by language and editor for a specific date. Supports pagination.

Query Parameters

ParameterTypeRequiredDescription
datestringNoDate to query in YYYY-MM-DD format (UTC)
cursorstringNoPagination cursor from previous response
page_sizeintegerNoNumber of results per page

Date Behavior

ScenarioBehavior
Date not providedDefaults to yesterday (UTC)
Date providedReturns activity for that date (must be yesterday or earlier)

Pagination

ParameterDefaultMaximum
page_size50100
To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

ConstraintValue
Maximum historical lookback2 years
Today and future datesNot allowed (data available at ~02:00 UTC next day)
TimezoneAll dates interpreted as UTC

Example Request (First Page)

curl -X GET "https://api.augmentcode.com/analytics/v0/daily-user-activity-by-editor-language?date=2025-10-15&page_size=50" \
  -H "Authorization: Bearer <your-api-token>"

Example Response

{
  "records": [
    {
      "user_email": "alice@example.com",
      "language": "Python",
      "editor": "VSCode",
      "metrics": {
        "total_modified_lines_of_code": 150,
        "total_messages": 25,
        "total_tool_calls": 40,
        "completions_count": 80,
        "completions_accepted": 65,
        "completions_lines_of_code": 120,
        "chat_messages": 10,
        "remote_agent_messages": 0,
        "remote_agent_lines_of_code": 0,
        "ide_agent_messages": 8,
        "ide_agent_lines_of_code": 12,
        "cli_agent_interactive_messages": 2,
        "cli_agent_interactive_lines_of_code": 3,
        "cli_agent_non_interactive_messages": 0,
        "cli_agent_non_interactive_lines_of_code": 0
      }
    },
    {
      "user_email": "alice@example.com",
      "language": "TypeScript",
      "editor": "VSCode",
      "metrics": {
        "total_modified_lines_of_code": 80,
        "total_messages": 12,
        "total_tool_calls": 18,
        "completions_count": 45,
        "completions_accepted": 38,
        "completions_lines_of_code": 60,
        "chat_messages": 5,
        "remote_agent_messages": 0,
        "remote_agent_lines_of_code": 0,
        "ide_agent_messages": 4,
        "ide_agent_lines_of_code": 10,
        "cli_agent_interactive_messages": 1,
        "cli_agent_interactive_lines_of_code": 2,
        "cli_agent_non_interactive_messages": 0,
        "cli_agent_non_interactive_lines_of_code": 0
      }
    }
  ],
  "pagination": {
    "next_cursor": "eyJsYXN0X2lkIjoidXNlcjMifQ==",
    "has_more": true
  },
  "metadata": {
    "effective_date": "2025-10-15",
    "generated_at": "2025-10-16T10:30:00Z",
    "returned_record_count": 2
  }
}

Example Request (Next Page)

curl -X GET "https://api.augmentcode.com/analytics/v0/daily-user-activity-by-editor-language?date=2025-10-15&page_size=50&cursor=eyJsYXN0X2lkIjoidXNlcjMifQ==" \
  -H "Authorization: Bearer <your-api-token>"

Response Fields

FieldTypeDescription
recordsarrayArray of user/language/editor activity records
records[].user_emailstringUser’s email address (for regular users)
records[].service_account_namestringService account name (for service accounts)
records[].languagestringProgramming language (e.g., “Python”, “TypeScript”, “Unknown”)
records[].editorstringEditor/IDE name (e.g., “VSCode”, “JetBrains”, “CLI”, “Unknown”)
records[].metricsobjectUsage metrics for this user/language/editor combination
records[].metrics.total_modified_lines_of_codeintegerTotal lines of code modified across all interactions
records[].metrics.total_messagesintegerTotal messages across all interaction types
records[].metrics.total_tool_callsintegerTotal tool calls across all agent types
records[].metrics.completions_countintegerNumber of completion requests
records[].metrics.completions_acceptedintegerNumber of completions accepted
records[].metrics.completions_lines_of_codeintegerLines of code from completions
records[].metrics.completions_suggested_lines_of_codeintegerLines of code suggested by completions (before acceptance)
records[].metrics.chat_messagesintegerNumber of chat messages
records[].metrics.remote_agent_messagesintegerNumber of Remote Agent messages. Remote Agent has been removed from IDE extensions; this field is retained for historical data.
records[].metrics.remote_agent_lines_of_codeintegerLines of code from Remote Agent. Remote Agent has been removed from IDE extensions; this field is retained for historical data.
records[].metrics.ide_agent_messagesintegerNumber of IDE Agent messages
records[].metrics.ide_agent_lines_of_codeintegerLines of code from IDE Agent
records[].metrics.cli_agent_interactive_messagesintegerNumber of CLI Agent interactive messages
records[].metrics.cli_agent_interactive_lines_of_codeintegerLines of code from CLI Agent interactive mode
records[].metrics.cli_agent_non_interactive_messagesintegerNumber of CLI Agent non-interactive messages
records[].metrics.cli_agent_non_interactive_lines_of_codeintegerLines of code from CLI Agent non-interactive mode
pagination.next_cursorstringCursor for fetching next page (empty if no more results)
pagination.has_morebooleantrue if more results are available
metadata.effective_datestringActual date used (UTC, after defaults)
metadata.generated_atstringResponse generation timestamp (ISO 8601)
metadata.returned_record_countintegerNumber of records returned in this page
Each record has either user_email or service_account_name, never both. A single user may have multiple records if they used different language/editor combinations on the queried date.

GET /analytics/v0/credit-usage-by-user

Returns credit usage per user over a date range. Supports optional breakdowns by date and/or model. Supports pagination.

Query Parameters

ParameterTypeRequiredDescription
start_datestringNoStart date in YYYY-MM-DD format (UTC)
end_datestringNoEnd date in YYYY-MM-DD format (UTC)
by_datebooleanNoWhen true, results include a per-date breakdown
by_modelbooleanNoWhen true, results include a per-model breakdown
cursorstringNoPagination cursor from previous response
page_sizeintegerNoNumber of results per page

Date Range Behavior

ScenarioBehavior
Neither date providedReturns last 7 days ending at yesterday (UTC)
Only start_date providedReturns 7 days starting from start_date, capped at today (UTC)
Only end_date providedReturns 7 days ending at end_date
Both dates providedReturns the specified inclusive range
Unlike most Analytics API endpoints, this endpoint allows querying up to and including today’s date. Credit usage data is updated approximately every 90 minutes and may be up to 90 minutes out of date.

Dimensions

Use by_date and by_model to control how results are grouped:
DimensionsResult
Neither setOne row per user with total credits over the date range
by_date=trueOne row per user per date
by_model=trueOne row per user per model
Both trueOne row per user per date per model
When a dimension is not requested, the corresponding field (date or model_name) is omitted from the response records.

Pagination

ParameterDefaultMaximum
page_size100500
To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

ConstraintValue
Maximum date range90 days
End dateMust be ≤ today (UTC)
TimezoneAll dates interpreted as UTC

Example Request (No Dimensions)

curl -X GET "https://api.augmentcode.com/analytics/v0/credit-usage-by-user" \
  -H "Authorization: Bearer <your-api-token>"

Example Response

{
  "records": [
    { "user_email": "alice@acme.com", "credits_consumed": 4200 },
    { "user_email": "bob@acme.com", "credits_consumed": 1850 },
    { "service_account_name": "ci-bot", "credits_consumed": 920 }
  ],
  "pagination": {
    "has_more": false
  },
  "metadata": {
    "effective_start_date": "2026-03-10",
    "effective_end_date": "2026-03-16",
    "generated_at": "2026-03-17T04:00:00Z",
    "returned_record_count": 3
  }
}

Example Request (First Page, With Dimensions)

curl -X GET "https://api.augmentcode.com/analytics/v0/credit-usage-by-user?start_date=2026-03-01&end_date=2026-03-07&by_date=true&by_model=true&page_size=2" \
  -H "Authorization: Bearer <your-api-token>"

Example Response

{
  "records": [
    {
      "user_email": "alice@acme.com",
      "credits_consumed": 350,
      "date": "2026-03-01",
      "model_name": "claude-sonnet"
    },
    {
      "user_email": "alice@acme.com",
      "credits_consumed": 120,
      "date": "2026-03-01",
      "model_name": "gpt-4o"
    }
  ],
  "pagination": {
    "next_cursor": "eyJ1IjoiMDAwMSIsImQiOiIyMDI2LTAzLTAxIiwibSI6ImdwdC00byJ9",
    "has_more": true
  },
  "metadata": {
    "effective_start_date": "2026-03-01",
    "effective_end_date": "2026-03-07",
    "generated_at": "2026-03-17T04:00:00Z",
    "returned_record_count": 2
  }
}

Example Request (Next Page)

curl -X GET "https://api.augmentcode.com/analytics/v0/credit-usage-by-user?start_date=2026-03-01&end_date=2026-03-07&by_date=true&by_model=true&page_size=2&cursor=eyJ1IjoiMDAwMSIsImQiOiIyMDI2LTAzLTAxIiwibSI6ImdwdC00byJ9" \
  -H "Authorization: Bearer <your-api-token>"

Response Fields

FieldTypeDescription
recordsarrayArray of credit usage records
records[].user_emailstringUser’s email address (for regular users)
records[].service_account_namestringService account name (for service accounts)
records[].credits_consumedintegerNumber of credits consumed
records[].datestringCalendar date (YYYY-MM-DD). Present only when by_date=true.
records[].model_namestringModel name (e.g., "claude-sonnet", "gpt-4o"). Present only when by_model=true.
pagination.next_cursorstringCursor for fetching next page (empty if no more results)
pagination.has_morebooleantrue if more results are available
metadata.effective_start_datestringActual start date used (UTC, after defaults/clamping)
metadata.effective_end_datestringActual end date used (UTC, after defaults/clamping)
metadata.generated_atstringResponse generation timestamp (ISO 8601)
metadata.returned_record_countintegerNumber of records returned in this page
Each record has either user_email or service_account_name, never both.

POST /analytics/v0/get-user-budget-overrides

Returns per-user budget overrides configured for the organization. Budget overrides are custom limits for individual users or service accounts that differ from the organization’s default per-user budget. Overrides for users no longer in the organization are silently omitted.

Request Body (JSON)

FieldTypeRequiredDescription
user_emailsarray of stringsNoEmail addresses to filter by (case-insensitive). If omitted (along with service_account_names), returns all overrides.
service_account_namesarray of stringsNoService account names to filter by. Can be combined with user_emails.
resourcestringNoFilter by resource type: BUDGET_RESOURCE_CREDITS_CONSUMED or BUDGET_RESOURCE_USD_COST. If omitted, returns all resource types.
periodstringNoFilter by period: BUDGET_PERIOD_MONTHLY. If omitted, returns all periods.

Constraints

ConstraintValue
Resource-plan compatibilityReturned overrides are filtered to match the organization’s billing plan (credit-based or USD)
IdentityEach override has either user_email or service_account_name, never both
Unknown identitiesReturns InvalidArgument listing all unknown emails or service account names (e.g., user_email(s) not found on this organization: a@x.com, b@x.com)

Example Request

curl -X POST "https://api.augmentcode.com/analytics/v0/get-user-budget-overrides" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "user_emails": ["alice@example.com", "bob@example.com"],
    "resource": "BUDGET_RESOURCE_CREDITS_CONSUMED",
    "period": "BUDGET_PERIOD_MONTHLY"
  }'

Example Response

{
  "overrides": [
    {
      "user_email": "alice@example.com",
      "resource": "BUDGET_RESOURCE_CREDITS_CONSUMED",
      "period": "BUDGET_PERIOD_MONTHLY",
      "config": {
        "limit": "5000"
      }
    },
    {
      "user_email": "bob@example.com",
      "resource": "BUDGET_RESOURCE_CREDITS_CONSUMED",
      "period": "BUDGET_PERIOD_MONTHLY",
      "config": {
        "limit": "10000"
      }
    }
  ]
}

Response Fields

FieldTypeDescription
overridesarrayPer-user budget overrides matching the request filters
overrides[].user_emailstringUser’s email address (regular users)
overrides[].service_account_namestringService account name (service accounts)
overrides[].resourcestringBUDGET_RESOURCE_CREDITS_CONSUMED or BUDGET_RESOURCE_USD_COST
overrides[].periodstringBUDGET_PERIOD_MONTHLY
overrides[].config.limitstringBudget limit as a string-encoded positive integer. Empty string means the limit has been cleared.

POST /analytics/v0/set-user-budget-overrides

Sets per-user budget overrides for the organization in a single batch. To clear an override, set config.limit to an empty string. Uses partial-failure semantics: valid overrides are applied even if some entries in the batch fail. Failed entries are returned in the failures array.

Request Body (JSON)

FieldTypeRequiredDescription
overridesarrayYesList of overrides to set. Must not be empty.
overrides[].user_emailstringConditionalUser’s email address. Exactly one of user_email or service_account_name must be set.
overrides[].service_account_namestringConditionalService account name. Exactly one of user_email or service_account_name must be set.
overrides[].resourcestringYesBUDGET_RESOURCE_CREDITS_CONSUMED or BUDGET_RESOURCE_USD_COST.
overrides[].periodstringYesBUDGET_PERIOD_MONTHLY.
overrides[].configobjectYesBudget configuration.
overrides[].config.limitstringYesPositive integer (max 18 digits, no leading zeros), or empty string "" to clear.

Constraints

ConstraintValue
Maximum overrides per request5,000
IdentityExactly one of user_email or service_account_name per override
DuplicatesNo duplicate (identity, resource, period) combinations in the same request
Resource-plan compatibilityResource type must match the organization’s billing plan (e.g., BUDGET_RESOURCE_CREDITS_CONSUMED on credit-based plans, BUDGET_RESOURCE_USD_COST on USD plans)
Limit formatPositive integer with no leading zeros, max 18 digits, or empty string to clear

Example Request

curl -X POST "https://api.augmentcode.com/analytics/v0/set-user-budget-overrides" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "overrides": [
      {
        "user_email": "alice@example.com",
        "resource": "BUDGET_RESOURCE_USD_COST",
        "period": "BUDGET_PERIOD_MONTHLY",
        "config": {"limit": "500"}
      },
      {
        "service_account_name": "ci-bot",
        "resource": "BUDGET_RESOURCE_USD_COST",
        "period": "BUDGET_PERIOD_MONTHLY",
        "config": {"limit": "200"}
      }
    ]
  }'

Example Response (All Succeeded)

{
  "failures": []
}

Example Response (Partial Failure)

{
  "failures": [
    {
      "user_email": "unknown@example.com",
      "error_message": "user_email \"unknown@example.com\" does not correspond to a user on this organization"
    }
  ]
}
Valid overrides in the batch were still applied. Only entries in failures were not.

Response Fields

FieldTypeDescription
failuresarrayPer-override failures. Empty array means all overrides were applied.
failures[].user_emailstringEmail of the user whose override failed (regular users)
failures[].service_account_namestringService account name whose override failed (service accounts)
failures[].error_messagestringHuman-readable description of the failure

Rate Limiting

The Analytics API enforces rate limits to ensure fair usage and system stability.
EndpointSustained rateBurst allowance
Most endpoints60 requests/minute (1 request/second)20 requests
/analytics/v0/credit-usage-by-user30 requests/minute (0.5 requests/second)10 requests
When you exceed the rate limit, the API returns HTTP status code 429 Too Many Requests. Subsequent requests are blocked for approximately 10 seconds before new requests are accepted.

Best Practices

  1. Batch your requests: Instead of making many small requests, use larger date ranges (up to 90 days) to retrieve more data per request.
  2. Implement exponential backoff: If you receive a 429 response, wait before retrying. Start with a short delay and increase it with each consecutive failure.
  3. Cache responses: Most Analytics endpoints update only once daily, so cache responses and avoid re-fetching the same data within a 24-hour period. For /analytics/v0/credit-usage-by-user, which refreshes approximately every 90 minutes, use a shorter cache window of around 90 minutes. Budget override responses reflect real-time configuration and should not be cached long-term.
  4. Use pagination efficiently: When paginating through large result sets, process each page before requesting the next one rather than fetching all pages as fast as possible.
  5. Spread requests over time: If you need to make multiple API calls, distribute them evenly rather than sending them all at once.

Error Responses

The API returns standard HTTP status codes:
Status CodeDescription
400Invalid request (e.g., invalid date format, range exceeds 90 days)
401Missing or invalid authentication token
403Insufficient permissions
429Too many requests (rate limit exceeded)
500Internal server error

Example Error Response

{
  "error": {
    "code": "InvalidArgument",
    "message": "end_date cannot be later than yesterday (UTC)"
  }
}