# pub.techne.draft.query.listRecords

> The platform's generic list query: one page of the records a pub.techne.draft.query names, in its order. Every record is read through the platform's one read path, whatever the query says: no record of a hidden or suspended account is answered, nor, to a signed-in caller, another's record across a block either way (the caller blocked its author, or its author blocked the caller); a public record also leaves out anything moderation holds back (a trusted verdict or `!takedown`); a permissioned record is answered only when it is the caller's own or counts in a space whose read policy admits the caller now, not taken down (in a space whose authority is the caller, a block does not hide its records from them), and (in a member-owned circle space) only while its author is a current member by a claim the caller can read. Each branch reads the public records of the view it names (the query's `view`, or its branch's in `any`, `pub.techne.draft.query#branch`): `asWritten`, every record as its author wrote it, or `curated`, the commons' listed records; there is no default (ViewRequired), and a curated branch naming a type no curator covers is refused (NotCurated). A curated record every source of which is by a hidden or suspended account is left out for everyone, and one every source of which is by an author blocked either way is left out for a signed-in caller. Anyone may call it, signed in or not; an anonymous caller gets public records only. Each top-level `any` branch runs on its own index and the branches are merged in order, so a record that matches two branches comes once. A permissioned record, and a public record answered as written, is answered only while the platform's `decide` calls its version valid; and a record a curated branch finds by `location` `in` or `covers` is answered only while a location the curated view trusts (its author's own, or a writer the commons endorses for the claim's type) still holds its slot once precedence is rerun over those alone. Because these checks run on the page already read, a page can hold fewer records than `limit`, even none, and still carry a cursor: keep paging until none comes back. Draft tier.

