> For the complete documentation index, see [llms.txt](https://docs.jetadmin.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jetadmin.io/api-reference/records/aggregate-records.md).

# Aggregate records

POST <https://data.jetadmin.io/projects/\\{{project\\_id\\}}/prod/\\{{resource\\_name\\}}/models/\\{{model\\_id\\}}/aggregate>

Replace the double-brace placeholders with your identifiers. The interactive endpoint below uses standard OpenAPI path parameters.

Record fields, required values, filters, and operation support depend on the selected model. Use the generated API for your resource to check its exact schema.

## Aggregate records

> Applies an aggregation function to filtered record data.

```json
{"openapi":"3.1.0","info":{"title":"Jet Admin Records API","version":"1.0.0"},"tags":[{"name":"Record analytics","description":"Aggregate and group records where supported."}],"servers":[{"url":"https://data.jetadmin.io","description":"JetAdmin Data API"}],"security":[{"ApiToken":[]}],"components":{"securitySchemes":{"ApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Static API token for the selected resource, passed directly in the Authorization header. Use the token and auth format shown by the resource API."}},"schemas":{"AggregateRequest":{"type":"object","additionalProperties":false,"required":["func"],"properties":{"func":{"$ref":"#/components/schemas/AggregateFunction"},"field":{"type":"string","description":"Required when `func` is `Sum`, `Min`, `Max`, or `Avg`."},"filters":{"$ref":"#/components/schemas/RecordFilters"}}},"AggregateFunction":{"type":"string","enum":["Count","Sum","Min","Max","Avg"]},"RecordFilters":{"type":"object","additionalProperties":true,"description":"Filters supported by the selected model. Field names and value types vary by resource."},"AggregateResponse":{"type":"object","required":["value"],"properties":{"value":{"description":"Aggregated value. The API may serialize numeric values as strings.","oneOf":[{"type":"number"},{"type":"string"},{"type":"null"}]}}},"Error":{"type":"object","additionalProperties":true,"description":"JetAdmin error response. The exact fields depend on the validation failure."}},"responses":{"BadRequest":{"description":"Invalid request parameters or body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing or invalid API token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/projects/{project_id}/prod/{resource_name}/models/{model_id}/aggregate":{"post":{"tags":["Record analytics"],"operationId":"aggregateRecords","summary":"Aggregate records","description":"Applies an aggregation function to filtered record data.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AggregateRequest"}}}},"responses":{"200":{"description":"Aggregated value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AggregateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.jetadmin.io/api-reference/records/aggregate-records.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
