# Returns a list of Visits (V1) based on filter criteria

**Query shape:** Prefer a **narrow** filter—combine scoping filters with `lastModified` or date bounds where supported. A very wide date range with no other scoping can **408** (timeout) on large tenants; retry with a smaller window or use `lastId` as an **ID-based cursor** (`id > previousId`), optionally combined with `lastModified` as a **filter**, not as a sort.
**Empty results:** **200** with `data: []` means no Visits matched; it does not indicate invalid filter values.
**responseFields:** Use only names allowed on this operation (see the `responseFields` parameter). Use `ALL` or the documented flat field list.
**Pagination:** The `page` query parameter is deprecated where `lastId` is supported. Use `lastId` as an **ID-based cursor** (`id > previousId`). Combine with `lastModified` as a **filter**, not as a sort.

Endpoint: GET /v1/visits
Version: 191.0.3
Security: bearerAuth, oAuthSandbox

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

  - `oAuthSandbox` (unknown)
    oauth2

## Query parameters:

  - `filter` (string)
    Filter clauses for visits. General grammar and operators: the Public API filter documentation.
**Auto filter:** If you omit a date-limiting filter (such as `lastModified`), the server may apply one automatically; behavior can vary by deployment.
**Keys and operators (this endpoint)**
- `txCase.id` (`==`, `->`) — `->` is accepted but is equivalent to `==` for a **single** id (for example `txCase.id->[12]`). Do not pass multiple ids; the server resolves only one case and that case’s latest option.
- `lastModified` (`>`, `>=`, `<`, `<=`)

**`txCase.id` resolves to the latest treatment option only.** The server replaces `txCase.id` with the `optionId` of the **last** `txOption` on that case. Visits that still belong to earlier options on the same case do **not** match. This is not “all visits for case X.”
**Ordering:** Bulk GET does not apply a `lastModified` sort. `lastId` is an ID-based cursor (`id > previousId`, ascending). Pass the **largest** `id` from the previous page, not “the last row” or “newest first.” Do not assume appointments-style `lastModified` DESC pagination.
Examples: `lastModified>=2022-01-01`, `txCase.id==12`, `txCase.id->[12]`.

  - `responseFields` (string)
    A URL-encoded, comma-delimited list of field names to include in the response data. Additionally, the following values are also supported:

ALL - Returns all field names.

  - `page` (string)
    Page number for pagination control

  - `pageSize` (string)
    Page size for pagination control

  - `lastId` (string)
    Largest visit `id` from the previous page. Next page is `id > lastId` (ascending ID cursor).

## Header parameters:

  - `Organization-ID` (string, required)
    Organization context for the request. Must match the organization authorized by the access token.

## Response 200:

  - `200` (unknown)
    The request was successful

## Response 200 fields (application/json):

  - `data` (array)

  - `data.id` (integer)

  - `data.type` (string)
    Resource type. Always `VisitV1`.
    Example: VisitV1

  - `data.duration` (integer)
    Visit length in minutes. Allowed range is 10–240. If omitted on create, the database default is 60.
    Example: 60

  - `data.sequence` (integer)
    Example: 0

  - `data.visitProceduresOrderType` (string)
    Procedure sort order. Optional on create; if omitted, the database default is TEETH.
    Enum: "TEETH", "CREATED", "CODE", "SURFACES", "DESCRIPTION", "PROVIDER", "AMOUNT", "CUSTOM"

  - `data.descProceduresOrder` (boolean, required)
    When true, sort procedures descending. Required on POST; omitting it returns 400.
    Example: true

  - `data.procedures` (array, required)
    Non-empty array of patient procedures. An empty array is rejected on create (`procedures should not be empty`).

  - `data.procedures.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `data.procedures.type` (string)
    The type of the linked model. This field is read-only.
    Example: ExampleModelType

  - `data.procedures.url` (string, required)
    The URL at which the linked model can be accessed. This field is read-only.
    Example: https://api.example.com/models/12345

  - `data.lastModified` (string)
    Example: 2018-07-09T19:00:00.000Z

  - `data.txCase` (object, required)
    A reference to a linked model. Includes the id, the type, and URL at which the model can be accessed.

  - `data.txCase.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `data.txCase.type` (string)
    The type of the linked model. This field is read-only.
    Example: ExampleModelType

  - `data.txCase.url` (string, required)
    The URL at which the linked model can be accessed. This field is read-only.
    Example: https://api.example.com/models/12345

  - `data.appointment` (object)
    Linked appointment when this visit is scheduled; omitted or null otherwise.

  - `data.appointment.id` (integer, required)
    The unique identifier for the linked model.
    Example: 12345

  - `data.appointment.type` (string)
    The type of the linked model. This field is read-only.
    Example: ExampleModelType

  - `data.appointment.url` (string, required)
    The URL at which the linked model can be accessed. This field is read-only.
    Example: https://api.example.com/models/12345

  - `warnings` (array)

  - `warnings.code` (string)

  - `warnings.title` (string)

  - `warnings.description` (string)

  - `warnings.source` (string)

  - `errors` (array)

  - `meta` (object)

  - `meta.pagination` (object)
    Pagination info
    Example: {"limit":10,"offset":0}

  - `meta.pagination.limit` (integer)
    Example: 10

  - `meta.pagination.offset` (integer)
    Example: 0

  - `meta.pagination.total` (integer)
    Example: 100

## Response 400:

  - `400` (unknown)
    The request was invalid or cannot be processed

## Response 401:

  - `401` (unknown)
    Authentication is required and has failed or has not been provided

## Response 403:

  - `403` (unknown)
    The request is understood, but it has been refused or access is not allowed

## Response 404:

  - `404` (unknown)
    The requested resource is either missing or does not exist

## Response 408:

  - `408` (unknown)
    The server timed out while processing the request

## Response 429:

  - `429` (unknown)
    Rate limit exceeded

## Response 500:

  - `500` (unknown)
    An unexpected error occurred

## Response 200 examples:

  - `default` (unknown)

