{
  "openapi": "3.0.1",
  "info": {
    "title": "System Admin",
    "description": "This portion of the API provides endpoints for system administration",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.ezyvet.com",
      "description": "ezyVet production environment"
    },
    {
      "url": "https://api.trial.ezyvet.com",
      "description": "ezyVet trial environment"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Hospital",
      "description": "Hospital records — the customer-facing locations that make up an organisation's structure.\n"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://api.ezyvet.com/v1/oauth/access_token",
            "scopes": {
              "read-attachment": "Read attachment resources",
              "read-separation": "Read separation resources",
              "read-systemsetting": "Read system setting resources",
              "read-tag": "Read tag resources",
              "read-tagcategory": "Read tag category resources",
              "read-tagname": "Read tag name resources",
              "read-user": "Read user resources",
              "read-webhookevents": "Read webhook event resources",
              "read-webhooks": "Read webhook resources",
              "user-management": "Manage user accounts and roles",
              "write-attachment": "Create and update attachment resources"
            }
          }
        }
      }
    },
    "parameters": {
      "Hospital-nextToken": {
        "name": "nextToken",
        "in": "query",
        "description": "A token to pass back to the server to get the next page of results.",
        "required": false,
        "style": "form",
        "explode": true,
        "schema": {
          "type": "string"
        },
        "example": "eyJpZCI6MTIzfQ"
      },
      "Hospital-pageSize": {
        "name": "pageSize",
        "in": "query",
        "description": "Sets the number of items to be returned in each page.",
        "required": false,
        "style": "form",
        "explode": true,
        "schema": {
          "type": "integer",
          "default": 2000,
          "maximum": 2000
        },
        "example": 50
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BadRequest"
            }
          }
        }
      },
      "Hospital-BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Hospital-ErrorResponse"
            },
            "examples": {
              "Example": {
                "summary": "",
                "value": {
                  "errors": [
                    {
                      "id": "8954638926413656075_1",
                      "code": "UnsupportedFilter",
                      "target": "businessID"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "Hospital-Forbidden": {
        "description": "Forbidden. The token authenticated but does not carry the scope the operation requires, which is distinct from 401 (the token itself did not authenticate).\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Hospital-ErrorResponse"
            },
            "examples": {
              "Example": {
                "summary": "",
                "value": {
                  "errors": [
                    {
                      "id": "8954638926413656075",
                      "code": "InsufficientScope"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "Hospital-InternalError": {
        "description": "Internal error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Hospital-ErrorResponse"
            }
          }
        }
      },
      "Hospital-NotFound": {
        "description": "Not Found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Hospital-ErrorResponse"
            },
            "examples": {
              "Example": {
                "summary": "",
                "value": {
                  "errors": [
                    {
                      "id": "8954638926413656075_1",
                      "code": "HospitalNotFound"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "Hospital-TooManyRequests": {
        "description": "Too Many Requests",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Hospital-ErrorResponse"
            }
          }
        }
      },
      "Hospital-Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Hospital-ErrorResponse"
            }
          }
        }
      },
      "Hospital-UnprocessableEntity": {
        "description": "Unprocessable Entity",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Hospital-ErrorResponse"
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_5JBMuXC69QQoPpKDFoBow"
                },
                "status": {
                  "type": "string",
                  "example": "500"
                },
                "code": {
                  "type": "string",
                  "example": ""
                },
                "title": {
                  "type": "string",
                  "example": "An internal server error occurred"
                },
                "detail": {
                  "type": "string",
                  "example": "An error occured, please contact API support with the id, status and code provided with the response."
                }
              }
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found",
        "content": {
          "text/html": {
            "schema": {
              "type": "string",
              "example": "No input file specified."
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Too Many Requests",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_5JBMuXC69QQoPpKDFoBow"
                },
                "status": {
                  "type": "string",
                  "example": "429"
                },
                "code": {
                  "type": "string",
                  "example": ""
                },
                "title": {
                  "type": "string",
                  "example": "Too Many Requests"
                },
                "detail": {
                  "type": "string",
                  "example": "Too Many Requests"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "messages": {
                  "type": "array",
                  "items": {
                    "properties": {
                      "level": {
                        "type": "string",
                        "example": "error"
                      },
                      "type": {
                        "type": "string",
                        "example": "InvalidRequestException"
                      },
                      "text": {
                        "type": "string",
                        "example": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \\\"access token\\\" parameter."
                      },
                      "fields": {
                        "type": "array",
                        "example": [],
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Unprocessable Entity",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_5JBMuXC69QQoPpKDFoBow"
                },
                "status": {
                  "type": "string",
                  "example": "422"
                },
                "code": {
                  "type": "string",
                  "example": ""
                },
                "title": {
                  "type": "string",
                  "example": "Unprocessable Entity"
                },
                "detail": {
                  "type": "string",
                  "example": "Unprocessable Entity"
                }
              }
            }
          }
        }
      },
      "ValidationError": {
        "description": "Validation error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "validation_error": {
                "summary": "Validation error with field target",
                "value": {
                  "errors": [
                    {
                      "id": "5280507925319776078",
                      "status": "422",
                      "code": "ValidationError",
                      "target": "/0/name"
                    }
                  ]
                }
              },
              "role_not_found": {
                "summary": "Specified role does not exist",
                "value": {
                  "errors": [
                    {
                      "id": "5280507925319776085",
                      "status": "422",
                      "code": "RoleNotFound",
                      "target": "/0/roles",
                      "detail": "Role \"NonExistentRole\" not found."
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "BadRequest": {
        "description": "Bad Request",
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_3YLvb0V7eXcHqgGauTjDy"
                },
                "status": {
                  "type": "string",
                  "example": "400"
                },
                "code": {
                  "type": "string",
                  "example": "100001"
                },
                "title": {
                  "type": "string",
                  "example": "The authorization grant type is not supported by the authorization server."
                },
                "detail": {
                  "type": "string",
                  "example": "The authorization grant type is not supported by the authorization server."
                }
              }
            }
          }
        }
      },
      "Batchv1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "created_at": {
            "type": "number"
          },
          "modified_at": {
            "type": "number"
          },
          "active": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "parent": {
            "type": "number"
          },
          "expiry": {
            "type": "number"
          }
        }
      },
      "DeleteResponsev1": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object",
            "properties": {
              "timestamp": {
                "type": "string"
              },
              "items_matched": {
                "type": "number"
              },
              "items_processed": {
                "type": "number"
              }
            }
          },
          "items": {
            "type": "array",
            "items": {}
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "An error object",
        "properties": {
          "id": {
            "type": "string",
            "description": "An ID that can be used to trace an error instance. The tracing context ID is recommended.",
            "example": "5280507925319776078"
          },
          "status": {
            "type": "string",
            "description": "HTTP status code as a string",
            "example": "422"
          },
          "code": {
            "type": "string",
            "description": "A unique string throughout the API that represents this type of error",
            "example": "ValidationError"
          },
          "target": {
            "type": "string",
            "description": "JSON pointer to the field that caused the error",
            "example": "/pageSize"
          },
          "detail": {
            "type": "string",
            "description": "A detailed description of the error",
            "example": "An error occurred."
          }
        },
        "required": [
          "id",
          "status",
          "code"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Error response containing an array of error objects",
        "properties": {
          "errors": {
            "type": "array",
            "description": "Array of error objects",
            "items": {
              "$ref": "#/components/schemas/Error"
            },
            "minItems": 1
          }
        },
        "required": [
          "errors"
        ]
      },
      "Hospital-Address": {
        "type": "object",
        "required": [
          "streetLine1",
          "suburb",
          "city",
          "postcode",
          "countryCode"
        ],
        "additionalProperties": false,
        "properties": {
          "streetLine1": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "streetLine2": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "suburb": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "city": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "postcode": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "region": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "state": {
            "type": "string",
            "nullable": true,
            "minLength": 1
          },
          "countryCode": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code.",
            "nullable": true,
            "minLength": 2
          }
        }
      },
      "Hospital-Error": {
        "type": "object",
        "description": "A single error object. Must not contain fields with text intended for UI display to end users. Errors should be programmatically interpretable via the code field.\n",
        "additionalProperties": false,
        "required": [
          "id",
          "code"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "DataDog trace ID for this error, for correlating it with logs. Endpoint errors (400, 404,\n429) suffix a per-response counter — {traceId}_{errorNumber}; router errors (401, 403) are the bare {traceId}.\n",
            "example": "8954638926413656075_1"
          },
          "code": {
            "type": "string",
            "description": "A unique, human-readable string identifying this type of error. Must be unique across the API codebase so a developer can search for it to find the source. Use PascalCase (e.g. HospitalNotFound). Not a numeric code.\n",
            "example": "HospitalNotFound"
          },
          "target": {
            "type": "string",
            "description": "Optional. Names the single input at fault, and is omitted whenever no one input is.\n\nPrimarily a write-request concept: on POST/PUT/PATCH it names the request-body field that failed validation. This API is read-only, so the only error that sets it is the list endpoint's UnsupportedFilter, naming the offending query parameter.\n",
            "example": "businessID"
          }
        },
        "example": {
          "id": "8954638926413656075_1",
          "code": "HospitalNotFound"
        }
      },
      "Hospital-ErrorResponse": {
        "type": "object",
        "description": "Error response structure wrapping errors in an array.",
        "required": [
          "errors"
        ],
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Hospital-Error"
            }
          }
        }
      },
      "Hospital-Hospital": {
        "type": "object",
        "required": [
          "id",
          "businessId",
          "name",
          "address",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier for the Hospital.",
            "readOnly": true,
            "example": "hospital_01HZY8Z7Q8K2N4X7QY2S8M3J7A"
          },
          "businessId": {
            "type": "string",
            "description": "Business ID"
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "address": {
            "$ref": "#/components/schemas/Hospital-Address"
          },
          "email": {
            "type": "string",
            "format": "email",
            "nullable": true
          },
          "website": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          },
          "faxNumber": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "description": "Hospital status",
            "readOnly": true,
            "enum": [
              "active",
              "disabled",
              "merged"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "description": "The ISO 8601 timestamp when the record was created.",
            "example": "2024-01-15T10:30:00Z"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "nullable": true,
            "description": "The ISO 8601 timestamp when the record was last updated.",
            "example": "2024-12-20T14:22:00Z"
          }
        }
      },
      "Hospital-HospitalResponse": {
        "type": "object",
        "description": "Response envelope for the list endpoint (GET /v4/hospital) only. Includes meta (nextToken), data (array of Hospital), and errors.\n",
        "required": [
          "data",
          "errors"
        ],
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/Hospital-Meta"
          },
          "data": {
            "type": "array",
            "description": "Array of Hospital objects.",
            "items": {
              "$ref": "#/components/schemas/Hospital-Hospital"
            }
          },
          "errors": {
            "type": "array",
            "description": "Array of error objects. Empty on success.",
            "items": {
              "$ref": "#/components/schemas/Hospital-Error"
            }
          }
        }
      },
      "Hospital-HospitalSingleResponse": {
        "type": "object",
        "description": "Success envelope for GET /v4/hospital/{id}. `data` is the Hospital object directly (not an array). `meta` is omitted (no pagination for a single resource). `errors` is always present on the wire and is `[]` on success.\n",
        "required": [
          "data",
          "errors"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Hospital-Hospital"
          },
          "errors": {
            "type": "array",
            "description": "Array of error objects. Empty on success.",
            "items": {
              "$ref": "#/components/schemas/Hospital-Error"
            }
          }
        }
      },
      "Hospital-Meta": {
        "type": "object",
        "description": "Metadata present in all responses. Contains pagination token for list endpoints.",
        "properties": {
          "nextToken": {
            "type": "string",
            "description": "Token for fetching the next page of results. Null or omitted when no more pages exist.",
            "nullable": true,
            "example": "eyJpZCI6MTIzfQ"
          }
        }
      },
      "Metav1": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string"
          },
          "items_page": {
            "type": "string"
          },
          "items_page_total": {
            "type": "string"
          },
          "items_page_size": {
            "type": "string"
          },
          "items_total": {
            "type": "string"
          }
        }
      },
      "Responsev1": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/Metav1"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StockAdjustmentItemv1"
            }
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RolesListResponse": {
        "type": "object",
        "description": "Response wrapper for a list of active role names",
        "properties": {
          "data": {
            "type": "array",
            "description": "Array of active role names as strings",
            "items": {
              "type": "string"
            },
            "example": [
              "Veterinarian",
              "Practice Manager",
              "Receptionist"
            ]
          }
        },
        "required": [
          "data"
        ]
      },
      "SiteInformationv3": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "example": "site_jkjBWPng4gFTqRxYkomWU",
                "description": "Used when generating an access token."
              },
              "type": {
                "type": "string",
                "example": "siteInformation"
              },
              "attributes": {
                "type": "object",
                "properties": {
                  "prefix": {
                    "type": "string",
                    "example": "apisandbox"
                  },
                  "practiceType": {
                    "type": "string",
                    "example": "Mixed Practice"
                  },
                  "version": {
                    "type": "number",
                    "format": "float",
                    "example": 40.1
                  }
                }
              },
              "relationships": {
                "type": "object",
                "properties": {
                  "timezone": {
                    "type": "object",
                    "properties": {
                      "links": {
                        "type": "object",
                        "properties": {
                          "related": {
                            "type": "string",
                            "example": 94
                          }
                        }
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "example": "timezone"
                          },
                          "id": {
                            "type": "string",
                            "example": 94
                          }
                        }
                      }
                    }
                  }
                }
              },
              "included": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": 94
                    },
                    "type": {
                      "type": "string",
                      "example": "timezone"
                    },
                    "attributes": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "example": "America/Chicago"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "StockAdjustmentItemv1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "created_at": {
            "type": "number"
          },
          "modified_at": {
            "type": "number"
          },
          "active": {
            "type": "boolean"
          },
          "stockadjustment_id": {
            "type": "number"
          },
          "product_id": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "price": {
            "type": "number"
          },
          "ledger_account": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "Pending",
              "Allocated",
              "Finalised"
            ]
          },
          "batch": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Batchv1"
            }
          },
          "location_id": {
            "type": "number"
          }
        }
      },
      "SystemSettingResponsev1": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object",
            "properties": {
              "timestamp": {
                "type": "string"
              },
              "items_page": {
                "type": "string"
              },
              "items_page_total": {
                "type": "string"
              },
              "items_page_size": {
                "type": "string"
              },
              "items_total": {
                "type": "string"
              }
            }
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "systemsetting": {
                  "type": "object",
                  "properties": {
                    "timezone": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "utc_offset": {
                          "type": "string"
                        },
                        "utc_offset_seconds": {
                          "type": "number"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "UserBulkPatchRequest": {
        "type": "object",
        "description": "User data for bulk update (PATCH /api/v4/user/bulk). Requires id field.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier (UID) of the user to update. Required for bulk updates.",
            "example": "user_602aTIeV9XsL0NYzRcy1m"
          },
          "name": {
            "type": "string",
            "description": "Name of person (user's full name)",
            "example": "John Doe"
          },
          "initials": {
            "type": "string",
            "description": "Initials of person's name",
            "example": "JD"
          },
          "email": {
            "type": "string",
            "description": "Contact email for user",
            "example": "johndoe@email.com"
          },
          "login": {
            "type": "string",
            "description": "Login email (must be unique)",
            "example": "joedoe@email.com"
          },
          "password": {
            "type": "string",
            "description": "User password (given raw, stored as hashed).\n\n**Validation Requirements:**\n- Must be at least 8 characters long\n- Must contain at least one number (0-9)\n- Must contain at least one uppercase letter (A-Z)\n- Must contain at least one lowercase letter (a-z)\n",
            "minLength": 8,
            "example": "P@ssw0rd123"
          },
          "resetPassword": {
            "type": "boolean",
            "description": "Whether user must reset password on next login",
            "example": true
          },
          "mobile": {
            "type": "string",
            "description": "Mobile phone number",
            "example": "021 777 8809"
          },
          "registration": {
            "type": "string",
            "description": "User registration number",
            "example": "9731319"
          },
          "qualifications": {
            "type": "string",
            "description": "User qualifications",
            "example": "Qualified"
          },
          "isVet": {
            "type": "boolean",
            "description": "Whether user is a veterinarian",
            "example": true
          },
          "isSalesperson": {
            "type": "boolean",
            "description": "Whether user is a salesperson",
            "example": false
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of role names as strings. The system will look up roles by name.\n- Set to empty array `[]` to remove all roles\n- Maximum 100 roles per user\n",
            "minItems": 0,
            "maxItems": 100,
            "example": [
              "Veterinarian",
              "Practice Manager"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "UserPatchRequest": {
        "type": "object",
        "description": "User data for partial update (single PATCH request). All fields are optional.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of person (user's full name)",
            "example": "John Doe"
          },
          "initials": {
            "type": "string",
            "description": "Initials of person's name",
            "example": "JD"
          },
          "email": {
            "type": "string",
            "description": "Contact email for user",
            "example": "johndoe@email.com"
          },
          "login": {
            "type": "string",
            "description": "Login email (must be unique)",
            "example": "joedoe@email.com"
          },
          "password": {
            "type": "string",
            "description": "User password (given raw, stored as hashed).\n\n**Validation Requirements:**\n- Must be at least 8 characters long\n- Must contain at least one number (0-9)\n- Must contain at least one uppercase letter (A-Z)\n- Must contain at least one lowercase letter (a-z)\n",
            "minLength": 8,
            "example": "P@ssw0rd123"
          },
          "resetPassword": {
            "type": "boolean",
            "description": "Whether user must reset password on next login",
            "example": true
          },
          "mobile": {
            "type": "string",
            "description": "Mobile phone number",
            "example": "021 777 8809"
          },
          "registration": {
            "type": "string",
            "description": "User registration number",
            "example": "9731319"
          },
          "qualifications": {
            "type": "string",
            "description": "User qualifications",
            "example": "Qualified"
          },
          "isVet": {
            "type": "boolean",
            "description": "Whether user is a veterinarian",
            "example": true
          },
          "isSalesperson": {
            "type": "boolean",
            "description": "Whether user is a salesperson",
            "example": false
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of role names as strings. The system will look up roles by name.\n- Set to empty array `[]` to remove all roles\n- Maximum 100 roles per user\n",
            "minItems": 0,
            "maxItems": 100,
            "example": [
              "Veterinarian",
              "Practice Manager"
            ]
          }
        }
      },
      "UserRequest": {
        "type": "object",
        "description": "User data for creation (POST requests)",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of person (user's full name). Required for user creation.",
            "example": "John Doe"
          },
          "initials": {
            "type": "string",
            "description": "Initials of person's name",
            "example": "JD"
          },
          "email": {
            "type": "string",
            "description": "Contact email for user",
            "example": "johndoe@email.com"
          },
          "login": {
            "type": "string",
            "description": "Login email (must be unique). Required for user creation.",
            "example": "joedoe@email.com"
          },
          "password": {
            "type": "string",
            "description": "User password (given raw, stored as hashed, not returned in responses).\n\n**Validation Requirements:**\n- Must be at least 8 characters long\n- Must contain at least one number (0-9)\n- Must contain at least one uppercase letter (A-Z)\n- Must contain at least one lowercase letter (a-z)\n",
            "minLength": 8,
            "example": "P@ssw0rd123"
          },
          "resetPassword": {
            "type": "boolean",
            "description": "Whether user must reset password on next login",
            "example": true
          },
          "mobile": {
            "type": "string",
            "description": "Mobile phone number",
            "example": "021 777 8809"
          },
          "registration": {
            "type": "string",
            "description": "User registration number",
            "example": "9731319"
          },
          "qualifications": {
            "type": "string",
            "description": "User qualifications",
            "example": "Qualified"
          },
          "isVet": {
            "type": "boolean",
            "description": "Whether user is a veterinarian",
            "example": true
          },
          "isSalesperson": {
            "type": "boolean",
            "description": "Whether user is a salesperson",
            "example": false
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of role names as strings. The system will look up roles by name.\nMaximum 100 roles per user.\n",
            "minItems": 0,
            "maxItems": 100,
            "example": [
              "Veterinarian",
              "Practice Manager"
            ]
          }
        },
        "required": [
          "name",
          "login"
        ]
      },
      "UserResponse": {
        "type": "object",
        "description": "Response wrapper for a single user",
        "properties": {
          "meta": {
            "type": "object",
            "description": "Metadata about the response",
            "properties": {}
          },
          "data": {
            "type": "array",
            "description": "Array containing a single user object",
            "items": {
              "type": "object",
              "properties": {
                "user": {
                  "$ref": "#/components/schemas/UserResponseData"
                }
              }
            },
            "minItems": 1,
            "maxItems": 1
          }
        },
        "required": [
          "meta",
          "data"
        ]
      },
      "UserResponseData": {
        "type": "object",
        "description": "User data as returned in API responses. Note that password is never returned.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier (UID)",
            "example": "user_602aTIeV9XsL0NYzRcy1m"
          },
          "name": {
            "type": "string",
            "description": "Name of person (user's full name)",
            "example": "John Doe"
          },
          "initials": {
            "type": "string",
            "description": "Initials of person's name",
            "example": "JD"
          },
          "email": {
            "type": "string",
            "description": "Contact email for user",
            "example": "johndoe@email.com"
          },
          "login": {
            "type": "string",
            "description": "Login email (must be unique)",
            "example": "joedoe@email.com"
          },
          "resetPassword": {
            "type": "boolean",
            "description": "Whether user must reset password on next login",
            "example": true
          },
          "mobile": {
            "type": "string",
            "description": "Mobile phone number",
            "example": "021 777 8809"
          },
          "registration": {
            "type": "string",
            "description": "User registration number",
            "example": "9731319"
          },
          "qualifications": {
            "type": "string",
            "description": "User qualifications",
            "example": "Qualified"
          },
          "status": {
            "type": "string",
            "description": "Whether user is active, disabled or merged.\n**Note:** This field is read-only and managed internally by the system.\nIt cannot be set when creating users or updated via any API endpoint.\n",
            "enum": [
              "active",
              "disabled",
              "merged"
            ],
            "example": "active"
          },
          "isVet": {
            "type": "boolean",
            "description": "Whether user is a veterinarian",
            "example": true
          },
          "isSalesperson": {
            "type": "boolean",
            "description": "Whether user is a salesperson",
            "example": false
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of role names assigned to the user",
            "minItems": 0,
            "maxItems": 100,
            "example": [
              "Veterinarian",
              "Practice Manager"
            ]
          }
        }
      },
      "UsersListResponse": {
        "type": "object",
        "description": "Response wrapper for a list of users with pagination",
        "properties": {
          "meta": {
            "type": "object",
            "description": "Metadata about the response",
            "properties": {
              "nextToken": {
                "type": "string",
                "description": "Token for fetching the next page of results. Only present if there are more results.",
                "example": "XY9mN4pQr2sT8vW1zA3bC"
              }
            }
          },
          "data": {
            "type": "array",
            "description": "Array of user objects",
            "items": {
              "type": "object",
              "properties": {
                "user": {
                  "$ref": "#/components/schemas/UserResponseData"
                }
              }
            }
          }
        },
        "required": [
          "meta",
          "data"
        ]
      }
    }
  },
  "paths": {
    "/v1/attachment": {
      "get": {
        "summary": "Fetch an Attachment",
        "operationId": "get-attachment",
        "security": [
          {
            "bearerAuth": [
              "read-attachment"
            ]
          }
        ],
        "tags": [
          "Attachment"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The ID number used by the system to uniquely identify an Attachment.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Attachment is active and usable in ezyVet.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "description": "The epoch time when the Attachment was created.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "description": "The epoch time when the Attachment was last modified.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "record_type",
            "in": "query",
            "description": "The record type the Attachment is for. E.g. Animal, Contact, Consult.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "record_id",
            "in": "query",
            "description": "The ID number of the record the Attachment is linked to.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "attachment": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "file_id": {
                                "type": "string",
                                "description": "The ID number of the File linked to the Attachment"
                              },
                              "file_download_url": {
                                "type": "string",
                                "description": "The URL of the file that if you make a GET request to will download the file."
                              },
                              "record_type": {
                                "type": "string",
                                "description": "The record type the Attachment is for."
                              },
                              "record_id": {
                                "type": "string",
                                "description": "The ID number of the record the Attachment is linked to."
                              },
                              "mime_type": {
                                "type": "string",
                                "description": "Multipurpose Internet Mail Extension type. Identifies the format of the Attachment"
                              },
                              "name": {
                                "type": "string"
                              },
                              "primary_image": {
                                "type": "string",
                                "description": "If true, the Attachment is the primary image for the linked record."
                              },
                              "notes": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "summary": "Creates a single Attachment",
        "description": "Creates a single Attachment that links to a Consult with an ID of `1`.",
        "operationId": "create-attachment",
        "tags": [
          "Attachment"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "record_type": {
                    "type": "string",
                    "description": "The record type the Attachment is for. E.g. Animal, Contact, Consult."
                  },
                  "record_id": {
                    "type": "number",
                    "description": "The ID number of the record the Attachment is linked to."
                  },
                  "notes": {
                    "type": "string",
                    "description": "Notes that are related to the Attachment"
                  },
                  "file_data": {
                    "type": "string",
                    "format": "binary",
                    "description": "The data of the file."
                  },
                  "file_id": {
                    "type": "string",
                    "description": "Create an Attachment using an existing file in ezyVet."
                  }
                },
                "required": [
                  "record_type",
                  "record_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "attachment": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "file_id": {
                                "type": "string"
                              },
                              "file_download_url": {
                                "type": "string"
                              },
                              "mime_type": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "primary_image": {
                                "type": "boolean"
                              },
                              "notes": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-attachment"
            ]
          }
        ]
      }
    },
    "/v1/attachment/download/{id}": {
      "get": {
        "summary": "Downloads the file from the attachment",
        "description": "Use the URL that is returned in the `file_download_url` field when making a GET to the `v1/attachment` endpoint.",
        "operationId": "download-attachment",
        "tags": [
          "Attachment"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Attachment ID",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful download of the attachment",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Attachment not found"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-attachment"
            ]
          }
        ]
      }
    },
    "/v1/attachment/{id}": {
      "patch": {
        "operationId": "update-attachment",
        "summary": "Updates an Attachment",
        "tags": [
          "Attachment"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID number used by the system to uniquely identify an Attachment",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "record_type",
            "in": "query",
            "description": "The record type the Attachment is for. E.g. Animal, Contact, Consult.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "record_id",
            "in": "query",
            "description": "The ID number of the record the Attachment is linked to.",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "notes",
            "in": "query",
            "description": "Notes that are related to the Attachment",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Attachment is active and usable in ezyVet.",
            "required": true,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/merge-patch+json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string"
                  },
                  "record_type": {
                    "type": "string"
                  },
                  "record_id": {
                    "type": "number"
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "record_type",
                  "record_id",
                  "notes",
                  "active"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful update",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "modified_at": {
                      "type": "string"
                    },
                    "file_id": {
                      "type": "string"
                    },
                    "file_download_url": {
                      "type": "string"
                    },
                    "mime_type": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "primary_image": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "active",
                    "created_at",
                    "modified_at",
                    "file_id",
                    "file_download_url",
                    "mime_type",
                    "name",
                    "primary_image",
                    "notes"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-attachment"
            ]
          }
        ]
      },
      "delete": {
        "summary": "Delete an Attachment",
        "tags": [
          "Attachment"
        ],
        "operationId": "delete-attachment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the attachment to delete",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "Bearer token for authentication",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Attachment deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResponsev1"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-attachment"
            ]
          }
        ]
      }
    },
    "/v1/file": {
      "post": {
        "summary": "Create a File",
        "description": "NOTE: It's recommended to use the attachment endpoint",
        "operationId": "create-file",
        "tags": [
          "File"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file_data": {
                    "type": "string",
                    "format": "binary"
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "file_data"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "file": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "size": {
                                "type": "string"
                              },
                              "mime_type": {
                                "type": "string"
                              },
                              "notes": {
                                "type": "string"
                              },
                              "file_download_url": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-file"
            ]
          }
        ]
      }
    },
    "/v1/file/{id}": {
      "get": {
        "summary": "Fetch a File",
        "operationId": "get-file",
        "description": "NOTE: It's recommended to use the attachment endpoint",
        "tags": [
          "File"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        },
                        "transaction_id": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "file": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "size": {
                                "type": "string"
                              },
                              "mime_type": {
                                "type": "string"
                              },
                              "notes": {
                                "type": "string"
                              },
                              "file_download_url": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-attachment"
            ]
          }
        ]
      }
    },
    "/v1/separation": {
      "get": {
        "summary": "Fetch a list of separations",
        "deprecated": true,
        "description": "Its recommended to use the [`v2/separation endpoint`](#get-separationv2)",
        "operationId": "get-separations",
        "tags": [
          "Separation"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The ID number used by the system to uniquely identify a Separation."
          },
          {
            "name": "active",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "If true, the Separation is active and usable in ezyVet."
          },
          {
            "name": "created_at",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The epoch time when the Separation was created."
          },
          {
            "name": "modified_at",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The epoch time when the Separation was last modified."
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The name of the Separation."
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "Database",
                "Business",
                "Division",
                "Location"
              ]
            },
            "description": "The type of Separation: Database, Business, Division or Location."
          },
          {
            "name": "parent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The ID of the parent Separation. Note, a Database has no parent."
          },
          {
            "name": "contact_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The ID of the Contact containing business details for this Separation."
          }
        ],
        "responses": {
          "200": {
            "description": "A list of separations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Responsev1"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-separation"
            ]
          }
        ]
      }
    },
    "/v1/systemsetting": {
      "get": {
        "summary": "Get the SystemSettings",
        "operationId": "get-settings",
        "tags": [
          "System Settings"
        ],
        "description": "Returns the SystemSetting of the specified site.",
        "security": [
          {
            "bearerAuth": [
              "read-systemsetting"
            ]
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemSettingResponsev1"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/tag": {
      "get": {
        "summary": "Fetch a list of Tags",
        "operationId": "get-tags",
        "tags": [
          "Tag"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The ID number used by the system to uniquely identify a Tag.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Tag is active and usable in ezyVet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "description": "The epoch time when the Tag was created.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "description": "The epoch time when the Tag was last modified.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "The name of the Tag.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "associated_id",
            "in": "query",
            "description": "The ID of the record to which this Tag is associated.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "associated_type",
            "in": "query",
            "description": "The name of the entity object to which this Tag is associated.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category_id",
            "in": "query",
            "description": "The ID of the TagCategory to which this Tag belongs.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Tags",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tag": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "associated_id": {
                                "type": "string"
                              },
                              "associated_type": {
                                "type": "string"
                              },
                              "category_id": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-tag"
            ]
          }
        ]
      }
    },
    "/v1/tagcategory": {
      "get": {
        "summary": "Fetch a list of Tag Categories",
        "operationId": "get-tagcategories",
        "tags": [
          "Tag Category"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Tag Categories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tagcategory": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-tagcategory"
            ]
          }
        ]
      }
    },
    "/v1/tagname": {
      "get": {
        "summary": "Fetches a list containing Tag Names",
        "operationId": "get-tagname",
        "tags": [
          "Tag Name"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The ID number used by the system to uniquely identify a Tag Name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "description": "The epoch time when the Tag Name was created.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "description": "The epoch time when the Tag Name was last modified.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Tag Name is active and usable in ezyVet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category_id",
            "in": "query",
            "description": "The ID of the Tag Category the Tag Name is part of.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Tag Names",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tagname": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "modified_at": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "category_id": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-tagname"
            ]
          }
        ]
      }
    },
    "/v1/user": {
      "get": {
        "summary": "Fetch a list of ezyVet users",
        "operationId": "get-user",
        "tags": [
          "User"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The ID number used by the system to uniquely identify a User.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the User is active and usable in ezyVet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "description": "The epoch time when the User was created.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "description": "The epoch time when the User was last modified.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "The name of the User.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "query",
            "description": "The code of the User.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_vet",
            "in": "query",
            "description": "If true, the User is a vet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_salesperson",
            "in": "query",
            "description": "If true, the User is a salesperson.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_dev",
            "in": "query",
            "description": "If true, the User is an internal ezyVet user. When querying the API, set this field to '0'.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limits the number of items returned.",
            "schema": {
              "type": "string",
              "default": 10
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Specifies the page number of the result.",
            "schema": {
              "type": "string",
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Users",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "active": {
                                "type": "string"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "name": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "is_vet": {
                                "type": "string"
                              },
                              "is_salesperson": {
                                "type": "string"
                              },
                              "is_dev": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-user"
            ]
          }
        ]
      }
    },
    "/v1/webhookevents": {
      "get": {
        "summary": "Fetch a list of WebHookEvents",
        "operationId": "get-webhookevents",
        "tags": [
          "Webhook Events"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "A JSON object containing the list of WebHookEvents.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "transaction_id",
                        "timestamp"
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "webhookevents": {
                            "example": [
                              "appointment_created",
                              "appointment_updated",
                              "product_created",
                              "product_updated",
                              "user_created",
                              "user_updated",
                              "consult_created",
                              "consult_updated",
                              "therapeutic_created",
                              "therapeutic_updated",
                              "therapeutic_disabled",
                              "default_billing_trigger_created",
                              "default_billing_trigger_updated",
                              "default_billing_trigger_disabled",
                              "bundle_created",
                              "bundle_updated",
                              "bundle_disabled"
                            ],
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "webhookevents"
                        ]
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  },
                  "required": [
                    "meta",
                    "items",
                    "messages"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-webhookevents"
            ]
          }
        ]
      }
    },
    "/v1/webhooks": {
      "get": {
        "summary": "Fetch a list of Webhooks",
        "operationId": "get-webhook",
        "tags": [
          "Webhook"
        ],
        "description": "Fetch a Webhook.",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The ID number used by the system to uniquely identify a Webhook."
          },
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "If true, the Webhook is active and will cause the webhook_url to receive data upon events being fired."
          },
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The name of the subscribed event. Each event is prefixed with a data type (endpoint) followed by the name of the event associated to that data type."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_page": {
                          "type": "number"
                        },
                        "items_page_total": {
                          "type": "number"
                        },
                        "items_page_size": {
                          "type": "number"
                        },
                        "items_total": {
                          "type": "number"
                        },
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "webhooks": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "webhook_url": {
                                "type": "string"
                              },
                              "event": {
                                "type": "string"
                              },
                              "fields": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-webhooks"
            ]
          }
        ]
      },
      "post": {
        "summary": "Create a Webhook",
        "operationId": "create-webhook",
        "tags": [
          "Webhook"
        ],
        "description": "Subscribe to a webhook event. ezyVet will send the object to the set webhook_url when the event is triggered.",
        "security": [
          {
            "bearerAuth": [
              "write-webhook"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "webhook_url": {
                    "type": "string",
                    "format": "url",
                    "example": "https://my-webhook-url.com/appointment_created",
                    "description": "This is where a fired event will push the data. Ensure this URL is correct and points to the desired location. In order to build a form of authentication into the webhook, simply add on query parameters to the URL. These query parameters will be sent when sending data to the webhook, allowing you to perform crude authentication."
                  },
                  "event": {
                    "type": "string",
                    "example": "appointment_created",
                    "description": "Each event is prefixed with a data type (endpoint) followed by the name of the event associated to that data type. I.e. when an Appointment is created in ezyVet, an appointment_created event will be fired."
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "example": "uid"
                    },
                    "description": "A subset of fields. The WebHook push data will only contain the subset of fields specified here. If the array is empty, all fields will be sent. If the webhook data contains nested values, then you may receive a subset of the nested data as well by specifying a string like appointment.created_at, assuming appointment is the name of a field which contains a nested object."
                  },
                  "active": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "WebHook created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "webhooks": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "webhook_url": {
                                "type": "string",
                                "format": "url"
                              },
                              "event": {
                                "type": "string"
                              },
                              "fields": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "delete": {
        "summary": "Delete a Webhook",
        "operationId": "delete-webhook",
        "tags": [
          "Webhook"
        ],
        "description": "Deletes a WebHook by ID. This is a soft delete, which disables the webhook.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": [
              "write-webhook"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "webhooks": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "webhook_url": {
                                "type": "string",
                                "format": "uri"
                              },
                              "event": {
                                "type": "string"
                              },
                              "fields": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "summary": "Update a Webhook",
        "operationId": "update-webhook",
        "security": [
          {
            "bearerAuth": [
              "write-webhook"
            ]
          }
        ],
        "tags": [
          "Webhook"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the WebHook is active and will cause the webhook_url to receive data upon events being fired.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "webhook_url",
            "in": "query",
            "description": "The WebHook URL. This is where a fired event will push the data.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "event",
            "in": "query",
            "description": "The name of the subscribed event.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "A subset of fields. The WebHook push data will only contain the subset of fields specified here.",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "requestBody": {
          "description": "Data to update a WebHook",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "active": {
                    "type": "boolean"
                  },
                  "webhook_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "event": {
                    "type": "string"
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "webhooks": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "webhook_url": {
                                "type": "string",
                                "format": "uri"
                              },
                              "event": {
                                "type": "string"
                              },
                              "fields": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v2/separation": {
      "get": {
        "summary": "Fetch a Separation list",
        "description": "Fetches a list containing Separations.\nSeparations are a complex part of the ezyVet API and is important to understand. \nPlease read [this document](./guides/understanding-separations) to ensure you have an adequate understanding.",
        "operationId": "get-separationv2",
        "tags": [
          "Separation V2"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The ID number used by the system to uniquely identify a [`Separation`](#separation-v2)."
          },
          {
            "name": "uid",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The ID number used by the system to uniquely identify a [`Separation`](#separation-v2) across all ezyVet sites."
          },
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "If **true**, the [`Separation`](#separation-v2) is active and usable in ezyVet."
          },
          {
            "name": "created_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the [`Separation`](#separation-v2) was created."
          },
          {
            "name": "modified_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the [`Separation`](#separation-v2) was last modified."
          }
        ],
        "responses": {
          "200": {
            "description": "A list of separations",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_page": {
                          "type": "number",
                          "description": "The current page of results.",
                          "example": 1
                        },
                        "items_page_total": {
                          "type": "number",
                          "description": "The total number of pages available.",
                          "example": 1
                        },
                        "items_page_size": {
                          "type": "number",
                          "description": "The number of items returned on the current page.",
                          "example": 22
                        },
                        "items_total": {
                          "type": "string",
                          "description": "The total number of items matching the query.",
                          "example": "22"
                        },
                        "transaction_id": {
                          "type": "string",
                          "description": "A unique identifier for this API transaction, useful for debugging.",
                          "example": "1100a12e183faeddac0700d881141b54475b6cc4b92fd757cdeba1db2f734ab0"
                        },
                        "timestamp": {
                          "type": "number",
                          "description": "Epoch timestamp (Unix seconds) when the response was generated.",
                          "example": 1780020859
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "separation": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number",
                                "description": "The unique ID of the separation.",
                                "example": 4
                              },
                              "uid": {
                                "type": "string",
                                "description": "The globally unique identifier of the separation, consistent across all ezyVet sites.",
                                "example": "ownershipSeparation_d01oHZu5uCuy0VdOgAn23"
                              },
                              "created_at": {
                                "type": "number",
                                "description": "Epoch timestamp (Unix seconds) when the separation was created.",
                                "example": 1419765339
                              },
                              "modified_at": {
                                "type": "number",
                                "description": "Epoch timestamp (Unix seconds) when the separation was last modified.",
                                "example": 1747002038
                              },
                              "active": {
                                "type": "boolean",
                                "description": "Whether the separation is active and usable in ezyVet.",
                                "example": true
                              },
                              "name": {
                                "type": "string",
                                "description": "The display name of the separation.",
                                "example": "Death Star Emergency"
                              },
                              "type": {
                                "type": "string",
                                "description": "The level of the separation within the ezyVet hierarchy.",
                                "enum": [
                                  "database",
                                  "business",
                                  "division",
                                  "location"
                                ],
                                "example": "division"
                              },
                              "parent": {
                                "type": "number",
                                "nullable": true,
                                "description": "The ID of the parent separation. Null for the top-level database separation.",
                                "example": 16
                              },
                              "child": {
                                "type": "number",
                                "nullable": true,
                                "description": "The ID of the first child separation. Null for location-type separations, which have no children.",
                                "example": 5
                              },
                              "separation_type": {
                                "type": "string",
                                "description": "A sub-classification of the separation. Empty string if no sub-classification applies.",
                                "enum": [
                                  "Hospital",
                                  "Department",
                                  ""
                                ],
                                "example": "Department"
                              },
                              "hospital_uid": {
                                "type": "string",
                                "description": "The UID of the hospital this separation belongs to. Present on division and location type separations.",
                                "example": "hospital_tGRMQ8HgPJpEDSRYNJb8E"
                              },
                              "derived_hospital_uid": {
                                "type": "string",
                                "description": "The UID of the hospital derived from this separation. Present on business type separations only.",
                                "example": "hospital_tGRMQ8HgPJpEDSRYNJb8E"
                              },
                              "contact_id": {
                                "type": "number",
                                "description": "The ID of the contact associated with this separation.",
                                "example": 3
                              },
                              "contact_uid": {
                                "type": "string",
                                "description": "The UID of the contact associated with this separation.",
                                "example": "contact_lg1jdmDnObgYMCjwG2cuD"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                },
                "examples": {
                  "separation_list": {
                    "summary": "A list of separations across multiple hospitals",
                    "value": {
                      "meta": {
                        "items_page": 1,
                        "items_page_total": 1,
                        "items_page_size": 22,
                        "items_total": "22",
                        "transaction_id": "1100a12e183faeddac0700d881141b54475b6cc4b92fd757cdeba1db2f734ab0",
                        "timestamp": 1780020859
                      },
                      "items": [
                        {
                          "separation": {
                            "id": 1,
                            "uid": "ownershipSeparation_d01oHZu5uCuy0VdOgAn23",
                            "created_at": 1419765339,
                            "modified_at": 1747002038,
                            "active": true,
                            "name": "Galaxy Vets",
                            "type": "database",
                            "parent": null,
                            "child": 16,
                            "separation_type": "Department",
                            "contact_id": 3,
                            "contact_uid": "contact_lg1jdmDnObgYMCjwG2cuD"
                          }
                        },
                        {
                          "separation": {
                            "id": 16,
                            "uid": "ownershipSeparation_9V0WG0BiBouk5tB70qafg",
                            "created_at": 1747002038,
                            "modified_at": 1774561844,
                            "active": true,
                            "name": "Death Star Vets BU",
                            "type": "business",
                            "parent": 1,
                            "child": 3,
                            "separation_type": "Hospital",
                            "derived_hospital_uid": "hospital_tGRMQ8HgPJpEDSRYNJb8E",
                            "contact_id": 3,
                            "contact_uid": "contact_lg1jdmDnObgYMCjwG2cuD"
                          }
                        },
                        {
                          "separation": {
                            "id": 4,
                            "uid": "ownershipSeparation_cAl0DAnmH0C1EqVw0souz",
                            "created_at": 1641839727,
                            "modified_at": 1756258352,
                            "active": true,
                            "name": "Death Star Emergency",
                            "type": "division",
                            "parent": 16,
                            "child": 5,
                            "separation_type": "Department",
                            "hospital_uid": "hospital_tGRMQ8HgPJpEDSRYNJb8E",
                            "contact_id": 3,
                            "contact_uid": "contact_lg1jdmDnObgYMCjwG2cuD"
                          }
                        },
                        {
                          "separation": {
                            "id": 5,
                            "uid": "ownershipSeparation_9K8oZgeaLT0AEctz3KtwC",
                            "created_at": 1571345127,
                            "modified_at": 1756258352,
                            "active": true,
                            "name": "Death Star Emergency Inventory",
                            "type": "location",
                            "parent": 4,
                            "child": null,
                            "separation_type": "",
                            "hospital_uid": "hospital_tGRMQ8HgPJpEDSRYNJb8E",
                            "contact_id": 3,
                            "contact_uid": "contact_lg1jdmDnObgYMCjwG2cuD"
                          }
                        }
                      ],
                      "messages": []
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-separation"
            ]
          }
        ]
      }
    },
    "/v2/separation/withprimaryinventorylocation": {
      "get": {
        "summary": "Fetch a Separation list",
        "description": "Fetches a list containing Separations with a reference to the separation's primary inventory location",
        "operationId": "get-separationv2inv",
        "tags": [
          "Separation V2"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The ID number used by the system to uniquely identify a [`Separation`](#separation-v2)."
          },
          {
            "name": "uid",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The ID number used by the system to uniquely identify a [`Separation`](#separation-v2) across all ezyVet sites."
          },
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "If **true**, the [`Separation`](#separation-v2) is active and usable in ezyVet."
          },
          {
            "name": "created_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the [`Separation`](#separation-v2) was created."
          },
          {
            "name": "modified_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the [`Separation`](#separation-v2) was last modified."
          }
        ],
        "responses": {
          "200": {
            "description": "A list of separations",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "string"
                        },
                        "items_page": {
                          "type": "string"
                        },
                        "items_page_total": {
                          "type": "string"
                        },
                        "items_page_size": {
                          "type": "string"
                        },
                        "items_total": {
                          "type": "string"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "separation": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number",
                                "example": 3
                              },
                              "uid": {
                                "type": "string",
                                "example": "ownershipSeparation_d01oHZu5uCuy0VdOgAn23"
                              },
                              "created_at": {
                                "type": "number",
                                "example": 1419765339
                              },
                              "modified_at": {
                                "type": "number",
                                "example": 1419765339
                              },
                              "active": {
                                "type": "boolean",
                                "example": true
                              },
                              "name": {
                                "type": "string",
                                "example": "Clinic ABC"
                              },
                              "type": {
                                "type": "string",
                                "example": "division"
                              },
                              "parent": {
                                "type": "string",
                                "example": 16
                              },
                              "child": {
                                "type": "number",
                                "example": 5
                              },
                              "separation_type": {
                                "type": "string",
                                "example": "Hospital",
                                "description": "Indicates the type of the separation."
                              },
                              "hospital_uid": {
                                "type": "string",
                                "example": "hospital_tGRMQ8HgPJpEDSRYNJb8E",
                                "description": "The uid of the hospital the separation record belongs to."
                              },
                              "primary_inventory_location_uid": {
                                "type": "string",
                                "example": "ownershipSeparation_kdVGF0x4dmXenYBCUcITU"
                              },
                              "contact_id": {
                                "type": "number",
                                "example": "3"
                              },
                              "contact_uid": {
                                "type": "string",
                                "example": "contact_lg1jdmDnObgYMCjwG2cuD"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-separation"
            ]
          }
        ]
      }
    },
    "/v3/siteInformation": {
      "servers": [
        {
          "url": "https://ezyvet-site-url/api"
        }
      ],
      "get": {
        "security": [
          {
            "bearerAuth": [
              "read-systemsetting"
            ]
          }
        ],
        "operationId": "get-siteinfo",
        "tags": [
          "Site Information"
        ],
        "summary": "Get site information",
        "description": "Gets site information pertaining to the site specified in the request URL.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteInformationv3"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v4/user": {
      "get": {
        "summary": "List all users",
        "description": "Retrieve a paginated list of all users using token-based pagination.\n\n**Pagination:**\n- Use the `pageSize` parameter to control the number of items returned per page (default: 500, max: 500)\n- Use the `nextToken` parameter from the response `meta` object to fetch the next page\n- The `nextToken` will be omitted from the `meta` object when there are no more pages available\n",
        "operationId": "list-usersv4",
        "tags": [
          "User V4"
        ],
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "description": "Maximum number of users to return per page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 500
            }
          },
          {
            "name": "nextToken",
            "in": "query",
            "description": "Token for fetching the next page of results. Obtained from the `nextToken` field in the response meta object.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "eyJpZCI6InVzZXJfNjAyYVRJZVY5WHNMME5ZelJjeTFtIn0"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter users by status (active or disabled)",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "disabled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Users retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsersListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "user-management"
            ]
          }
        ]
      },
      "post": {
        "summary": "Create a single user",
        "description": "Create a new user. For creating multiple users, use the bulk endpoint at `/api/v4/user/bulk`.\n\n**Status:**\n- The `status` field cannot be set when creating a user. All users are created with status `active` by default.\n\n**Password Validation:**\n- If provided, the password must be at least 8 characters long\n- Must contain at least one number (0-9)\n- Must contain at least one uppercase letter (A-Z)\n- Must contain at least one lowercase letter (a-z)\n\n**Roles:**\n- The `roles` array should contain role names as strings. The system will look up roles by name.\n",
        "operationId": "create-user",
        "tags": [
          "User V4"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserRequest"
              },
              "examples": {
                "minimal_user": {
                  "summary": "Minimal user",
                  "value": {
                    "name": "John Doe",
                    "login": "johndoe@email.com"
                  }
                },
                "full_details_user": {
                  "summary": "User with full details",
                  "value": {
                    "name": "Jane Doe",
                    "initials": "JD",
                    "email": "janedoe@email.com",
                    "login": "janedoe@email.com",
                    "password": "P@ssword123",
                    "resetPassword": false,
                    "mobile": "021 777 8809",
                    "registration": "9731319",
                    "qualifications": "Qualified",
                    "isVet": true,
                    "isSalesperson": false,
                    "roles": [
                      "Veterinarian",
                      "Practice Manager"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "User created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "user-management"
            ]
          }
        ]
      }
    },
    "/v4/user/{id}": {
      "get": {
        "summary": "Get a user by ID",
        "description": "Retrieve a single user by their unique identifier.\n",
        "operationId": "get-userv4",
        "tags": [
          "User V4"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Unique identifier (UID) of the user",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "user_602aTIeV9XsL0NYzRcy1m"
          }
        ],
        "responses": {
          "200": {
            "description": "User retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "user-management"
            ]
          }
        ]
      },
      "patch": {
        "summary": "Update a user by ID",
        "description": "Partially update a user by their unique identifier. Only provided fields will be updated.\n\n**Note:** The `status` field cannot be updated via this API endpoint.\n\n**Password Validation:**\n- If provided, the password must be at least 8 characters long\n- Must contain at least one number (0-9)\n- Must contain at least one uppercase letter (A-Z)\n- Must contain at least one lowercase letter (a-z)\n\n**Role Updates:**\n- If `roles` is set to an empty array `[]`, all roles will be removed from the user.\n- If `roles` is provided as a non-empty array, the user's roles will be replaced with the roles in the array (roles not in the array will be removed, and new roles will be added).\n- If `roles` is not provided, existing roles will remain unchanged.\n- The `roles` array should contain role names as strings. The system will look up roles by name.\n",
        "operationId": "update-user",
        "tags": [
          "User V4"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Unique identifier (UID) of the user",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "user_602aTIeV9XsL0NYzRcy1m"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserPatchRequest"
              },
              "examples": {
                "update_roles": {
                  "summary": "Update user roles and details",
                  "value": {
                    "name": "John Smith",
                    "roles": [
                      "Veterinarian",
                      "Practice Manager"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "User updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "user-management"
            ]
          }
        ]
      }
    },
    "/v4/user/bulk": {
      "post": {
        "summary": "Create multiple users (bulk)",
        "description": "Create multiple users in a single request.\n\n**Limits:**\n- Maximum of 100 users per request\n\n**Status:**\n- The `status` field cannot be set when creating users. All users are created with status `active` by default.\n\n**Password Validation:**\n- If provided, the password must be at least 8 characters long\n- Must contain at least one number (0-9)\n- Must contain at least one uppercase letter (A-Z)\n- Must contain at least one lowercase letter (a-z)\n\n**Roles:**\n- The `roles` array should contain role names as strings. The system will look up roles by name.\n",
        "operationId": "create-users-bulk",
        "tags": [
          "User V4"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/UserRequest"
                },
                "minItems": 1,
                "maxItems": 100
              },
              "examples": {
                "minimal_users": {
                  "summary": "Minimal users array",
                  "value": [
                    {
                      "name": "John Doe",
                      "login": "johndoe@email.com"
                    },
                    {
                      "name": "Mary Smith",
                      "login": "mary@example.com"
                    }
                  ]
                },
                "full_details_users": {
                  "summary": "Users with full details",
                  "value": [
                    {
                      "name": "Jane Doe",
                      "initials": "JD",
                      "email": "janedoe@email.com",
                      "login": "janedoe@email.com",
                      "password": "P@ssword123",
                      "resetPassword": false,
                      "mobile": "021 777 8809",
                      "registration": "9731319",
                      "qualifications": "Qualified",
                      "isVet": true,
                      "isSalesperson": false,
                      "roles": [
                        "Veterinarian",
                        "Practice Manager"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Users created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsersListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "user-management"
            ]
          }
        ]
      },
      "patch": {
        "summary": "Update multiple users (bulk)",
        "description": "Update multiple users in a single request. Each user object must include the `id` field to identify which user to update.\n\n**Limits:**\n- Maximum of 100 users per request\n\n**Note:** The `status` field cannot be updated via this API endpoint.\n\n**Password Validation:**\n- If provided, the password must be at least 8 characters long\n- Must contain at least one number (0-9)\n- Must contain at least one uppercase letter (A-Z)\n- Must contain at least one lowercase letter (a-z)\n\n**Role Updates:**\n- If `roles` is set to an empty array `[]`, all roles will be removed from the user.\n- If `roles` is provided as a non-empty array, the user's roles will be replaced with the roles in the array (roles not in the array will be removed, and new roles will be added).\n- If `roles` is not provided, existing roles will remain unchanged.\n- The `roles` array should contain role names as strings. The system will look up roles by name.\n",
        "operationId": "update-users-bulk",
        "tags": [
          "User V4"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/UserBulkPatchRequest"
                },
                "minItems": 1,
                "maxItems": 100
              },
              "examples": {
                "update_roles": {
                  "summary": "Update user roles and details",
                  "value": [
                    {
                      "id": "user_602aTIeV9XsL0NYzRcy1m",
                      "name": "John Smith",
                      "roles": [
                        "Veterinarian",
                        "Practice Manager"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Users updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsersListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "user-management"
            ]
          }
        ]
      }
    },
    "/v4/role": {
      "get": {
        "summary": "List all active role names",
        "description": "Retrieve a list of all active role names. Intended for use by user endpoints when creating or updating users — the returned role names can be used in the `roles` array when creating users or updating user roles.\n",
        "operationId": "listroles",
        "tags": [
          "Role"
        ],
        "responses": {
          "200": {
            "description": "Roles retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RolesListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "user-management"
            ]
          }
        ]
      }
    },
    "/v4/hospital": {
      "get": {
        "summary": "Fetches a list containing Hospital(s) - uses token pagination.",
        "operationId": "get-hospital-v4",
        "tags": [
          "Hospital"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "query",
            "required": false,
            "description": "Filter hospitals by business ID",
            "schema": {
              "type": "string"
            },
            "example": "ownership_01HZY8Y5TQ2XG3P9W4N8K6V1R2"
          },
          {
            "$ref": "#/components/parameters/Hospital-pageSize"
          },
          {
            "$ref": "#/components/parameters/Hospital-nextToken"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Hospitals",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hospital-HospitalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Hospital-BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Hospital-Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Hospital-Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/Hospital-UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/Hospital-TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/Hospital-InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-separation"
            ]
          }
        ]
      }
    },
    "/v4/hospital/{id}": {
      "get": {
        "summary": "Fetches a single Hospital by its ID (uid).",
        "operationId": "get-hospital-by-id-v4",
        "tags": [
          "Hospital"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The unique identifier (uid) of the Hospital.",
            "schema": {
              "type": "string"
            },
            "example": "hospital_01HZY8Z7Q8K2N4X7QY2S8M3J7A"
          }
        ],
        "responses": {
          "200": {
            "description": "Success body is `{ \"data\": { ... }, \"errors\": [] }` — `data` is the Hospital object directly. `meta` is omitted (no pagination for a single resource); `errors` is always present on the wire and is `[]` on success.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hospital-HospitalSingleResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Hospital-Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Hospital-Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/Hospital-NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Hospital-UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/Hospital-TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/Hospital-InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-separation"
            ]
          }
        ]
      }
    }
  }
}
