Guide
Reports and benchmarks
Figures over many entities at once with POST /v1/stats, one entity placed against the rest, and saved reports that say what moved on every release.
POST /v1/stats gives figures over many entities at once: how many care homes in each region hold each rating, what share of them have no registered manager, how one home compares with the rest of its local authority. The answer is totals and percentages only, as JSON. It never lists entities, addresses or people.
A subject and a series are charged: see what is charged. A query you want to follow can be saved as a report: it runs again on every release and says what moved.
The two halves
A query has two halves.
- Which entities.
conditions, as a search takes them: the same fields, operators andvia, fromGET /v1/cataloguefor the same layers.levelsays whether you are measuring premises or organisations; left out, both. Ascopenarrows further, to an area, an entity's relations, a saved search or your holdings. Unlike a search, no condition is needed: with none, every entity in the layers in scope is measured. - What to measure. Up to 20
measures, each acount, adistribution, ashareor asummary, broken down by up to 2groupBygroupings.
Only layers and measures are required. Everything else has a default: no conditions, no scope, no groupings, groups sorted largest first, at most 100 of them. The search guide explains conditions, operators and via.
Scope
A scope says where to measure, on top of the conditions. Send at most one.
| Scope | Example | What it measures |
|---|---|---|
area |
{ "area": { "region": "West Midlands" } } |
One area: a region, localAuthority or country by name, a ward or an icb as below. |
near |
{ "near": { "entityId": "prm_...", "area": "localAuthority" } } |
The entity's own local authority (the default) or other area. Pair it with subject. |
related |
{ "related": { "entityId": "prm_..." } } |
The entity's relations: who owns and runs it, what they run, its corporate group. |
savedSearch |
{ "savedSearch": "ss_..." } |
One of this consumer's saved searches, as its results match the conditions now. |
holdings |
{ "holdings": true } |
The entities this consumer holds. |
related takes depth (1 to 4, 2 by default: far enough to reach the other premises an operator runs and its parent company), possible (include possible matches too; false by default) and self (count the entity itself; true by default). It measures at most 1,000 entities. A scope that names entities (related, savedSearch, holdings) carries data.scoped: its kind, how many entities it named before the conditions, and truncated when there were more than 1,000.
Areas are the same for every layer's entities, placed by postcode: England's regions, with Wales and Scotland as wholes, local authorities, wards and integrated care boards. Northern Ireland postcodes are never placed. Ward names repeat across the country, so a ward scope is its ONS code ("E05009999") or its name with its local authority ({ "name": "Hollyfield", "localAuthority": "Dudley" }); a bare ward name is refused with STATS_INVALID. An icb scope is its ONS code or its name.
Groupings
groupBy takes up to 2 groupings. Each is one of:
- An area:
region,localAuthority,ward,icb(an integrated care board, in England) orcountry. A ward's and a board's key is its ONS code, with its name inlabels. operator: for premises, the organisation that runs each. The key is the operator's entity id, with its name inlabels. Sendlevel: "premises"with it.- A catalogue field holding a choice, a yes or no, a list or text, such as
cqc.ratingorcqc.serviceType. A number or a date is measured, never grouped.
An entity with no value is grouped under null. An entity with two values of a list counts under each. Each group carries its key, its count and one result per measure, in the order you asked. Two groupings make a group for every pair: region and rating together give each region's homes at each rating.
Measures
Each measure is exactly one of four kinds. Add label to any of them to name it in the answer.
| Measure | Example | What comes back |
|---|---|---|
count |
{ "count": true } |
How many entities are in the group. Takes no field. |
distribution |
{ "field": "epc.band", "distribution": true } |
Each option's count and its percent of the entities with a value. |
share |
{ "field": "epc.band", "share": { "in": ["E", "F", "G"] } } |
How many meet one test, as a count and a percent of the entities with a value. |
summary |
{ "field": "cqc.beds", "summary": ["mean", "median"] } |
The figures asked for. |
A distribution is for a choice, a yes or no, a list or text. Its options come in the catalogue's order where the field has one (EPC bands A+ to G, the CQC ratings best first), else by count. With a list, an entity with two values counts under each, so the percentages can add up to more than 100. A distribution lists at most its 50 most common options; the rest are added together in otherOptions, as how many options are not listed and their count.
A share takes exactly one test: in, the value is one of these (EPC E or worse is { "in": ["E", "F", "G"] }); equals, the value is this one, such as true for a yes or no; exists, where true is met by having a value at all and false by having none. cqc.managerAbsent with { "exists": true } is the manager vacancy rate: the share of locations with a date the registered manager post fell vacant.
A summary takes any of mean, median, p25, p75, min, max and sum, for a number such as cqc.beds or epc.floorArea. For a date it measures days since the date: cqc.lastInspected gives the time since the last inspection.
data.legend describes each measure for a table or a chart: its kind, field, label, a share's test in words ("in E, F, G") and a distribution's full list of options.
Coverage: with and without a value
Every measure says how many of the group have a value for its field. withValue is how many have one, and withoutValue how many do not; a share's and a distribution's percentages are of those with a value. This matters when layers meet. Measure the EPC band of CQC care homes and only the homes with an energy certificate have a value: a share of 25 percent of 40 homes with a value, in a group of 200, is a statement about 40 homes. Show withValue beside every percentage, so a figure is never read as covering more than it does.
Small groups
A group under 5 entities shows its count and nothing else. It comes back in data.withheld, largest first, with its key and count, and its measures are left out. The same applies to the whole: when fewer than 5 entities are found, data.overall.withheld is true and overall.measures is left out. GET /v1/baselines/{baselineKey} and POST /v1/positions keep the same rule: a cohort under 5 gives its count and no figures, and a position against it is unknown.
data.totalGroups counts every group, the withheld among them. If you meet many withheld groups, group more coarsely (a region rather than a local authority) or loosen the conditions. People are never counted, grouped or measured.
Benchmarks: one entity against the rest
Send subject with an entity id and every measure places that entity against every group, and against the whole. Each result then carries subject: its value, the entity's own (for a distribution its option, or its values for a list; for a summary its number, or days since a date; for a share whether it meets the test); its position, where above means better than most of the group, below worse, inline much the same, and unknown where it cannot be placed; and its delta, how far it is from the group. position says which side is the better one.
A position is unknown where the entity has no value, the field has no order, or the group is under 5. A count carries no subject. An option outside the field's order (the CQC's Insufficient evidence to rate) places the entity as unknown. data.subject says which entity was placed (an id merged away comes back as the one it became) and found: whether it is among the entities measured. It need not be: you can place a home against a region it is not in. A subject costs one POST /v1/positions a query.
{
"withValue": 75,
"withoutValue": 3,
"options": [
{ "option": "Outstanding", "count": 4, "percent": 5.33 },
{ "option": "Good", "count": 51, "percent": 68 },
{ "option": "Requires Improvement", "count": 17, "percent": 22.67 },
{ "option": "Inadequate", "count": 3, "percent": 4 }
],
"subject": { "value": "Requires Improvement", "position": "below", "delta": -69.33 }
}Trends: series
Send series: true and each measure also carries series: its figures on earlier days, oldest first, each a point with its date (at), withValue and the figures. A series is available for a measure of a field with a benchmark (one GET /v1/baselines serves), with no conditions, everywhere or in one region or local authority, grouped by nothing or by one of the field's cohorts (region, localAuthority, or the field's own, such as cqc.serviceType). legend[].series says which measures carry one, and data.seriesNote why the others do not. A day on which a group was under 5 gives no point.
For any other query, save it as a report: it runs again on every release and says what moved, but keeps only its latest figures, so to draw a line, keep each release's figures yourself. A series is charged as one GET /v1/baselines per measure that carries one.
Figures on a past day
Send asAt with a day and the figures are as the entities stood then: each fact takes the value it had that day, and an entity that had none then has none, while the entities themselves, their areas and their register statuses are as they are now. A day before an entity's history begins finds it with no facts, so withValue says how much of the group the day covers. data.asAt echoes the day; without asAt it is the day the release went live. An asAt after the release's day is refused with STATS_INVALID. The entities guide explains what history is kept.
Baselines and positions: the two direct calls
A benchmark is a fact the layers measure across cohorts on every release: the CQC's rating and beds, the EPC rating, the gender pay gap figures. The catalogue marks such a field with benchmark, giving its kind (distribution for a choice, mean for a number, share for a yes or no) and by, the cohorts it offers. A cohort is all (the whole layer), region:<name>, localAuthority:<name>, or another fact of the layer with a value, such as cqc.serviceType:Care home service with nursing.
GET /v1/baselines/{baselineKey}?cohort=is the cohort's figures as a daily series, oldest first: for a distribution the percent and count on each option, for a mean the mean, median, quartiles, extremes and standard deviation, for a share the percent.fromandtonarrow the days. The key is the field's catalogue key.POST /v1/positionsplaces one entity against a cohort on one key:above,beloworinline, with the entity's ownvalue, itsdeltafrom the cohort, the cohort'scountandmetrics, and itstrajectoryover the last year.
A series and a subject in a stats query are these two calls inside a report: use the direct calls when you want one cohort's line or one entity's standing without the rest of a query.
GET /v1/baselines/cqc.rating?cohort=region:South%20East&from=2026-10-01{
"data": {
"baselineKey": "cqc.rating",
"cohort": "region:South East",
"kind": "distribution",
"series": [
{
"at": "2026-10-29",
"count": 998,
"metrics": { "pct.Good": 71.2, "pct.Requires Improvement": 19.6, "count.Good": 711 }
}
]
},
"charged": 20
}{
"entityId": "prm_pdFPkhx7RuGEeFl8Q1pP",
"baselineKey": "cqc.rating",
"cohort": "localAuthority:Quexley"
}What is charged
Every run of a query is charged, at the consumer's plan and before any work: the run itself, once a query; a subject, once a query, however many measures or groups; and a series, for each measure that carries one. What each costs is on the pricing page. All are charged even when the answer is unknown or empty. charged on the answer says what it took. With too few tokens the whole query is refused with 402 TOKENS_EXHAUSTED, before any work, saying what it would have cost.
Saving a report is charged as a run, with its subject and series; reading a saved report with GET /v1/reports/{reportId} is charged as a run too. The runs Atlas makes on each release are not charged.
Sort and limit
sort.by orders the groups: count, by size, largest first (the default); key, by the group keys, A to Z; or measure, by a measure named by its place in measures from 0, as { "sort": { "by": "measure", "measure": 2, "desc": true } }. A count sorts by the count, a share by its percentage, a summary by its first figure, a distribution by the percentage of the option you name. desc turns the order round.
limit caps the groups that come back: 100 when left out, at most 500. data.moreGroups is true when there were more groups of 5 or more than limit.
What every answer carries
The licences' duties travel inside the JSON, as with every answer:
attributions: the attribution line of every layer in scope, to show wherever the figures are shown. An answer that used the areas also carries the ONS Postcode Directory's.notices: what a licence asks be said with the figures, such as "Not endorsed by the Care Quality Commission."currency: for the layers whose licence asks that their facts say how current they are (the FSA and the Care Inspectorate), the date their facts are as at.data.asAtanddata.release: the day the figures are as at (theasAtsent, else the day the release went live), and the release they come from.
The licences guide explains each duty. The licences also keep some fields out of stats, and a query that names one is refused with LICENCE_REFUSED: an enrichment-only layer's field (the ICO's) is never a condition, a grouping or a measure; nothing is grouped or measured by a name, an address or a postcode; and a field about a person is never a grouping or a measure. The holdings and people guide explains where people are served.
Limits and errors
One query takes 2 groupings, 20 measures and 20 conditions, makes at most 500 groups and runs for at most 10 seconds. Past any of these it is refused with the reason, never cut short.
| Code | Status | When |
|---|---|---|
STATS_INVALID |
400 | A grouping or measure the catalogue does not take: an unknown field, or a measure its type does not take (a summary of a choice, a grouping by a number). |
LICENCE_REFUSED |
400 | A field its licence keeps out of stats. |
SCOPE_UNAVAILABLE |
400 | A scope that cannot be taken here, such as a saved search kept in a report. |
CONDITIONS_INVALID, VIA_NOT_CONNECTED |
400 | A condition the catalogue refuses, as in a search. |
NOT_FOUND |
404 | A subject, near or related entity that is not in the layers in scope. |
SAVED_SEARCH_NOT_FOUND |
404 | A savedSearch that is not this consumer's, or has expired. |
TOO_MANY_GROUPS |
422 | The groupings would make more than 500 groups: group more coarsely, or narrow. |
STATS_TIMEOUT |
422 | The query ran past 10 seconds: narrow it, or ask for fewer measures. |
STATS_TOO_LARGE |
422 | The query is too large: narrow it, or ask for fewer measures. |
TOKENS_EXHAUSTED |
402 | Too few tokens for a subject or a series: the whole query is refused before any work. |
NO_AREA |
422 | A near entity with no value for the area asked for. |
GEOGRAPHY_UNAVAILABLE |
503 | Entities are not placed in this area for now: use region or localAuthority. |
Every call can also meet the codes every operation gives, such as LAYER_NOT_SUBSCRIBED and RATE_LIMITED. The errors guide lists them all.
Example: struggling nursing homes by region
Nursing homes rated Requires Improvement or Inadequate, by region: how many, how many lack a registered manager, and how large they are. The figures are illustrative, and the response is cut to its first region, without attributions and notices.
{
"level": "premises",
"layers": ["cqc"],
"conditions": [
{ "field": "cqc.serviceType", "operator": "contains", "value": "Nursing homes" },
{ "field": "cqc.rating", "operator": "in", "value": ["Requires Improvement", "Inadequate"] }
],
"groupBy": ["region"],
"measures": [
{ "count": true },
{ "field": "cqc.managerAbsent", "share": { "exists": true }, "label": "Manager vacancy" },
{ "field": "cqc.beds", "summary": ["mean", "median"] }
],
"sort": { "by": "count" },
"limit": 50
}{
"data": {
"total": 1000,
"overall": {
"withheld": false,
"measures": [
{ "withValue": 1000, "withoutValue": 0, "count": 1000 },
{ "withValue": 1000, "withoutValue": 0, "share": { "count": 150, "percent": 15 } },
{ "withValue": 1000, "withoutValue": 0, "summary": { "mean": 50, "median": 46 } }
]
},
"legend": [
{ "kind": "count", "field": null, "label": "Count" },
{
"kind": "share",
"field": "cqc.managerAbsent",
"label": "Manager vacancy",
"test": "has a value"
},
{ "kind": "summary", "field": "cqc.beds", "label": "Beds" }
],
"groups": [
{
"key": { "region": "North West" },
"count": 200,
"measures": [
{ "withValue": 200, "withoutValue": 0, "count": 200 },
{ "withValue": 200, "withoutValue": 0, "share": { "count": 30, "percent": 15 } },
{ "withValue": 200, "withoutValue": 0, "summary": { "mean": 48, "median": 45 } }
]
}
],
"withheld": [],
"totalGroups": 11,
"moreGroups": false,
"asAt": "2026-10-30",
"release": { "id": "b2026103004001a7f3e", "at": "2026-10-30T06:12:08.000Z" }
},
"currency": []
}Saved reports
POST /v1/reports keeps a stats query. It takes the same fields as POST /v1/stats, with a label to find it again and an alert: how far a figure must move between two runs to count as a move. alert.count: a count that moves by at least this many is a move (1 when left out). alert.points: a percentage (a share's, an option's) that moves by at least this many points is a move, and so is a summary figure that moves by at least this many percent (5 when left out).
The report runs at once, so a query that would be refused is refused now, with the same rules and limits. It then runs again on every release, and each run is compared with the one before. A group that reaches 5 or falls under it is always a move. Saving a report is charged as a query is; the runs Atlas makes on each release are not.
A report cannot keep a savedSearch scope (a saved search expires after 90 days): save the conditions instead. holdings and related can be kept. A consumer keeps at most 50 reports (TOO_MANY_REPORTS, 422), and each keeps its last 60 runs. A report whose answer could be too large to keep is refused before any work with REPORT_TOO_LARGE (422): ask for a lower limit, fewer distributions or no series. A report is read only while its layers are subscribed. Only the query, its label and the figures are kept: no entity's details, no address, no person.
{
"label": "Care homes in Kent",
"alert": { "count": 3, "points": 5 },
"level": "premises",
"layers": ["cqc"],
"conditions": [{ "field": "cqc.careHome", "operator": "equals", "value": "Y" }],
"scope": { "area": { "localAuthority": "Kent" } },
"groupBy": ["cqc.rating"],
"measures": [{ "count": true }]
}Reading what moved
GET /v1/reportslists this consumer's reports, the most recently moved first, a page at a time.moved=truelists only those whose latest run moved: the ones to show your users. A move also reaches your feed and webhook as areport.movedevent: see the alerts guide.GET /v1/reports/{reportId}gives the report: its query as saved, itsalert, itslatestanswer (asPOST /v1/statsgives one) and itsruns, newest first.DELETE /v1/reports/{reportId}deletes it and its runs.
Each run names its release and its total, and lists its moves, the largest first, at most 200. A move names the group (key, null for the whole), the measure (its place in measures, or -1 for the group's own size), what moved (count, share, option, summary, appeared for a group that reached 5, withheld for one that fell under it), its unit and the values from and to. A run that could not give figures (a limit passed, a field gone from the layers) says why in error. A report that is not this consumer's, or was deleted, gives REPORT_NOT_FOUND (404).
{
"release": { "id": "b2026103004001a7f3e", "at": "2026-10-30T06:12:08.000Z" },
"ranAt": "2026-10-30T06:13:02.000Z",
"total": 195,
"moved": true,
"moves": [
{ "key": null, "measure": -1, "what": "count", "unit": "count", "from": 192, "to": 195 }
]
}