{
  "openapi": "3.1.0",
  "info": {
    "title": "Corrective services, Report on Government Services query API",
    "version": "2026-01-27",
    "summary": "Filter, page and aggregate Corrective services, Report on Government Services from Productivity Commission.",
    "description": "The query API returns only the rows you ask for, as JSON, NDJSON or CSV, from the same typed rows as the files. It needs no key. The API allows 60 requests in 10 seconds from one address. Above that it answers 429 for 10 seconds with a `Retry-After` header, a `RateLimit-Policy` header and a JSON body that gives the limit. Every API answer carries the same `RateLimit-Policy`. A client should wait the `Retry-After` seconds, or read the files, which have no limit. Every JSON answer carries the version, licence and attribution. CSV and NDJSON answers carry them in response headers. Productivity Commission has not endorsed this site. The whole site is described in https://publicdata.au/openapi.json.",
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://publicdata.au"
    }
  ],
  "externalDocs": {
    "url": "https://publicdata.au/d/rogs-corrective-services/#query"
  },
  "tags": [
    {
      "name": "query"
    }
  ],
  "paths": {
    "/api/v1/datasets/rogs-corrective-services/rows": {
      "get": {
        "tags": [
          "query"
        ],
        "summary": "Query Corrective services, Report on Government Services",
        "operationId": "queryRows_rogs_corrective_services",
        "description": "Rows of Corrective services, Report on Government Services in the newest loaded version, filtered and paged. Each filter is `field=operator.value` in the query string, and every filter must match. A number or date field compares as a number or date, and a text field compares as text. Values are case-sensitive except with `ilike`. Prefix `not.` to negate a filter, as `not.eq.value`. Operators: `eq.value`, `neq.value`, `gt.value`, `gte.value`, `lt.value`, `lte.value`, `like.*text*`, `ilike.*text*`, `in.(a,b,c)`, `is.null`.",
        "parameters": [
          {
            "name": "table_number",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.8A.9"
            ]
          },
          {
            "name": "year",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2015-16, 2016-17, 2017-18, 2018-19, 2019-20, 2020-21, 2021-22, 2022-23, 2023-24, 2024-25.",
            "examples": [
              "eq.2024-25"
            ]
          },
          {
            "name": "measure",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assaults in custody, Community corrections population, Community corrections staff, Community work, Completion of community corrections orders, Correctional custodial facilities, Deaths from apparent unnatural causes, Escapes, Imprisonment and community corrections population, Prison capacity utilisation, Prisoner education and training, Prisoner employment, Prisoner population, Real net operating expenditure, Real net recurrent expenditure, Real recurrent expenditure, Time out-of-cells per day.",
            "examples": [
              "eq.Time out-of-cells per day"
            ]
          },
          {
            "name": "age",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Adults.",
            "examples": [
              "eq.Adults"
            ]
          },
          {
            "name": "sex",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All people, Females, Gender unknown, Males.",
            "examples": [
              "eq.Males"
            ]
          },
          {
            "name": "indigenous_status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Aboriginal and Torres Strait Islander people, All people, Non-Indigenous people, Ratio for Aboriginal and Torres Strait Islander people to non-Indigenous people, Unknown Indigenous status.",
            "examples": [
              "eq.Unknown Indigenous status"
            ]
          },
          {
            "name": "remoteness",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All areas.",
            "examples": [
              "eq.All areas"
            ]
          },
          {
            "name": "cs_type",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Community correction, Prison, Prisons and community corrections.",
            "examples": [
              "eq.Prisons and community corrections"
            ]
          },
          {
            "name": "year_dollars",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2024-25 dollars.",
            "examples": [
              "eq.2024-25 dollars"
            ]
          },
          {
            "name": "description1",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Total community corrections daily average population"
            ]
          },
          {
            "name": "description2",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Work release"
            ]
          },
          {
            "name": "description3",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.including periodic detainees"
            ]
          },
          {
            "name": "description4",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assault, Debt servicing fees, Depreciation, Health expenditure, Land, Open, Other assets, Payroll tax, Secure, Serious assault, Total, Total capital costs, Total net operating expenditure, Transport and escort services, User cost of capital.",
            "examples": [
              "eq.User cost of capital"
            ]
          },
          {
            "name": "description5",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Land, Other assets.",
            "examples": [
              "eq.Other assets"
            ]
          },
          {
            "name": "data_source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Derived from State and territory governments (unpublished), Derived from State and territory governments (unpublished); ABS Australian National Accounts: National Income Expenditure and Product, Derived from State and territory governments (unpublished); ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, Derived from State and territory governments (unpublished); ABS National state and territory population - December, Derived from State and territory governments (unpublished); ABS National state and territory population - December; ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, State and territory governments (unpublished).",
            "examples": [
              "eq.State and territory governments (unpublished)"
            ]
          },
          {
            "name": "unit",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: $, $'000, %, hr/day, no., rate, rate (AS), ratio, ratio (AS).",
            "examples": [
              "eq.ratio (AS)"
            ]
          },
          {
            "name": "nsw",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 2197198.0."
          },
          {
            "name": "vic",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1577112.0."
          },
          {
            "name": "qld",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1593364.0."
          },
          {
            "name": "wa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1084690.0."
          },
          {
            "name": "sa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 419644.0."
          },
          {
            "name": "tas",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 181854.0."
          },
          {
            "name": "act",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 127284.0."
          },
          {
            "name": "nt",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 320677.0."
          },
          {
            "name": "australia",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.01 to 7326455.0."
          },
          {
            "name": "select",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Fields to return, comma-separated. Every field when absent."
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`field.asc` or `field.desc`, comma-separated. The publisher's row order when absent."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 100
            },
            "description": "Rows per page, 1 to 10,000. 100 when absent."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Rows to skip. The `next` URL in each answer sets it for you."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "ndjson",
                "csv"
              ],
              "default": "json"
            },
            "description": "`json`, `ndjson` or `csv`. JSON carries the provenance header, and the others carry it in response headers."
          }
        ],
        "responses": {
          "200": {
            "description": "Rows with the version, licence and attribution. `next` is the URL of the following page, or null."
          },
          "400": {
            "description": "The query names a field the dataset does not have, or a value of the wrong type."
          },
          "404": {
            "description": "The dataset or version is not loaded for queries."
          },
          "429": {
            "description": "More than 60 requests in 10 seconds from one address. Blocked for 10 seconds. Wait `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the block lifts."
              },
              "RateLimit-Policy": {
                "schema": {
                  "type": "string"
                },
                "description": "The limit, as \"fair-use\";q=60;w=10."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "const": 429
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "window_seconds": {
                      "type": "integer"
                    },
                    "block_seconds": {
                      "type": "integer"
                    },
                    "docs": {
                      "type": "string",
                      "format": "uri"
                    },
                    "files": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/datasets/rogs-corrective-services/versions/{version}/rows": {
      "get": {
        "tags": [
          "query"
        ],
        "summary": "Query Corrective services, Report on Government Services",
        "operationId": "queryRows_rogs_corrective_services_version",
        "description": "Rows of Corrective services, Report on Government Services in one dated version, filtered and paged. Each filter is `field=operator.value` in the query string, and every filter must match. A number or date field compares as a number or date, and a text field compares as text. Values are case-sensitive except with `ilike`. Prefix `not.` to negate a filter, as `not.eq.value`. Operators: `eq.value`, `neq.value`, `gt.value`, `gte.value`, `lt.value`, `lte.value`, `like.*text*`, `ilike.*text*`, `in.(a,b,c)`, `is.null`.",
        "parameters": [
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "A dated version loaded for queries, from the versions path. Answers for a dated version never change."
          },
          {
            "name": "table_number",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.8A.9"
            ]
          },
          {
            "name": "year",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2015-16, 2016-17, 2017-18, 2018-19, 2019-20, 2020-21, 2021-22, 2022-23, 2023-24, 2024-25.",
            "examples": [
              "eq.2024-25"
            ]
          },
          {
            "name": "measure",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assaults in custody, Community corrections population, Community corrections staff, Community work, Completion of community corrections orders, Correctional custodial facilities, Deaths from apparent unnatural causes, Escapes, Imprisonment and community corrections population, Prison capacity utilisation, Prisoner education and training, Prisoner employment, Prisoner population, Real net operating expenditure, Real net recurrent expenditure, Real recurrent expenditure, Time out-of-cells per day.",
            "examples": [
              "eq.Time out-of-cells per day"
            ]
          },
          {
            "name": "age",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Adults.",
            "examples": [
              "eq.Adults"
            ]
          },
          {
            "name": "sex",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All people, Females, Gender unknown, Males.",
            "examples": [
              "eq.Males"
            ]
          },
          {
            "name": "indigenous_status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Aboriginal and Torres Strait Islander people, All people, Non-Indigenous people, Ratio for Aboriginal and Torres Strait Islander people to non-Indigenous people, Unknown Indigenous status.",
            "examples": [
              "eq.Unknown Indigenous status"
            ]
          },
          {
            "name": "remoteness",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All areas.",
            "examples": [
              "eq.All areas"
            ]
          },
          {
            "name": "cs_type",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Community correction, Prison, Prisons and community corrections.",
            "examples": [
              "eq.Prisons and community corrections"
            ]
          },
          {
            "name": "year_dollars",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2024-25 dollars.",
            "examples": [
              "eq.2024-25 dollars"
            ]
          },
          {
            "name": "description1",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Total community corrections daily average population"
            ]
          },
          {
            "name": "description2",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Work release"
            ]
          },
          {
            "name": "description3",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.including periodic detainees"
            ]
          },
          {
            "name": "description4",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assault, Debt servicing fees, Depreciation, Health expenditure, Land, Open, Other assets, Payroll tax, Secure, Serious assault, Total, Total capital costs, Total net operating expenditure, Transport and escort services, User cost of capital.",
            "examples": [
              "eq.User cost of capital"
            ]
          },
          {
            "name": "description5",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Land, Other assets.",
            "examples": [
              "eq.Other assets"
            ]
          },
          {
            "name": "data_source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Derived from State and territory governments (unpublished), Derived from State and territory governments (unpublished); ABS Australian National Accounts: National Income Expenditure and Product, Derived from State and territory governments (unpublished); ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, Derived from State and territory governments (unpublished); ABS National state and territory population - December, Derived from State and territory governments (unpublished); ABS National state and territory population - December; ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, State and territory governments (unpublished).",
            "examples": [
              "eq.State and territory governments (unpublished)"
            ]
          },
          {
            "name": "unit",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: $, $'000, %, hr/day, no., rate, rate (AS), ratio, ratio (AS).",
            "examples": [
              "eq.ratio (AS)"
            ]
          },
          {
            "name": "nsw",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 2197198.0."
          },
          {
            "name": "vic",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1577112.0."
          },
          {
            "name": "qld",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1593364.0."
          },
          {
            "name": "wa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1084690.0."
          },
          {
            "name": "sa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 419644.0."
          },
          {
            "name": "tas",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 181854.0."
          },
          {
            "name": "act",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 127284.0."
          },
          {
            "name": "nt",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 320677.0."
          },
          {
            "name": "australia",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.01 to 7326455.0."
          },
          {
            "name": "select",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Fields to return, comma-separated. Every field when absent."
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`field.asc` or `field.desc`, comma-separated. The publisher's row order when absent."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 100
            },
            "description": "Rows per page, 1 to 10,000. 100 when absent."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Rows to skip. The `next` URL in each answer sets it for you."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "ndjson",
                "csv"
              ],
              "default": "json"
            },
            "description": "`json`, `ndjson` or `csv`. JSON carries the provenance header, and the others carry it in response headers."
          }
        ],
        "responses": {
          "200": {
            "description": "Rows with the version, licence and attribution. `next` is the URL of the following page, or null."
          },
          "400": {
            "description": "The query names a field the dataset does not have, or a value of the wrong type."
          },
          "404": {
            "description": "The dataset or version is not loaded for queries."
          },
          "429": {
            "description": "More than 60 requests in 10 seconds from one address. Blocked for 10 seconds. Wait `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the block lifts."
              },
              "RateLimit-Policy": {
                "schema": {
                  "type": "string"
                },
                "description": "The limit, as \"fair-use\";q=60;w=10."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "const": 429
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "window_seconds": {
                      "type": "integer"
                    },
                    "block_seconds": {
                      "type": "integer"
                    },
                    "docs": {
                      "type": "string",
                      "format": "uri"
                    },
                    "files": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/datasets/{slug}/aggregate": {
      "get": {
        "tags": [
          "query"
        ],
        "summary": "Counts, sums, averages, minimums and maximums by group",
        "operationId": "aggregate",
        "description": "Groups and totals of any dataset in the newest loaded version. Filters work as they do on rows. Each filter is `field=operator.value` in the query string, and every filter must match. A number or date field compares as a number or date, and a text field compares as text. Values are case-sensitive except with `ilike`. Prefix `not.` to negate a filter, as `not.eq.value`. Operators: `eq.value`, `neq.value`, `gt.value`, `gte.value`, `lt.value`, `lte.value`, `like.*text*`, `ilike.*text*`, `in.(a,b,c)`, `is.null`.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "rogs-corrective-services"
              ]
            },
            "description": "The dataset's slug, as in its page URL `/d/<slug>/`."
          },
          {
            "name": "group",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "On `aggregate`, fields to group by, comma-separated."
          },
          {
            "name": "metric",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "count"
            },
            "description": "On `aggregate`, `count`, `sum.field`, `avg.field`, `min.field` or `max.field`, comma-separated. `count` when absent."
          },
          {
            "name": "table_number",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.8A.9"
            ]
          },
          {
            "name": "year",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2015-16, 2016-17, 2017-18, 2018-19, 2019-20, 2020-21, 2021-22, 2022-23, 2023-24, 2024-25.",
            "examples": [
              "eq.2024-25"
            ]
          },
          {
            "name": "measure",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assaults in custody, Community corrections population, Community corrections staff, Community work, Completion of community corrections orders, Correctional custodial facilities, Deaths from apparent unnatural causes, Escapes, Imprisonment and community corrections population, Prison capacity utilisation, Prisoner education and training, Prisoner employment, Prisoner population, Real net operating expenditure, Real net recurrent expenditure, Real recurrent expenditure, Time out-of-cells per day.",
            "examples": [
              "eq.Time out-of-cells per day"
            ]
          },
          {
            "name": "age",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Adults.",
            "examples": [
              "eq.Adults"
            ]
          },
          {
            "name": "sex",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All people, Females, Gender unknown, Males.",
            "examples": [
              "eq.Males"
            ]
          },
          {
            "name": "indigenous_status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Aboriginal and Torres Strait Islander people, All people, Non-Indigenous people, Ratio for Aboriginal and Torres Strait Islander people to non-Indigenous people, Unknown Indigenous status.",
            "examples": [
              "eq.Unknown Indigenous status"
            ]
          },
          {
            "name": "remoteness",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All areas.",
            "examples": [
              "eq.All areas"
            ]
          },
          {
            "name": "cs_type",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Community correction, Prison, Prisons and community corrections.",
            "examples": [
              "eq.Prisons and community corrections"
            ]
          },
          {
            "name": "year_dollars",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2024-25 dollars.",
            "examples": [
              "eq.2024-25 dollars"
            ]
          },
          {
            "name": "description1",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Total community corrections daily average population"
            ]
          },
          {
            "name": "description2",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Work release"
            ]
          },
          {
            "name": "description3",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.including periodic detainees"
            ]
          },
          {
            "name": "description4",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assault, Debt servicing fees, Depreciation, Health expenditure, Land, Open, Other assets, Payroll tax, Secure, Serious assault, Total, Total capital costs, Total net operating expenditure, Transport and escort services, User cost of capital.",
            "examples": [
              "eq.User cost of capital"
            ]
          },
          {
            "name": "description5",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Land, Other assets.",
            "examples": [
              "eq.Other assets"
            ]
          },
          {
            "name": "data_source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Derived from State and territory governments (unpublished), Derived from State and territory governments (unpublished); ABS Australian National Accounts: National Income Expenditure and Product, Derived from State and territory governments (unpublished); ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, Derived from State and territory governments (unpublished); ABS National state and territory population - December, Derived from State and territory governments (unpublished); ABS National state and territory population - December; ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, State and territory governments (unpublished).",
            "examples": [
              "eq.State and territory governments (unpublished)"
            ]
          },
          {
            "name": "unit",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: $, $'000, %, hr/day, no., rate, rate (AS), ratio, ratio (AS).",
            "examples": [
              "eq.ratio (AS)"
            ]
          },
          {
            "name": "nsw",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 2197198.0."
          },
          {
            "name": "vic",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1577112.0."
          },
          {
            "name": "qld",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1593364.0."
          },
          {
            "name": "wa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1084690.0."
          },
          {
            "name": "sa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 419644.0."
          },
          {
            "name": "tas",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 181854.0."
          },
          {
            "name": "act",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 127284.0."
          },
          {
            "name": "nt",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 320677.0."
          },
          {
            "name": "australia",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.01 to 7326455.0."
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`field.asc` or `field.desc`, comma-separated. The publisher's row order when absent."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 100
            },
            "description": "Rows per page, 1 to 10,000. 100 when absent."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Rows to skip. The `next` URL in each answer sets it for you."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "ndjson",
                "csv"
              ],
              "default": "json"
            },
            "description": "`json`, `ndjson` or `csv`. JSON carries the provenance header, and the others carry it in response headers."
          }
        ],
        "responses": {
          "200": {
            "description": "Rows with the version, licence and attribution. `next` is the URL of the following page, or null."
          },
          "400": {
            "description": "The query names a field the dataset does not have, or a value of the wrong type."
          },
          "404": {
            "description": "The dataset or version is not loaded for queries."
          },
          "429": {
            "description": "More than 60 requests in 10 seconds from one address. Blocked for 10 seconds. Wait `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the block lifts."
              },
              "RateLimit-Policy": {
                "schema": {
                  "type": "string"
                },
                "description": "The limit, as \"fair-use\";q=60;w=10."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "const": 429
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "window_seconds": {
                      "type": "integer"
                    },
                    "block_seconds": {
                      "type": "integer"
                    },
                    "docs": {
                      "type": "string",
                      "format": "uri"
                    },
                    "files": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/datasets/{slug}/versions/{version}/aggregate": {
      "get": {
        "tags": [
          "query"
        ],
        "summary": "Counts, sums, averages, minimums and maximums by group",
        "operationId": "aggregateVersion",
        "description": "Groups and totals of any dataset in one dated version. Filters work as they do on rows. Each filter is `field=operator.value` in the query string, and every filter must match. A number or date field compares as a number or date, and a text field compares as text. Values are case-sensitive except with `ilike`. Prefix `not.` to negate a filter, as `not.eq.value`. Operators: `eq.value`, `neq.value`, `gt.value`, `gte.value`, `lt.value`, `lte.value`, `like.*text*`, `ilike.*text*`, `in.(a,b,c)`, `is.null`.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "rogs-corrective-services"
              ]
            },
            "description": "The dataset's slug, as in its page URL `/d/<slug>/`."
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "A dated version loaded for queries, from the versions path. Answers for a dated version never change."
          },
          {
            "name": "group",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "On `aggregate`, fields to group by, comma-separated."
          },
          {
            "name": "metric",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "count"
            },
            "description": "On `aggregate`, `count`, `sum.field`, `avg.field`, `min.field` or `max.field`, comma-separated. `count` when absent."
          },
          {
            "name": "table_number",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.8A.9"
            ]
          },
          {
            "name": "year",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2015-16, 2016-17, 2017-18, 2018-19, 2019-20, 2020-21, 2021-22, 2022-23, 2023-24, 2024-25.",
            "examples": [
              "eq.2024-25"
            ]
          },
          {
            "name": "measure",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assaults in custody, Community corrections population, Community corrections staff, Community work, Completion of community corrections orders, Correctional custodial facilities, Deaths from apparent unnatural causes, Escapes, Imprisonment and community corrections population, Prison capacity utilisation, Prisoner education and training, Prisoner employment, Prisoner population, Real net operating expenditure, Real net recurrent expenditure, Real recurrent expenditure, Time out-of-cells per day.",
            "examples": [
              "eq.Time out-of-cells per day"
            ]
          },
          {
            "name": "age",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Adults.",
            "examples": [
              "eq.Adults"
            ]
          },
          {
            "name": "sex",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All people, Females, Gender unknown, Males.",
            "examples": [
              "eq.Males"
            ]
          },
          {
            "name": "indigenous_status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Aboriginal and Torres Strait Islander people, All people, Non-Indigenous people, Ratio for Aboriginal and Torres Strait Islander people to non-Indigenous people, Unknown Indigenous status.",
            "examples": [
              "eq.Unknown Indigenous status"
            ]
          },
          {
            "name": "remoteness",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: All areas.",
            "examples": [
              "eq.All areas"
            ]
          },
          {
            "name": "cs_type",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Community correction, Prison, Prisons and community corrections.",
            "examples": [
              "eq.Prisons and community corrections"
            ]
          },
          {
            "name": "year_dollars",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: 2024-25 dollars.",
            "examples": [
              "eq.2024-25 dollars"
            ]
          },
          {
            "name": "description1",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Total community corrections daily average population"
            ]
          },
          {
            "name": "description2",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.Work release"
            ]
          },
          {
            "name": "description3",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string.",
            "examples": [
              "eq.including periodic detainees"
            ]
          },
          {
            "name": "description4",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Assault, Debt servicing fees, Depreciation, Health expenditure, Land, Open, Other assets, Payroll tax, Secure, Serious assault, Total, Total capital costs, Total net operating expenditure, Transport and escort services, User cost of capital.",
            "examples": [
              "eq.User cost of capital"
            ]
          },
          {
            "name": "description5",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Land, Other assets.",
            "examples": [
              "eq.Other assets"
            ]
          },
          {
            "name": "data_source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: Derived from State and territory governments (unpublished), Derived from State and territory governments (unpublished); ABS Australian National Accounts: National Income Expenditure and Product, Derived from State and territory governments (unpublished); ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, Derived from State and territory governments (unpublished); ABS National state and territory population - December, Derived from State and territory governments (unpublished); ABS National state and territory population - December; ABS Estimates and Projections Aboriginal and Torres Strait Islander Australians, State and territory governments (unpublished).",
            "examples": [
              "eq.State and territory governments (unpublished)"
            ]
          },
          {
            "name": "unit",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "string. Values: $, $'000, %, hr/day, no., rate, rate (AS), ratio, ratio (AS).",
            "examples": [
              "eq.ratio (AS)"
            ]
          },
          {
            "name": "nsw",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 2197198.0."
          },
          {
            "name": "vic",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1577112.0."
          },
          {
            "name": "qld",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1593364.0."
          },
          {
            "name": "wa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 1084690.0."
          },
          {
            "name": "sa",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 419644.0."
          },
          {
            "name": "tas",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 181854.0."
          },
          {
            "name": "act",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 127284.0."
          },
          {
            "name": "nt",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.0 to 320677.0."
          },
          {
            "name": "australia",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "number. From 0.01 to 7326455.0."
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`field.asc` or `field.desc`, comma-separated. The publisher's row order when absent."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 100
            },
            "description": "Rows per page, 1 to 10,000. 100 when absent."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Rows to skip. The `next` URL in each answer sets it for you."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "ndjson",
                "csv"
              ],
              "default": "json"
            },
            "description": "`json`, `ndjson` or `csv`. JSON carries the provenance header, and the others carry it in response headers."
          }
        ],
        "responses": {
          "200": {
            "description": "Rows with the version, licence and attribution. `next` is the URL of the following page, or null."
          },
          "400": {
            "description": "The query names a field the dataset does not have, or a value of the wrong type."
          },
          "404": {
            "description": "The dataset or version is not loaded for queries."
          },
          "429": {
            "description": "More than 60 requests in 10 seconds from one address. Blocked for 10 seconds. Wait `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the block lifts."
              },
              "RateLimit-Policy": {
                "schema": {
                  "type": "string"
                },
                "description": "The limit, as \"fair-use\";q=60;w=10."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "const": 429
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "window_seconds": {
                      "type": "integer"
                    },
                    "block_seconds": {
                      "type": "integer"
                    },
                    "docs": {
                      "type": "string",
                      "format": "uri"
                    },
                    "files": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/datasets/{slug}/versions": {
      "get": {
        "tags": [
          "query"
        ],
        "summary": "The versions loaded for queries, newest first, with the URLs to query each",
        "operationId": "queryVersions",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "rogs-corrective-services"
              ]
            },
            "description": "The dataset's slug, as in its page URL `/d/<slug>/`."
          }
        ],
        "responses": {
          "200": {
            "description": "Loaded versions with row counts and URLs."
          },
          "404": {
            "description": "The dataset or version is not loaded for queries."
          },
          "429": {
            "description": "More than 60 requests in 10 seconds from one address. Blocked for 10 seconds. Wait `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the block lifts."
              },
              "RateLimit-Policy": {
                "schema": {
                  "type": "string"
                },
                "description": "The limit, as \"fair-use\";q=60;w=10."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "const": 429
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "window_seconds": {
                      "type": "integer"
                    },
                    "block_seconds": {
                      "type": "integer"
                    },
                    "docs": {
                      "type": "string",
                      "format": "uri"
                    },
                    "files": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
