{
  "openapi": "3.0.3",
  "info": {
    "title": "Slot API",
    "version": "3.0",
    "contact": {
      "email": "admin@vsee.com"
    },
    "description": "\n\nThe Slot API provides time slot availability for scheduling appointments. Slots are defined by providers and represent available time windows for patient bookings."
  },
  "servers": [
    {
      "url": "https://api.vseepreview.com/api_v3",
      "description": "Staging"
    }
  ],
  "x-readme": {
    "explorer-enabled": false,
    "proxy-enabled": false,
    "samples-languages": [
      "curl",
      "python",
      "javascript",
      "java"
    ]
  },
  "tags": [
    {
      "name": "Slots",
      "description": "Slot and appointment management"
    }
  ],
  "paths": {
    "/slots": {
      "get": {
        "tags": [
          "Slots"
        ],
        "summary": "List slots",
        "description": "Retrieve a list of slots with optional filtering by various criteria",
        "operationId": "listSlots",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "UNIX timestamp for start of range"
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "UNIX timestamp for end of range"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Filter by status. Use 10 for open slots"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "one",
                "group"
              ]
            },
            "description": "Type of slot"
          },
          {
            "name": "provider_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by provider ID"
          },
          {
            "name": "room_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by room code"
          },
          {
            "name": "account_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by account code"
          },
          {
            "name": "specialty_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by specialty ID"
          },
          {
            "name": "states_serviced",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by states serviced"
          }
        ],
        "responses": {
          "200": {
            "description": "List of slots",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Slot"
                      }
                    }
                  }
                },
                "examples": {
                  "success": {
                    "value": {
                      "data": [
                        {
                          "id": "63850640-129c-4e8a-af18-0b9f0a7d64b7",
                          "provider_id": "9046",
                          "account_code": "bac-team",
                          "start": 1669836600,
                          "end": 1669838400,
                          "group_id": "63850640-2cf0-4822-a0bc-0b9f0a7d64b7",
                          "status": 10,
                          "modified": 1669662272,
                          "created": 1669662272,
                          "group": {
                            "id": "63850640-2cf0-4822-a0bc-0b9f0a7d64b7",
                            "date_start": "1669827600",
                            "date_end": "1669913999",
                            "time_start": "1669836600",
                            "time_end": "1669838400",
                            "repeat": false,
                            "repeat_day": [],
                            "repeat_week": 1,
                            "account_code": "bac-team",
                            "provider_id": "9046",
                            "visit_type": "group",
                            "timezone": "Asia/Ho_Chi_Minh"
                          },
                          "provider": {
                            "id": "9046",
                            "username": "bac+provider3@vseelab.com",
                            "email": "bac+provider3@vseelab.com",
                            "vseeid": "bac+provider3@vseelab.com",
                            "full_name": "Bac Provider3 (edited)"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/slots/available": {
      "get": {
        "tags": [
          "Slots"
        ],
        "summary": "Get available slots",
        "description": "Retrieve available slots for booking",
        "operationId": "getAvailableSlots",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          }
        ],
        "responses": {
          "200": {
            "description": "Available slots",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Slot"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/slots/{id}": {
      "delete": {
        "tags": [
          "Slots"
        ],
        "summary": "Delete slot",
        "description": "Delete a single slot by ID",
        "operationId": "deleteSlot",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slot ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Slot deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "slot_deleted": {
                          "type": "integer"
                        },
                        "group_deleted": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "success": {
                    "value": {
                      "data": {
                        "slot_deleted": 1,
                        "group_deleted": 1
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    },
    "/slots/groups/{groupId}": {
      "delete": {
        "tags": [
          "Slots"
        ],
        "summary": "Delete slot group",
        "description": "Delete a slot group and all associated slots",
        "operationId": "deleteSlotGroup",
        "parameters": [
          {
            "name": "X-ApiToken",
            "in": "header",
            "description": "API token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your_api_token"
          },
          {
            "name": "X-AccountCode",
            "in": "header",
            "description": "Account code",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "vclinic"
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slot group ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Slot group deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "slot_deleted": {
                          "type": "integer"
                        },
                        "group_deleted": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "success": {
                    "value": {
                      "data": {
                        "slot_deleted": 2,
                        "group_deleted": 1
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-auth-type": "user-token"
      }
    }
  },
  "components": {
    "schemas": {
      "Slot": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "account_code": {
            "type": "string"
          },
          "start": {
            "type": "integer",
            "format": "int64"
          },
          "end": {
            "type": "integer",
            "format": "int64"
          },
          "group_id": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "modified": {
            "type": "integer",
            "format": "int64"
          },
          "created": {
            "type": "integer",
            "format": "int64"
          },
          "group": {
            "$ref": "#/components/schemas/SlotGroup"
          },
          "provider": {
            "$ref": "#/components/schemas/Provider"
          },
          "account": {
            "$ref": "#/components/schemas/Account"
          }
        }
      },
      "SlotGroup": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "date_start": {
            "type": "string"
          },
          "date_end": {
            "type": "string"
          },
          "time_start": {
            "type": "string"
          },
          "time_end": {
            "type": "string"
          },
          "repeat": {
            "type": "boolean"
          },
          "repeat_day": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "repeat_week": {
            "type": "integer"
          },
          "account_code": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "visit_type": {
            "type": "string"
          },
          "consultation": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "duration": {
                "type": "integer"
              },
              "charge": {
                "type": "boolean"
              },
              "group": {
                "type": "boolean"
              },
              "slots": {
                "type": "integer"
              },
              "amount": {
                "type": "integer"
              },
              "visible_to_patient": {
                "type": "boolean"
              }
            }
          },
          "timezone": {
            "type": "string"
          },
          "modified": {
            "type": "integer",
            "format": "int64"
          },
          "created": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "Provider": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "vseeid": {
            "type": "string"
          },
          "full_name": {
            "type": "string"
          },
          "specialties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "states_serviced": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "clinics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rooms": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Room"
            }
          }
        }
      },
      "Room": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "account_code": {
            "type": "string"
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        }
      }
    }
  }
}