> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# Get Revenue

GET https://acme.captain.dev/v1/indexes/{index}/analytics/revenue

Get the revenue, orders and average order value that searches earned, by day, from purchase events. A purchased item counts as direct when its event carries the search's `queryID`, and as assisted when the same shopper clicked it after a search in the 24 hours before. Also the shopper funnel: searched, clicked, added to cart and purchased. `arms` splits the numbers by the index that answered each search, so the copies in a group assignment can be compared.

Reference: https://docs.captain.dev/reference/product-search/analytics/get-revenue

## Authentication

- `Authorization` header (bearer token, required) — A search key, issued by Captain. Sent as Authorization: Bearer \<key>.

## Request

### Path parameters

- `index` (string, required) — index name

### Query parameters

- `start_date` (string, optional) — first day, UTC, inclusive (YYYY-MM-DD). Default: 6 days before end_date (a 7-day window)
- `end_date` (string, optional) — last day, UTC, inclusive (YYYY-MM-DD). Default: today. At most 366 days from start_date
- `start_time` (string, optional) — an exact start instead of start_date: unix seconds, or ISO 8601 in UTC (2026-10-10T10:00:00Z). start_date and end_date in the reply are then the UTC days the window touches
- `end_time` (string, optional) — an exact end (exclusive): unix seconds or ISO 8601 with Z. Default: now; never later than now. Must be after start_time
- `indexes` (string, optional) — more indexes to count, comma separated (an experiment's arms, each a copy of the index); at most 20 in all. The key must be able to read each one
- `arm` (string, optional) — only this index's searches and the orders they earned: the path's index or one in indexes
- `currency` (string, optional) — only purchases in this currency (one that names none counts in any). Default: the currency of the most purchases
- `served_index` (string, optional) — the same as arm: one group copy's traffic (a search routed by the index's assignment is logged under the index, and its copy is an arm of this report)
- `group_by` (enum, optional) — user: one row per shopper and index (RevenueByUser), for a readout that resamples whole shoppers. Left out: totals, days and arms (RevenueByDay)
  - Allowed values: `user`
- `by_user` (boolean, optional, default: false) — true: the same as group_by=user

## Response

### 200

report

- `Analytics_get_revenue_Response_200`

## Types

### RevenueByDay

- `start_date` (string, required)
- `end_date` (string, required)
- `revenue` (double, required) — search-attributed revenue: direct.revenue + assisted.revenue
- `orders` (integer, required) — search-attributed orders: direct.orders + assisted.orders
- `aov` (double, required, nullable) — revenue / orders; null with no orders
- `tracked_visitors` (integer, required) — distinct user tokens with a tracked search
- `revenue_per_visitor` (double, required, nullable) — revenue / tracked_visitors, four decimals; null with no visitors
- `direct` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0Direct, required) — lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here
- `assisted` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0Assisted, required) — lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line
- `add_to_cart_count` (integer, required) — addToCart conversions that carry a queryID
- `funnel` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0Funnel, required) — shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it
- `indexes` (list of string, required) — the indexes counted: the path's, then indexes
- `arm` (string, required, nullable) — the arm asked for, else null
- `currency` (string, required, nullable) — the currency counted: the one asked for, else the one of the most purchases; null when no purchase named one
- `dates` (list of V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItems, required) — every day of the window, oldest first
- `arms` (list of V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItems, required) — the same numbers for each index counted (only arm's when one is asked for). An order counts for the index that answered the search behind it
- `all_purchases` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0AllPurchases, required) — every purchase in the currency on these indexes, search-attributed or not (the base for search's share; not narrowed by arm)
- `other_currency_orders` (integer, required) — purchases in another currency, left out
- `orders_without_value` (integer, required) — purchases with neither prices nor value, left out
- `partial` (boolean, optional) — true when the search log was too large to read whole within one request's budget: the numbers cover what was counted
- `partial_reason` (enum, optional) — row_budget: more searches than one request holds (500,000); time_budget: more than 5 seconds of reading; counting (usage): days still being counted
  - Allowed values: `row_budget`, `time_budget`, `counting`
- `counted_through` (double, optional, nullable) — the time (unix seconds) of the last record counted, when partial

### RevenueByUser

group_by=user

- `start_date` (string, required)
- `end_date` (string, required)
- `indexes` (list of string, required)
- `arm` (string, required, nullable)
- `currency` (string, required, nullable)
- `users` (list of V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf1UsersItems, required) — one row per shopper and index: shoppers with a tracked search in the window or a search-attributed order, sorted by index then userToken
- `truncated` (boolean, required) — true when there were more than 100,000 rows: the first are returned
- `partial` (boolean, optional) — true when the search log was too large to read whole within one request's budget: the numbers cover what was counted
- `partial_reason` (enum, optional) — row_budget: more searches than one request holds (500,000); time_budget: more than 5 seconds of reading; counting (usage): days still being counted
  - Allowed values: `row_budget`, `time_budget`, `counting`
- `counted_through` (double, optional, nullable) — the time (unix seconds) of the last record counted, when partial

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0Direct

lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0Assisted

lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0Funnel

shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it

- `visitors` (integer, required) — shoppers seen: a tracked search, or a click, view or add to cart
- `searched` (integer, required) — shoppers with a tracked search (tracked_visitors)
- `clicked` (integer, required) — of those, shoppers who clicked a search result
- `added_to_cart` (integer, required) — of those, shoppers with an addToCart carrying a queryID
- `purchased` (integer, required) — of those, shoppers with a search-attributed order
- `revenue` (double, required) — the search-attributed revenue of the purchased shoppers

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItems

- `date` (string, required)
- `revenue` (double, required) — search-attributed revenue: direct.revenue + assisted.revenue
- `orders` (integer, required) — search-attributed orders: direct.orders + assisted.orders
- `aov` (double, required, nullable) — revenue / orders; null with no orders
- `tracked_visitors` (integer, required) — distinct user tokens with a tracked search
- `revenue_per_visitor` (double, required, nullable) — revenue / tracked_visitors, four decimals; null with no visitors
- `direct` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItemsDirect, required) — lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here
- `assisted` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItemsAssisted, required) — lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line
- `add_to_cart_count` (integer, required) — addToCart conversions that carry a queryID
- `funnel` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItemsFunnel, required) — shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItems

