> ## 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.

# schedule

This portion will contain end points solely related to appointment actions

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

This endpoint will schedule the appointment for patient on both TeamCare and Practice PMS.

#### Parameters

* Ai Agent will just have to hit on schedule end point as above to schedule the appointment.
* Organization id in url will be the id for practice in teamcare database..
* There are 2 cases we can find the patient or we not, If we found the patient already in Teamcare database it means we have to just send its id in patient\_id and not patient\_request\_attributes, but if we not found the patient the patient id should be nil and patient\_request\_attributes should come with patient all information.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/appointments/schedule" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "appointment": {
        "patient_id": "9lIv6K04",
        "appointment_type_id": 2,
        "appointment_at": "2028-07-11T09:00:00Z"
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/appointments/schedule", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "appointment": {
        "patient_id": "9lIv6K04",
        "appointment_type_id": 2,
        "appointment_at": "2028-07-11T09:00:00Z"
      }
    })
  })

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

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

  response = requests.post(
      "https://app.teamcaredental.com/api/v1/ai_voice/organizations/:organization_id/appointments/schedule",
      headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"},
      json={
        "appointment": {
          "patient_id": "9lIv6K04",
          "appointment_type_id": 2,
          "appointment_at": "2028-07-11T09:00:00Z"
        }
      }
  )

  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/appointments/schedule")
  request = Net::HTTP::Post.new(uri)
  request["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
  request["Content-Type"] = "application/json"
  request.body = JSON.dump({
    "appointment" => {
      "patient_id" => "9lIv6K04",
      "appointment_type_id" => 2,
      "appointment_at" => "2028-07-11T09:00:00Z"
    }
  })

  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}
{
    "message": "Appointment request is received"
}
```
