---
title: "Query Segment Values"
description: "How to call Query Segment Values (POST /api/segment-values-reports) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/reference/query_segment_values"
revision: "2026-10-15"
operationId: "query_segment_values"
aliases: ["create_segment_value_report","create_segment_values_report"]
method: "POST"
endpoint: "https://a.klaviyo.com/api/segment-values-reports"
authentication: "privateKey"
scopes: ["segments:read"]
rateLimits: {"burst":"1/s","steady":"2/m","daily":"225/d"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
openApi: "https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/query_segment_values.json"
jsonApi: {"fields":{"segment-values-report":["id","results"]}}
related: ["https://developers.klaviyo.com/en/reference/reporting/llms.txt","https://developers.klaviyo.com/en/reference/query_campaign_values.md","https://developers.klaviyo.com/en/reference/query_flow_values.md","https://developers.klaviyo.com/en/reference/query_flow_series.md","https://developers.klaviyo.com/en/reference/query_form_values.md","https://developers.klaviyo.com/en/reference/query_form_series.md","https://developers.klaviyo.com/en/reference/query_segment_series.md"]
---

# Query Segment Values

> This is the Markdown version of https://developers.klaviyo.com/en/reference/query_segment_values

```http
POST https://a.klaviyo.com/api/segment-values-reports
```

Returns the requested segment analytics values data.

- Revision header: `revision: 2026-10-15` (required)
- Scopes: `segments:read`
- Rate limits: Burst: `1/s`, Steady: `2/m`, Daily: `225/d`
- OpenAPI: [Download this endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/query_segment_values.json)

## Example request

### curl

```bash
curl --request POST \
     --url 'https://a.klaviyo.com/api/segment-values-reports' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-10-15' \
     --header 'content-type: application/vnd.api+json' \
     --data '{
  "data": {
    "type": "segment-values-report",
    "attributes": {
      "statistics": [
        "total_members",
        "net_members_changed"
      ],
      "timeframe": {
        "key": "last_12_months"
      },
      "filter": "any(segment_id,[\"xyz123\",\"ghi456\"])"
    }
  }
}'
```

### CLI

```bash
klaviyo reporting query-segment-values \
  -d '{
  "data": {
    "type": "segment-values-report",
    "attributes": {
      "statistics": [
        "total_members",
        "net_members_changed"
      ],
      "timeframe": {
        "key": "last_12_months"
      },
      "filter": "any(segment_id,[\"xyz123\",\"ghi456\"])"
    }
  }
}'
```

Sign in first with `klaviyo auth login`. [Install the Klaviyo CLI](https://developers.klaviyo.com/en/docs/klaviyo_cli.md)

### Python

```python
from klaviyo_api import KlaviyoAPI

klaviyo = KlaviyoAPI("your-private-api-key")

response = klaviyo.Reporting.query_segment_values(
    {
        "data": {
            "type": "segment-values-report",
            "attributes": {
                "statistics": [
                    "total_members",
                    "net_members_changed",
                ],
                "timeframe": {
                    "key": "last_12_months",
                },
                "filter": "any(segment_id,[\"xyz123\",\"ghi456\"])",
            },
        },
    },
)
```

Install it with `pip install klaviyo-api`. [The Python SDK on GitHub](https://github.com/klaviyo/klaviyo-api-python)

### Node.js

```javascript
import { ApiKeySession, ReportingApi } from 'klaviyo-api'

const session = new ApiKeySession('your-private-api-key')
const reportingApi = new ReportingApi(session)

const response = await reportingApi.querySegmentValues(
  {
    data: {
      type: 'segment-values-report',
      attributes: {
        statistics: [
          'total_members',
          'net_members_changed',
        ],
        timeframe: {
          key: 'last_12_months',
        },
        filter: 'any(segment_id,["xyz123","ghi456"])',
      },
    },
  },
)
```

Install it with `npm install klaviyo-api`. [The Node.js SDK on GitHub](https://github.com/klaviyo/klaviyo-api-node)

### Ruby

```ruby
require 'klaviyo-api-sdk'

KlaviyoAPI.configure do |config|
  config.api_key['Klaviyo-API-Key'] = 'Klaviyo-API-Key your-private-api-key'
end

response = KlaviyoAPI::Reporting.query_segment_values(
  {
    data: {
      type: 'segment-values-report',
      attributes: {
        statistics: [
          'total_members',
          'net_members_changed',
        ],
        timeframe: {
          key: 'last_12_months',
        },
        filter: 'any(segment_id,["xyz123","ghi456"])',
      },
    },
  },
)
```

Install it with `gem install klaviyo-api-sdk`. [The Ruby SDK on GitHub](https://github.com/klaviyo/klaviyo-api-ruby)

### PHP

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

use KlaviyoAPI\KlaviyoAPI;

$klaviyo = new KlaviyoAPI('your-private-api-key');

$response = $klaviyo->Reporting->querySegmentValues(
    [
        'data' => [
            'type' => 'segment-values-report',
            'attributes' => [
                'statistics' => [
                    'total_members',
                    'net_members_changed',
                ],
                'timeframe' => [
                    'key' => 'last_12_months',
                ],
                'filter' => 'any(segment_id,["xyz123","ghi456"])',
            ],
        ],
    ],
);
```

Install it with `composer require klaviyo/api`. [The PHP SDK on GitHub](https://github.com/klaviyo/klaviyo-api-php)

## Query parameters

- `fields[segment-values-report]` (string[]): For more information please visit [API overview](https://developers.klaviyo.com/en/reference.md) Allowed values: `id`, `results`

## Headers

- `revision` (string, required): API endpoint revision (format: YYYY-MM-DD[.suffix]) Default: `2026-10-15`

## Request body

Content type: `application/vnd.api+json` (required)

- `data` (object, required)
  - `type` (string, required): Allowed values: `segment-values-report`
  - `attributes` (object, required)
    - `statistics` (string[], required): List of statistics to query for. Allowed values: `members_added`, `members_removed`, `net_members_changed`, `total_members`
    - `timeframe` (oneOf, required): The time frame to pull data from (Max length: 1 year). Data is unavailable before June 1st, 2023. Please use a time frame after this date. See [available time frames](https://developers.klaviyo.com/en/reference/reporting.md).
      - One of:
        - Option 1: `Timeframe` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/query_segment_values.json).
        - Option 2: `CustomTimeframe` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15/openapi/stable/apis/query_segment_values.json).
    - `filter` (string, nullable): API filter string used to filter the query.
      Allowed filters are segment_id.
      Allowed operators are equals, any.
      Only one filter can be used per attribute.
      Max of 100 messages per ANY filter. Example: `any(segment_id,["xyz123","ghi456"])`

### Example request body

```json
{
  "data": {
    "type": "segment-values-report",
    "attributes": {
      "statistics": [
        "total_members",
        "net_members_changed"
      ],
      "timeframe": {
        "key": "last_12_months"
      },
      "filter": "any(segment_id,[\"xyz123\",\"ghi456\"])"
    }
  }
}
```

## Responses

### 200: Success

Content type: `application/vnd.api+json`

- `data` (object, required)
  - `type` (string, required): Allowed values: `segment-values-report`
  - `attributes` (object, required)
    - `results` (object[], required): An array of all the returned values data.
      Each object in the array represents one unique grouping and the results for that grouping.
      - `groupings` (object, required): Applied groupings and the values for this object
      - `statistics` (object, required): Requested statistics and their values results
- `links` (object)
  - `self` (string<uri>, required)
- `meta` (object): Response-level metadata
  - `agent_hints` (object): Optional hints emitted by the API for agent callers
    - `next_steps` (string[]): Suggested follow-up actions for agents to take after this response

#### Example response body

```json
{
  "data": {
    "type": "segment-values-report",
    "attributes": {
      "results": [
        {
          "groupings": {
            "segment_id": "abc123"
          },
          "statistics": {
            "total_members": 120,
            "net_members_changed": 53
          }
        },
        {
          "groupings": {
            "segment_id": "def123"
          },
          "statistics": {
            "total_members": 250,
            "net_members_changed": 113
          }
        }
      ]
    }
  },
  "links": {
    "self": "https://www.example.com"
  },
  "meta": {
    "agent_hints": {
      "next_steps": [
        "string"
      ]
    }
  }
}
```

### 4XX: Client Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```

### 5XX: Server Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```