- `index` (string, required)
- `revenue` (double, required) — search-attributed revenue: direct.revenue + assisted.revenue
- `orders` (integer, required) — search-attributed orders: direct.orders + assisted.orders
- `aov` (double, required, nullable) — revenue / orders; null with no orders
- `tracked_visitors` (integer, required) — distinct user tokens with a tracked search
- `revenue_per_visitor` (double, required, nullable) — revenue / tracked_visitors, four decimals; null with no visitors
- `direct` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDirect, required) — lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here
- `assisted` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsAssisted, required) — lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line
- `add_to_cart_count` (integer, required) — addToCart conversions that carry a queryID
- `funnel` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsFunnel, required) — shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it
- `dates` (list of V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItems, required) — every day of the window, oldest first

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0AllPurchases

every purchase in the currency on these indexes, search-attributed or not (the base for search's share; not narrowed by arm)

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf1UsersItems

- `userToken` (string, required)
- `index` (string, required) — the arm: the index that served
- `searches` (integer, required) — tracked searches, keystrokes folded
- `searches_with_click` (integer, required)
- `bounced_searches` (integer, required) — no click, and no next search by the shopper within 30 minutes
- `zero_result_searches` (integer, required)
- `clicks` (integer, required) — click events on the shopper's tracked searches
- `add_to_cart` (integer, required) — addToCart events carrying a queryID
- `orders` (integer, required) — search-attributed orders, direct or assisted
- `revenue` (double, required) — in the report's currency, two decimals
- `parent` (string, optional) — the catalog searched (index itself, unless a group copy served)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItemsDirect

lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItemsAssisted

lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0DatesItemsFunnel

shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it

- `visitors` (integer, required) — shoppers seen: a tracked search, or a click, view or add to cart
- `searched` (integer, required) — shoppers with a tracked search (tracked_visitors)
- `clicked` (integer, required) — of those, shoppers who clicked a search result
- `added_to_cart` (integer, required) — of those, shoppers with an addToCart carrying a queryID
- `purchased` (integer, required) — of those, shoppers with a search-attributed order
- `revenue` (double, required) — the search-attributed revenue of the purchased shoppers

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDirect

lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsAssisted

lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsFunnel

shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it

- `visitors` (integer, required) — shoppers seen: a tracked search, or a click, view or add to cart
- `searched` (integer, required) — shoppers with a tracked search (tracked_visitors)
- `clicked` (integer, required) — of those, shoppers who clicked a search result
- `added_to_cart` (integer, required) — of those, shoppers with an addToCart carrying a queryID
- `purchased` (integer, required) — of those, shoppers with a search-attributed order
- `revenue` (double, required) — the search-attributed revenue of the purchased shoppers

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItems

- `date` (string, required)
- `revenue` (double, required) — search-attributed revenue: direct.revenue + assisted.revenue
- `orders` (integer, required) — search-attributed orders: direct.orders + assisted.orders
- `aov` (double, required, nullable) — revenue / orders; null with no orders
- `tracked_visitors` (integer, required) — distinct user tokens with a tracked search
- `revenue_per_visitor` (double, required, nullable) — revenue / tracked_visitors, four decimals; null with no visitors
- `direct` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItemsDirect, required) — lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here
- `assisted` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItemsAssisted, required) — lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line
- `add_to_cart_count` (integer, required) — addToCart conversions that carry a queryID
- `funnel` (V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItemsFunnel, required) — shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItemsDirect

