> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
