{
  "openapi": "3.0.0",
  "info": {
    "title": "DodoDentist API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.dododentist.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "basic",
        "description": "HTTP Basic auth carrying only the API key secret: Authorization: Basic base64(<key secret>)."
      },
      "accessToken": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Operator session token issued by the DodoDentist dashboard: Authorization: Token <access token>."
      }
    }
  },
  "paths": {
    "/api/appointments": {
      "get": {
        "tags": [
          "Appointments"
        ],
        "summary": "List appointments",
        "description": "Lists the appointments of your organization. Requires the `appointments:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clinicId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "patientId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "startTime",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "endTime",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "fields",
            "description": "Comma-separated projection of fields to return",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of appointments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "clinicId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "patientId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "startTime": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "endTime": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "REQUESTED",
                          "SCHEDULED",
                          "PATIENT_ARRIVED",
                          "NO_SHOW",
                          "CANCELED"
                        ]
                      },
                      "procedures": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "procedureId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "price": {
                              "oneOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            }
                          }
                        }
                      },
                      "reminders": {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      },
                      "lastEditTime": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `appointments:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "API key rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiAppointments"
      },
      "post": {
        "tags": [
          "Appointments"
        ],
        "summary": "Create an appointment",
        "description": "Requires the `appointments:write` scope. Fires the `appointment.created` webhook.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "clinicId"
                ],
                "properties": {
                  "clinicId": {
                    "type": "string"
                  },
                  "patientId": {
                    "type": "string"
                  },
                  "startTime": {
                    "type": "string"
                  },
                  "endTime": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created appointment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "patientId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "startTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "endTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "REQUESTED",
                        "SCHEDULED",
                        "PATIENT_ARRIVED",
                        "NO_SHOW",
                        "CANCELED"
                      ]
                    },
                    "procedures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "procedureId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string"
                          },
                          "price": {
                            "oneOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "reminders": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `appointments:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "postApiAppointments"
      }
    },
    "/api/appointments/{appointmentId}": {
      "get": {
        "tags": [
          "Appointments"
        ],
        "summary": "Get an appointment",
        "description": "Returns a single appointment by id. Appointments belonging to another organization respond 404. Requires the `appointments:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "appointmentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The appointment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "patientId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "startTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "endTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "REQUESTED",
                        "SCHEDULED",
                        "PATIENT_ARRIVED",
                        "NO_SHOW",
                        "CANCELED"
                      ]
                    },
                    "procedures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "procedureId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string"
                          },
                          "price": {
                            "oneOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "reminders": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found (or owned by another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiAppointmentsAppointmentId"
      },
      "put": {
        "tags": [
          "Appointments"
        ],
        "summary": "Update an appointment",
        "description": "Requires the `appointments:write` scope. Fires the `appointment.updated` webhook.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "appointmentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The updated appointment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "patientId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "startTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "endTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "REQUESTED",
                        "SCHEDULED",
                        "PATIENT_ARRIVED",
                        "NO_SHOW",
                        "CANCELED"
                      ]
                    },
                    "procedures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "procedureId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string"
                          },
                          "price": {
                            "oneOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "reminders": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found (or owned by another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "putApiAppointmentsAppointmentId",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "clinicId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "patientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "REQUESTED",
                      "SCHEDULED",
                      "PATIENT_ARRIVED",
                      "NO_SHOW",
                      "CANCELED"
                    ]
                  },
                  "procedures": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "procedureId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string"
                        },
                        "price": {
                          "oneOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        }
                      }
                    }
                  },
                  "reminders": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "lastEditTime": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Appointments"
        ],
        "summary": "Delete an appointment",
        "description": "Requires the `appointments:write` scope. Fires the `appointment.deleted` webhook.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "appointmentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted appointment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "patientId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "startTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "endTime": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "REQUESTED",
                        "SCHEDULED",
                        "PATIENT_ARRIVED",
                        "NO_SHOW",
                        "CANCELED"
                      ]
                    },
                    "procedures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "procedureId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string"
                          },
                          "price": {
                            "oneOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "reminders": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found (or owned by another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "deleteApiAppointmentsAppointmentId"
      }
    },
    "/api/clinics": {
      "get": {
        "tags": [
          "Clinics"
        ],
        "summary": "List clinics",
        "description": "Lists the clinics of your organization. Requires the `clinics:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Array of clinics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "defaultLocale": {
                        "type": "string"
                      },
                      "timezone": {
                        "type": "string"
                      },
                      "lastEditTime": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `clinics:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiClinics"
      }
    },
    "/api/invoices": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "List invoices",
        "description": "Lists the invoices of your organization. Requires the `invoices:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clinicId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "patientId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of invoices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "clinicId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "patientId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "number": {
                        "oneOf": [
                          {
                            "type": "integer"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      },
                      "total": {
                        "type": "number"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "creationTime": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `invoices:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiInvoices"
      }
    },
    "/api/patients": {
      "get": {
        "tags": [
          "Patients"
        ],
        "summary": "List patients",
        "description": "Lists the patients of your clinic. Requires the `patients:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clinicId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "email",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "_ids",
            "description": "Comma-separated list of patient ids",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "fields",
            "description": "Comma-separated projection of fields to return",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of patients",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "clinicId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "phone": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string"
                      },
                      "lastEditTime": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `patients:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "API key rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiPatients"
      },
      "post": {
        "tags": [
          "Patients"
        ],
        "summary": "Create a patient",
        "description": "Creates a patient in your clinic. Requires the `patients:write` scope. Fires the `patient.created` webhook.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "clinicId"
                ],
                "properties": {
                  "clinicId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created patient",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `patients:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "postApiPatients"
      }
    },
    "/api/patients/{patientId}": {
      "get": {
        "tags": [
          "Patients"
        ],
        "summary": "Get a patient",
        "description": "Returns a single patient by id. Patients belonging to another organization respond 404. Requires the `patients:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "patientId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The patient",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found (or owned by another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiPatientsPatientId"
      },
      "put": {
        "tags": [
          "Patients"
        ],
        "summary": "Update a patient",
        "description": "Requires the `patients:write` scope. Fires the `patient.updated` webhook.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "patientId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The updated patient",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found (or owned by another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "putApiPatientsPatientId",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "clinicId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "language": {
                    "type": "string"
                  },
                  "lastEditTime": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Patients"
        ],
        "summary": "Delete a patient",
        "description": "Requires the `patients:write` scope. Fires the `patient.deleted` webhook.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "patientId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted patient",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "phone": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    },
                    "lastEditTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found (or owned by another organization)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "deleteApiPatientsPatientId"
      }
    },
    "/api/payments": {
      "get": {
        "tags": [
          "Payments"
        ],
        "summary": "List payments",
        "description": "Lists the payments of your organization. Requires the `payments:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clinicId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "patientId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of payments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "clinicId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "patientId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "amount": {
                        "type": "number"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "creationTime": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `payments:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiPayments"
      }
    },
    "/api/treatments": {
      "get": {
        "tags": [
          "Treatments"
        ],
        "summary": "List treatments",
        "description": "Lists your organization's clinical treatment records. Requires the `treatments:read` scope.\n",
        "security": [
          {
            "apiKey": []
          },
          {
            "accessToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Array of treatments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "clinicId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "patientId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "appointmentsIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "startTime": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "lastEditTime": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the `treatments:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiTreatments"
      }
    },
    "/api/webhooksubscriptions": {
      "get": {
        "tags": [
          "Webhook subscriptions"
        ],
        "summary": "List webhook subscriptions",
        "description": "Webhook subscriptions deliver `patient.created`, `patient.updated`, `patient.deleted`, `appointment.created`, `appointment.updated`, `appointment.deleted`, `invoice.*` and `payment.*` events to your server as signed POST requests (`X-Dododentist-Signature: t=<timestamp>,v1=<hex HMAC-SHA256 of \"timestamp.body\">`). An endpoint failing 20 times in a row is disabled automatically. Subscriptions are managed with an operator access token; the `secret` is only returned once, on create.\n",
        "security": [
          {
            "accessToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Array of webhook subscriptions (without secrets)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "clinicId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "events": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "active": {
                        "type": "boolean"
                      },
                      "creationTime": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "getApiWebhooksubscriptions"
      },
      "post": {
        "tags": [
          "Webhook subscriptions"
        ],
        "summary": "Create a webhook subscription",
        "description": "The response includes the signing `secret` exactly once — store it; it cannot be retrieved again.\n",
        "security": [
          {
            "accessToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "clinicId",
                  "url"
                ],
                "properties": {
                  "clinicId": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "example": "https://example.com/dododentist-webhook"
                  },
                  "events": {
                    "type": "array",
                    "description": "Empty array subscribes to all events",
                    "items": {
                      "type": "string",
                      "enum": [
                        "patient.created",
                        "patient.updated",
                        "patient.deleted",
                        "appointment.created",
                        "appointment.updated",
                        "appointment.deleted",
                        "invoice.created",
                        "invoice.updated",
                        "invoice.deleted",
                        "payment.created",
                        "payment.updated",
                        "payment.deleted"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created subscription, including its secret",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "creationTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "postApiWebhooksubscriptions"
      }
    },
    "/api/webhooksubscriptions/{webhookSubscriptionId}": {
      "put": {
        "tags": [
          "Webhook subscriptions"
        ],
        "summary": "Update a webhook subscription",
        "description": "`url`, `events` and `active` are editable; the secret and clinic are immutable. Re-enabling an auto-disabled endpoint is done by setting `active` back to true.\n",
        "security": [
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "webhookSubscriptionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated subscription (without secret)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "creationTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "putApiWebhooksubscriptionsWebhookSubscriptionId"
      },
      "delete": {
        "tags": [
          "Webhook subscriptions"
        ],
        "summary": "Delete a webhook subscription",
        "security": [
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "webhookSubscriptionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "clinicId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "creationTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "deleteApiWebhooksubscriptionsWebhookSubscriptionId",
        "description": "Delete a webhook subscription"
      }
    }
  },
  "tags": []
}