lines that carry a queryID (the event's, or their objectData queryID); an order with any such line counts here

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItemsAssisted

lines without a queryID whose objectID the same userToken clicked after a search in the 24 hours before the purchase; an order counts here when it has no direct line

- `revenue` (double, required) — in the report's currency, two decimals
- `orders` (integer, required)

### V1IndexesIndexAnalyticsRevenueGetResponsesContentApplicationJsonSchemaOneOf0ArmsItemsDatesItemsFunnel

shoppers (distinct userTokens) at each step, for a funnel or Sankey. Every step after visitors counts shoppers who searched in the period (the day, or the whole window) and then did it

- `visitors` (integer, required) — shoppers seen: a tracked search, or a click, view or add to cart
- `searched` (integer, required) — shoppers with a tracked search (tracked_visitors)
- `clicked` (integer, required) — of those, shoppers who clicked a search result
- `added_to_cart` (integer, required) — of those, shoppers with an addToCart carrying a queryID
- `purchased` (integer, required) — of those, shoppers with a search-attributed order
- `revenue` (double, required) — the search-attributed revenue of the purchased shoppers

## Examples

**Response**

```json
{
  "start_date": "2026-09-28",
  "end_date": "2026-09-28",
  "indexes": [
    "products"
  ],
  "arm": null,
  "currency": "USD",
  "revenue": 4182.5,
  "orders": 31,
  "aov": 134.92,
  "tracked_visitors": 1240,
  "revenue_per_visitor": 3.373,
  "direct": {
    "revenue": 3611,
    "orders": 26
  },
  "assisted": {
    "revenue": 571.5,
    "orders": 5
  },
  "add_to_cart_count": 58,
  "funnel": {
    "visitors": 1388,
    "searched": 1240,
    "clicked": 512,
    "added_to_cart": 49,
    "purchased": 31,
    "revenue": 4182.5
  },
  "dates": [
    {
      "date": "2026-09-28",
      "revenue": 4182.5,
      "orders": 31,
      "aov": 134.92,
      "tracked_visitors": 1240,
      "revenue_per_visitor": 3.373,
      "direct": {
        "revenue": 3611,
        "orders": 26
      },
      "assisted": {
        "revenue": 571.5,
        "orders": 5
      },
      "add_to_cart_count": 58,
      "funnel": {
        "visitors": 1388,
        "searched": 1240,
        "clicked": 512,
        "added_to_cart": 49,
        "purchased": 31,
        "revenue": 4182.5
      }
    }
  ],
  "arms": [
    {
      "index": "products",
      "revenue": 4182.5,
      "orders": 31,
      "aov": 134.92,
      "tracked_visitors": 1240,
      "revenue_per_visitor": 3.373,
      "direct": {
        "revenue": 3611,
        "orders": 26
      },
      "assisted": {
        "revenue": 571.5,
        "orders": 5
      },
      "add_to_cart_count": 58,
      "funnel": {
        "visitors": 1388,
        "searched": 1240,
        "clicked": 512,
        "added_to_cart": 49,
        "purchased": 31,
        "revenue": 4182.5
      },
      "dates": [
        {
          "date": "2026-09-28",
          "revenue": 4182.5,
          "orders": 31,
          "aov": 134.92,
          "tracked_visitors": 1240,
          "revenue_per_visitor": 3.373,
          "direct": {
            "revenue": 3611,
            "orders": 26
          },
          "assisted": {
            "revenue": 571.5,
            "orders": 5
          },
          "add_to_cart_count": 58,
          "funnel": {
            "visitors": 1388,
            "searched": 1240,
            "clicked": 512,
            "added_to_cart": 49,
            "purchased": 31,
            "revenue": 4182.5
          }
        }
      ]
    }
  ],
  "all_purchases": {
    "revenue": 9870,
    "orders": 74
  },
  "other_currency_orders": 0,
  "orders_without_value": 0,
  "partial": false
}
```

**SDK Code**

```python Python REST
import json
import requests

BASE_URL = "https://acme.captain.dev"
API_KEY = "your_search_key"
INDEX = "products"

headers = {
    "Authorization": f"Bearer {API_KEY}",
}

response = requests.get(
    f"{BASE_URL}/v1/indexes/{INDEX}/analytics/revenue",
    headers=headers,
    params={"start_date": "2026-09-28", "end_date": "2026-09-28"},
    timeout=30.0,
)

print(json.dumps(response.json(), indent=2))
```

```typescript TypeScript REST
const BASE_URL = "https://acme.captain.dev";
const API_KEY = "your_search_key";
const index = "products";

const params = new URLSearchParams({ start_date: "2026-09-28", end_date: "2026-09-28" });

const response = await fetch(`${BASE_URL}/v1/indexes/${index}/analytics/revenue?${params}`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
  },
});

const result = await response.json();
console.log(JSON.stringify(result, null, 2));
```