---
title: "POST /indices/cardinality"
method: POST
path: "/indices/cardinality"
---

# POST /indices/cardinality

`POST /indices/cardinality`

Returns the approximate count of unique values that match the query.

Requires permission to access the [GetCardinality](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions) action.

## Request body

- object
  - `indexName` string — The name of the index to search.
  - `queryString` string, required — The search query string.
  - `aggregationField` string — The field to aggregate.
  - `queryVersion` string — The query version.

## Response `200`

Success

- GetCardinalityResponse
  - `cardinality` integer — The approximate count of unique values that match the query.

## Other responses

- `480` — InvalidRequestException
- `481` — ThrottlingException
- `482` — UnauthorizedException
- `483` — ServiceUnavailableException
- `484` — InternalFailureException
- `485` — ResourceNotFoundException
- `486` — InvalidQueryException
- `487` — InvalidAggregationException
- `488` — IndexNotReadyException

---

[API](https://skmtc.net/aws/apis/iot.md) · [All operations](https://skmtc.net/aws/apis/iot/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/iot/revisions/deef5c4b09f0/schema)
