> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List records

> Production records of the entity, filtered, sorted, and cursor-paginated. Filtering or sorting on a
field declared `indexed: true` is served by that field's index; other fields are scanned.



## OpenAPI

````yaml /openapi/data-v1.json get /projects/{project}/entities/{entity}/records
openapi: 3.1.2
info:
  title: HASP Data API
  version: '2026-07-12'
  description: >-
    The HASP Data API reads and writes the records of an app's entities. Each
    entity's fields are declared in the

    app's schema (`GET /projects/{project}/schema`); a record is those fields
    plus `id`, `created_at`, and `updated_at`.

    Two app-level endpoints serve the runtime SDK: `GET /bootstrap` and `GET
    /status`, addressed by `X-Hasp-AppId`.


    Authenticate with a project API key (`Authorization: Bearer
    hasp_pak_live_…`), a delegated agent credential

    (`Bearer hasp_agt_live_…`), or — from the app itself — the runtime session
    cookie. Reads of a public app may be

    anonymous with an `X-Hasp-AppId` header naming the app. See

    [Authentication](https://docs.usehasp.com/ai-api/authentication#data-api).


    Errors use the same envelope as the AI API: `{"success": false, "error":
    {"type", "code", "message", "param",

    "details", "retryable", "request_id"}, "meta": {"request_id"}}`.
servers:
  - url: https://{org}.usehasp.run/api/hasp/v1
    description: App runtime origin
    variables:
      org:
        default: your-org
        description: Your organization's runtime subdomain.
security:
  - projectApiKey: []
  - agentCredential: []
  - runtimeSession: []
paths:
  /projects/{project}/entities/{entity}/records:
    get:
      tags:
        - Records
        - EntityRecord
      summary: List records
      description: >-
        Production records of the entity, filtered, sorted, and
        cursor-paginated. Filtering or sorting on a

        field declared `indexed: true` is served by that field's index; other
        fields are scanned.
      operationId: v1.records.index
      parameters:
        - name: project
          in: path
          required: true
          description: The project's slug or id (ULID).
          schema:
            type: string
        - name: entity
          in: path
          required: true
          description: The entity slug
          schema:
            type: string
        - name: filter
          in: query
          description: >-
            JSON object of conditions, all ANDed. Per field: `{"status":"open"}`
            (equality), `{"status":null}`

            (is null), an operator map `{"age":{"gte":18,"lt":65}}`, or one
            explicit operator

            `{"age":{"op":"gte","value":18}}`. `created_at`/`updated_at` accept
            gt, gte, lt, lte against an

            ISO 8601 timestamp. A condition that cannot be applied exactly as
            written is a 422, never ignored.


            Operators per field type: see the Data API filtering guide. At most
            20 conditions; `in` takes at most 100 values.
          schema:
            type:
              - string
              - 'null'
            maxLength: 8192
          example:
            status:
              in:
                - open
                - pending
            due:
              lt: '2026-12-31'
        - name: sort
          in: query
          description: >-
            `field` or `field:asc|desc` on `created_at`, `updated_at`, or a
            declared non-json field. Nulls sort

            last ascending and first descending. Default order is by id
            (creation order).
          schema:
            type:
              - string
              - 'null'
            maxLength: 128
          example: due:desc
        - name: cursor
          in: query
          description: >-
            The `meta.next_cursor` from the previous page, unchanged. Opaque and
            encrypted; bound to the sort it was issued for.
          schema:
            type:
              - string
              - 'null'
            maxLength: 4096
        - name: pageSize
          in: query
          description: Records per page. Values above the maximum are clamped to it.
          schema:
            type: integer
            minimum: 1
        - name: X-Hasp-AppId
          in: header
          description: >-
            The id of the published app making the request. Required when
            calling without credentials: anonymous reads are allowed only for an
            app whose access mode is `public`, and only for its own project.
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/EntityRecord'
                  meta:
                    type: object
                    properties:
                      next_cursor:
                        type:
                          - string
                          - 'null'
                        description: >-
                          Pass as `cursor` to fetch the next page, with the same
                          `sort`. `null` on the last page.
                      has_more:
                        type: boolean
                    required:
                      - next_cursor
                      - has_more
                required:
                  - data
                  - meta
        '401':
          description: >-
            No usable credential: none was sent, or the one sent is unknown,
            revoked, or expired. `error.code` says which.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: >-
            The caller does not reach this project, or its role lacks the
            capability this operation requires.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: '`NOT_FOUND`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: '`VALIDATION_FAILED`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '423':
          description: >-
            HASP has frozen the organization during an incident; requests are
            refused until it is unfrozen.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: >-
            Rate limit exceeded. Retry after the window indicated by
            `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - projectApiKey: []
        - agentCredential: []
        - runtimeSession: []
        - {}
components:
  schemas:
    EntityRecord:
      type: object
      description: >-
        One record. Besides the system fields, it carries the entity's declared
        fields by key, typed per the entity schema. A `reference` field holds
        the id of a record of the referenced entity, in the same environment;
        the reference is checked when written, and is not cleared if the
        referenced record is later deleted — resolve it with a read and treat a
        404 as "no longer exists".
      x-hasp-entity-schema:
        operationRef: '#/paths/~1projects~1{project}~1schema/get'
        description: >-
          The entity's declared field keys, types, and constraints — the fields
          a record of the entity carries.
      properties:
        id:
          type: string
          description: Record id (ULID).
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - created_at
        - updated_at
      additionalProperties: {}
      title: EntityRecord
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            type:
              type: string
              description: The error category.
            code:
              type: string
              description: >-
                Stable machine-readable code; branch on this. See
                https://docs.usehasp.com/ai-api/reference/errors.
            message:
              type: string
            param:
              type:
                - string
                - 'null'
              description: The first input path at fault, when there is one.
            details:
              type:
                - object
                - 'null'
              description: >-
                Validation failures keyed by input path (`data.title`,
                `records.3.title`, `filter.age`).
              additionalProperties:
                type: array
                items:
                  type: string
            retryable:
              type: boolean
            request_id:
              type: string
          required:
            - type
            - code
            - message
            - retryable
            - request_id
        meta:
          type: object
          properties:
            request_id:
              type: string
          required:
            - request_id
      required:
        - success
        - error
        - meta
      title: ApiError
  securitySchemes:
    projectApiKey:
      type: http
      description: Project API key, for server-to-server access to one project.
      scheme: bearer
      bearerFormat: hasp_pak_{live|test}_…
    agentCredential:
      type: http
      description: Delegated agent credential, scoped by its authorization grants.
      scheme: bearer
      bearerFormat: hasp_agt_{live|test}_…
    runtimeSession:
      type: apiKey
      description: >-
        The signed-in user's session on the app runtime host; what the JS SDK
        uses.
      in: cookie
      name: hasp-runtime-session

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.