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

# Nanonets Health Get Appointments

> Native Nanonets Health appointment-list tool exposed through the Agents Platform.

This document covers `nanonetshealth_get_appointments`, the native Nanonets Health appointment-list tool exposed through the Agents Platform.

## Authentication

The tool uses the Nanonets Health integration. The platform injects:

* `api_key`

The API key is excluded from the model-visible tool schema and scopes requests to the connected Nanonets Health organization.

## `nanonetshealth_get_appointments`

Fetches lean appointment/encounter records from Nanonets Health. The tool is read-only and supports pagination, date filters, appointment-state filters, facility/provider filters, insurance filters, and free-text search.

### Inputs

All model-visible inputs are optional:

* `page`: One-based page number. Defaults to `1`.
* `limit`: Page size. Defaults to `50`; maximum `100`.
* `fetch_all`: Fetch and combine every result page. When enabled, `page` and `limit` are ignored and the tool uses pages of 100 records.
* `encounter_date_from`, `encounter_date_to`: Encounter date range in `YYYY-MM-DD` format.
* `coded_date_from`, `coded_date_to`: Coded date range in `YYYY-MM-DD` format.
* `sync_status`, `precheck_status`, `appt_status`: Exact status filters.
* `appointment_types`: Exact appointment-type filters.
* `facility_codes`: Facility/department-code filters.
* `provider_name`, `insurance_name`: Provider and insurance filters.
* `search_term`: Free-text search.
* `sort_by`, `sort_order`: Result ordering.

### Pagination behavior

Without `fetch_all`, one invocation returns one page and publishes that complete page as one task variable.

With `fetch_all: true`, the tool:

1. starts at page 1,
2. requests the maximum page size of 100,
3. fetches every reported page sequentially,
4. combines every page's `data` array,
5. returns one structured result and publishes it as one task variable.

The all-pages mode is limited to 100 pages / 10,000 appointments. Results above that limit fail with an instruction to narrow the filters rather than returning silently truncated data.

### Output

```json theme={null}
{
  "data": [
    {
      "ehr_id": "365172",
      "external_patient_id": "57452",
      "patient_name": "Example Patient",
      "patient_dob": "1971-09-29T00:00:00Z",
      "provider_name": "Example Provider",
      "appointment_date": "2026-07-15T07:00:00Z",
      "status": "0",
      "appt_status": "0",
      "insurance_carrier_name": "Example Insurance",
      "copay": 0
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 100,
  "total_pages": 1,
  "pages_fetched": 1,
  "all_pages_fetched": true
}
```

`pages_fetched` and `all_pages_fetched` are present only for `fetch_all` results.

## Output variables

Every successful result is stored as a JSON-valued task variable. The tool result includes the generated `output_variable`, and the agent should use that returned reference rather than predeclaring a variable number.

Examples:

* `${VAR_N}.data`: all appointments in the result.
* `${VAR_N}.data[0]`: the first appointment.
* `${VAR_N}.total`: total appointments reported by Nanonets Health.

Normal paginated calls produce one variable per invocation/page. A `fetch_all` call produces one variable containing the combined pages.

## Agent instruction guidance

Use `fetch_all: true` when downstream processing must cover every appointment, such as filtering encounters and delegating one child task per valid appointment. Read the actual generated `${VAR_N}` from the tool result; instruction text such as “store this in `${VAR_1}`” does not create or reserve that variable.
