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

# appointments

### GET api/v1/ai\_voice/organizations/2140/appointments/search

This endpoint will search the appointment for patient for rescheduling etc. purposes.

#### Parameters

* Ai Agent will just have to hit on search end point as above to search the patients appointment.
* Patient id will come from patients search.
* If patient say find appointment greater than or equal to some date we will pass params in body : `"q": { "appointment_at_gteq": "2023-02-07T11:00:00.000Z" }`
* The apointment Type id will be returned in finding available slots in case of rescheduling.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/:patient_id/appointments" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "q": {
        "appointment_at_gteq": "2023-02-07T11:00:00.000Z"
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/:patient_id/appointments?q[appointment_at_gteq]=2023-02-07T11%3A00%3A00.000Z", {
    headers: {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN"
    }
  })

  const data = await response.json()
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/:patient_id/appointments",
      headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
      json={
        "q": {
          "appointment_at_gteq": "2023-02-07T11:00:00.000Z"
        }
      }
  )

  data = response.json()
  ```

  ```ruby Ruby theme={null}
  require "net/http"
  require "json"

  uri = URI("https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/patients/:patient_id/appointments")
  request = Net::HTTP::Get.new(uri)
  request["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
  request["Content-Type"] = "application/json"
  request.body = JSON.dump({
    "q" => {
      "appointment_at_gteq" => "2023-02-07T11:00:00.000Z"
    }
  })

  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end

  data = JSON.parse(response.body)
  ```
</CodeGroup>

Response

Content-Type: application/json Data attribute returned just to give you insights, it has nothing to do with patient.

```json theme={null}
{
    "data": [
        {
            "id": "111436016",
            "type": "appointment",
            "attributes": {
                "id": 111436016,
                "notes": "Test - Appoitnment",
                "appointment_at": "2026-05-07T08:34:44.450Z",
                "appointment_type_id": 2881,
                "patient": {
                    "data": {
                        "id": "nAs0voOX",
                        "type": "patient",
                        "attributes": {
                            "first_name": "Test",
                            "last_name": "01",
                            "birth_date": null,
                            "email": "test@scheduler.com",
                            "phone_number": "1232131232"
                        }
                    }
                }
            }
        }
    ],
    "pagy": {
        "overflow": false,
        "vars": {
            "page": 1,
            "items": 10,
            "outset": 0,
            "size": [
                1,
                4,
                4,
                1
            ],
            "page_param": "page",
            "params": {},
            "anchor": "",
            "link_extra": "",
            "i18n_key": "pagy.item_name",
            "cycle": false,
            "steps": false,
            "overflow": "empty_page",
            "count": 1
        },
        "count": 1,
        "items": 1,
        "outset": 0,
        "page": 1,
        "last": 1,
        "pages": 1,
        "offset": 0,
        "from": 1,
        "to": 1,
        "prev": null,
        "next": null
    }
}
```

And In case of appointment not found,

```json theme={null}
{
    "errors": "Couldn't find Appointment with 'id'=1 [WHERE \"appointments\".\"deleted\" = $1 AND \"appointments\".\"tenant_id\" = $2]"
}
```
