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

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

- 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.
- Response
- Content-Type: application/json
- Data attribute returned just to give you insights, it has nothing to do with patient.



## OpenAPI

````yaml https://app.teamcaredental.com/openapi-ai-voice.json post /organizations/{organization_id}/appointments/schedule
openapi: 3.1.0
info:
  title: TeamCare AI Voice API
  version: 1.0.0
  description: AI Agent APIs for appointment scheduling, patient lookup and availability.
servers:
  - url: https://app.teamcaredental.com/api/v1/ai_voice
security:
  - bearerAuth: []
paths:
  /organizations/{organization_id}/appointments/schedule:
    post:
      tags:
        - Appointment
      summary: Schedule appointment
      description: >-
        This endpoint will schedule the appointment for patient on both TeamCare
        and Practice PMS.


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

        - Response

        - Content-Type: application/json

        - Data attribute returned just to give you insights, it has nothing to
        do with patient.
      operationId: organization_appointment_schedule
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                appointment:
                  type: object
                  properties:
                    patient_id:
                      type: string
                      example: 9lIv6K04
                    appointment_type_id:
                      type: integer
                      example: 2
                    appointment_at:
                      type: string
                      format: date-time
                      example: '2028-07-11T09:00:00Z'
            example:
              appointment:
                patient_id: 9lIv6K04
                appointment_type_id: 2
                appointment_at: '2028-07-11T09:00:00Z'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Missing, invalid or expired token.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: string
              example:
                errors: not authorized
        '403':
          description: The credential may not access this resource.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: string
              example:
                errors: access Denied
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Appointment not found
        '422':
          description: The request could not be processed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: string
              example:
                errors: ...
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT returned by POST /auth/token. Valid for six hours.

````