# Query records

## `POST /v1/objects/{object}/query`

Filter, sort, and page one object by its workspace field names. The reserved object names event and events use the shared event columns and return an event page. Use POST /v1/events/query for the cross-type query schema. Requires the `read` scope.

```json
{
  "tags": [
    "Records"
  ],
  "operationId": "query-records",
  "summary": "Query records",
  "description": "Filter, sort, and page one object by its workspace field names. The reserved object names event and events use the shared event columns and return an event page. Use POST /v1/events/query for the cross-type query schema. Requires the `read` scope.",
  "x-retainer-scope": "read",
  "parameters": [
    {
      "in": "path",
      "name": "object",
      "required": true,
      "description": "Object API name.",
      "example": "company",
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "search": {
              "description": "Keywords within this object only, matched by Postgres full-text search over its label and searchable fields. Every word must match, as a whole word or the start of one (\"Dan\" finds \"Dana\"); accents are ignored.",
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "filter": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "sort": {
              "maxItems": 3,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "field": {
                    "type": "string"
                  },
                  "direction": {
                    "default": "asc",
                    "type": "string",
                    "enum": [
                      "asc",
                      "desc"
                    ]
                  }
                },
                "required": [
                  "field"
                ],
                "additionalProperties": false
              }
            },
            "limit": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "cursor": {
              "type": "string"
            },
            "include": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "relationReferences"
                ]
              }
            },
            "linked": {
              "description": "Event types only: events directly attached to this record, as a participant, about it, or through one of the event's own relation fields (link: field).",
              "type": "object",
              "properties": {
                "record": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "link": {
                  "type": "string",
                  "enum": [
                    "participant",
                    "about",
                    "field"
                  ]
                }
              },
              "required": [
                "record"
              ],
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        "example": {
          "filter": {
            "name": "Acme"
          },
          "limit": 10
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Successful response.",
      "content": {
        "application/json": {
          "schema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RecordPage"
              },
              {
                "$ref": "#/components/schemas/EventPage"
              }
            ]
          },
          "example": {
            "records": [],
            "nextCursor": null
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "default": {
      "$ref": "#/components/responses/ApiError"
    }
  }
}
```

[Full OpenAPI contract](/openapi.json)