- Kind: query
- Authority: query.draft.techne.pub
- Lexicon: 1
- Published by [lexicons.techne.town](https://lexicon.garden/identity/did:plc:cbtfheqpi4g6vlrha4tpoh53), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.query.listRecords)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.query.listRecords/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.query.listRecords/analytics)

## Query (`pub.techne.draft.query.listRecords`)

Type: query · GET

### Parameters (query string)

- `count` (boolean): Also count the records the query answers this caller, as pub.techne.draft.query.countRecords would for the same query and params: the output gains `count` and `capped`.
  - Constraints: default: false
- `cursor` (string): The cursor of the previous page, opaque: pass it back as it came, with the same query.
- `limit` (integer): The page size; default the query's `limit`, else 50.
  - Constraints: minimum: 1, maximum: 500
- `params` (string): The query's parameters as a JSON object of strings (or lists of strings), e.g. {"here": "40.01,-105.27"}. `$viewer` and `$now` are the platform's and cannot be passed.
  - Constraints: maxLength: 8192
- `query` (string): A pub.techne.draft.query object, as JSON. Give this or `queryUri`.
  - Constraints: maxLength: 16384
- `queryUri` (string · at-uri): A published pub.techne.draft.query record to run. Give this or `query`.

### Output (application/json)

- `capped` (boolean): Only when asked with `count=true`: true when there are more than `count` (countRecords' `capped`).
- `count` (integer): Only when asked with `count=true`: how many records the query answers this caller, each once, up to countRecords' cap (countRecords' `count`).
- `cursor` (string): Pass it back as cursor for the next page. Absent on the last page; a page shorter than `limit` is not the last page while it carries one.
- `notServedHere` (ref): Present when a `near` or `covers` point or an `in` area of the query lies outside this operator's coverage, or an `in` area is not held here. The records answered are what this operator holds, not the whole answer: an empty list (or a zero count) with this set means "not served here", not "nothing there". Ask an operator that serves the place.
  - Reference: `#notServedHere`
- `records` (array, required): In the query's order, ties broken by URI.
  - `items` (ref)
    - Reference: `#record`

### Errors

- `InvalidRequest`: HTTP 400. A malformed or refused query (naming the branch or condition), parameter or cursor.
- `ViewRequired`: HTTP 400. A branch of the query names no `view` (curated or asWritten): there is no default. The message names the branch.
- `NotCurated`: HTTP 400. A branch read with view `curated` names a type (`type is`/`type in`) no curator the commons root trusts covers; the message names the type. Read it with view `asWritten`.
- `NotFound`: HTTP 404. `queryUri` names no query record the caller may read.

## #matchedLocation (`pub.techne.draft.query.listRecords#matchedLocation`)

Type: object

One stated location that matched.

### Properties

- `asserter` (string · did, required): Who stated it: the record's author, or a claim's writer.
- `entry` (union): The location entry as stated, wrapper included (absent for an area's own cells). The union is open: an entry of another `$type` comes back as stated.
  - One of: `community.lexicon.location.geo`, `community.lexicon.location.hthree`, `community.lexicon.location.address`, `com.atproto.repo.strongRef`, `pub.techne.draft.locationEntry`
- `kind` (string, required): How the thing relates to the place (`at`, `serves`, `registered`, ...).
- `source` (string · at-uri, required): The record that stated it (the record itself, or a claim about it).

## #notServedHere (`pub.techne.draft.query.listRecords#notServedHere`)

Type: object

Why the answer is not the whole answer: this operator does not serve the place asked about. An empty list (or a zero count) with this set means "not served here", not "nothing there".

### Properties

- `message` (string, required): The reason, in words, for a person to read.
  - Constraints: maxLength: 300
- `reason` (string, required): `outsideCoverage`: a `near` or `covers` point lies outside the areas this operator serves. `areaNotHeld`: an `in` area is one this operator does not hold, or lies outside the areas it serves.
  - Constraints: knownValues: outsideCoverage | areaNotHeld

## #record (`pub.techne.draft.query.listRecords#record`)

Type: object

One indexed record.

### Properties

- `author` (string · did, required): The DID whose repo holds the record.
- `cid` (string · cid, required)
- `collection` (string · nsid, required)
- `curated` (boolean): A public record that is a live curated record: a curator the commons root trusts merged it from its sources, and it is not superseded. Its `pub.techne.draft.provenance` (same author, subject this record) names who it is from. Always answered: false for every other record (a source copy, a superseded one, a permissioned one).
- `held` (boolean): The caller's own permissioned record that the reach limit holds back from the people it would reach: a withheld act (a share or a circle add), answered to its author alone (to anyone else it is not found) until the limit admits it. Absent otherwise. A query with `held: true` answers only these.
- `matched` (array): With a `location` `in` or `covers` condition: the stated locations that matched (with `followed`, its subject's), at most 8.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `#matchedLocation`
- `measures` (unknown): The numbers the query's operators produced for this record, by name (a `near` distance in metres, a `matches` rank).
- `signals` (unknown): The server-side signals the query asked for, by name; a signal with no value for this record is absent.
- `source` (string, required): Whether the record is public (on the firehose) or permissioned.
  - Constraints: knownValues: public | permissioned
- `space` (string · at-uri): The space a permissioned record counts in. Absent for a public record, and for a caller's own record that counts in none.
- `time` (string · datetime, required): The record's indexed time (the `written` role).
- `uri` (string · at-uri, required)
- `value` (unknown, required): The record body.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "The platform's generic list query: one page of the records a pub.techne.draft.query names, in its order. Every record is read through the platform's one read path, whatever the query says: no record of a hidden or suspended account is answered, nor, to a signed-in caller, another's record across a block either way (the caller blocked its author, or its author blocked the caller); a public record also leaves out anything moderation holds back (a trusted verdict or `!takedown`); a permissioned record is answered only when it is the caller's own or counts in a space whose read policy admits the caller now, not taken down (in a space whose authority is the caller, a block does not hide its records from them), and (in a member-owned circle space) only while its author is a current member by a claim the caller can read. Each branch reads the public records of the view it names (the query's `view`, or its branch's in `any`, `pub.techne.draft.query#branch`): `asWritten`, every record as its author wrote it, or `curated`, the commons' listed records; there is no default (ViewRequired), and a curated branch naming a type no curator covers is refused (NotCurated). A curated record every source of which is by a hidden or suspended account is left out for everyone, and one every source of which is by an author blocked either way is left out for a signed-in caller. Anyone may call it, signed in or not; an anonymous caller gets public records only. Each top-level `any` branch runs on its own index and the branches are merged in order, so a record that matches two branches comes once. A permissioned record, and a public record answered as written, is answered only while the platform's `decide` calls its version valid; and a record a curated branch finds by `location` `in` or `covers` is answered only while a location the curated view trusts (its author's own, or a writer the commons endorses for the claim's type) still holds its slot once precedence is rerun over those alone. Because these checks run on the page already read, a page can hold fewer records than `limit`, even none, and still carry a cursor: keep paging until none comes back. Draft tier.",
      "errors": [
        {
          "description": "HTTP 400. A malformed or refused query (naming the branch or condition), parameter or cursor.",
          "name": "InvalidRequest"
        },
        {
          "description": "HTTP 400. A branch of the query names no `view` (curated or asWritten): there is no default. The message names the branch.",
          "name": "ViewRequired"
        },
        {
          "description": "HTTP 400. A branch read with view `curated` names a type (`type is`/`type in`) no curator the commons root trusts covers; the message names the type. Read it with view `asWritten`.",
          "name": "NotCurated"
        },
        {
          "description": "HTTP 404. `queryUri` names no query record the caller may read.",
          "name": "NotFound"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "capped": {
              "description": "Only when asked with `count=true`: true when there are more than `count` (countRecords' `capped`).",
              "type": "boolean"
            },
            "count": {
              "description": "Only when asked with `count=true`: how many records the query answers this caller, each once, up to countRecords' cap (countRecords' `count`).",
              "type": "integer"
            },
            "cursor": {
              "description": "Pass it back as cursor for the next page. Absent on the last page; a page shorter than `limit` is not the last page while it carries one.",
              "type": "string"
            },
            "notServedHere": {
              "description": "Present when a `near` or `covers` point or an `in` area of the query lies outside this operator's coverage, or an `in` area is not held here. The records answered are what this operator holds, not the whole answer: an empty list (or a zero count) with this set means \"not served here\", not \"nothing there\". Ask an operator that serves the place.",
              "ref": "#notServedHere",
              "type": "ref"
            },
            "records": {
              "description": "In the query's order, ties broken by URI.",
              "items": {
                "ref": "#record",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "records"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "count": {
            "default": false,
            "description": "Also count the records the query answers this caller, as pub.techne.draft.query.countRecords would for the same query and params: the output gains `count` and `capped`.",
            "type": "boolean"
          },
          "cursor": {
            "description": "The cursor of the previous page, opaque: pass it back as it came, with the same query.",
            "type": "string"
          },
          "limit": {
            "description": "The page size; default the query's `limit`, else 50.",
            "maximum": 500,
            "minimum": 1,
            "type": "integer"
          },
          "params": {
            "description": "The query's parameters as a JSON object of strings (or lists of strings), e.g. {\"here\": \"40.01,-105.27\"}. `$viewer` and `$now` are the platform's and cannot be passed.",
            "maxLength": 8192,
            "type": "string"
          },
          "query": {
            "description": "A pub.techne.draft.query object, as JSON. Give this or `queryUri`.",
            "maxLength": 16384,
            "type": "string"
          },
          "queryUri": {
            "description": "A published pub.techne.draft.query record to run. Give this or `query`.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "type": "params"
      },
      "type": "query"
    },
    "matchedLocation": {
      "description": "One stated location that matched.",
      "properties": {
        "asserter": {
          "description": "Who stated it: the record's author, or a claim's writer.",
          "format": "did",
          "type": "string"
        },
        "entry": {
          "description": "The location entry as stated, wrapper included (absent for an area's own cells). The union is open: an entry of another `$type` comes back as stated.",
          "refs": [
            "community.lexicon.location.geo",
            "community.lexicon.location.hthree",
            "community.lexicon.location.address",
            "com.atproto.repo.strongRef",
            "pub.techne.draft.locationEntry"
          ],
          "type": "union"
        },
        "kind": {
          "description": "How the thing relates to the place (`at`, `serves`, `registered`, ...).",
          "type": "string"
        },
        "source": {
          "description": "The record that stated it (the record itself, or a claim about it).",
          "format": "at-uri",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "asserter",
        "source"
      ],
      "type": "object"
    },
    "notServedHere": {
      "description": "Why the answer is not the whole answer: this operator does not serve the place asked about. An empty list (or a zero count) with this set means \"not served here\", not \"nothing there\".",
      "properties": {
        "message": {
          "description": "The reason, in words, for a person to read.",
          "maxLength": 300,
          "type": "string"
        },
        "reason": {
          "description": "`outsideCoverage`: a `near` or `covers` point lies outside the areas this operator serves. `areaNotHeld`: an `in` area is one this operator does not hold, or lies outside the areas it serves.",
          "knownValues": [
            "outsideCoverage",
            "areaNotHeld"
          ],
          "type": "string"
        }
      },
      "required": [
        "reason",
        "message"
      ],
      "type": "object"
    },
    "record": {
      "description": "One indexed record.",
      "properties": {
        "author": {
          "description": "The DID whose repo holds the record.",
          "format": "did",
          "type": "string"
        },
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "collection": {
          "format": "nsid",
          "type": "string"
        },
        "curated": {
          "description": "A public record that is a live curated record: a curator the commons root trusts merged it from its sources, and it is not superseded. Its `pub.techne.draft.provenance` (same author, subject this record) names who it is from. Always answered: false for every other record (a source copy, a superseded one, a permissioned one).",
          "type": "boolean"
        },
        "held": {
          "description": "The caller's own permissioned record that the reach limit holds back from the people it would reach: a withheld act (a share or a circle add), answered to its author alone (to anyone else it is not found) until the limit admits it. Absent otherwise. A query with `held: true` answers only these.",
          "type": "boolean"
        },
        "matched": {
          "description": "With a `location` `in` or `covers` condition: the stated locations that matched (with `followed`, its subject's), at most 8.",
          "items": {
            "ref": "#matchedLocation",
            "type": "ref"
          },
          "maxLength": 8,
          "type": "array"
        },
        "measures": {
          "description": "The numbers the query's operators produced for this record, by name (a `near` distance in metres, a `matches` rank).",
          "type": "unknown"
        },
        "signals": {
          "description": "The server-side signals the query asked for, by name; a signal with no value for this record is absent.",
          "type": "unknown"
        },
        "source": {
          "description": "Whether the record is public (on the firehose) or permissioned.",
          "knownValues": [
            "public",
            "permissioned"
          ],
          "type": "string"
        },
        "space": {
          "description": "The space a permissioned record counts in. Absent for a public record, and for a caller's own record that counts in none.",
          "format": "at-uri",
          "type": "string"
        },
        "time": {
          "description": "The record's indexed time (the `written` role).",
          "format": "datetime",
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        },
        "value": {
          "description": "The record body.",
          "type": "unknown"
        }
      },
      "required": [
        "uri",
        "cid",
        "author",
        "collection",
        "value",
        "time",
        "source"
      ],
      "type": "object"
    }
  },
  "id": "pub.techne.draft.query.listRecords",
  "lexicon": 1
}
```
