{
  "openapi": "3.1.0",
  "info": {
    "title": "BizGen API",
    "version": "1",
    "description": "The BizGen console API for integrations. Authenticate with an API key from My Profile › Connected AI, sent as a Bearer token. Every call acts in the key's company, with its role's permissions."
  },
  "servers": [
    {
      "url": "https://console.bizgen.app"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (pk_…)"
      }
    }
  },
  "paths": {
    "/api/clients": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "List clients",
        "description": "Needs the clients.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Clients"
        ],
        "summary": "Create a client",
        "description": "Needs the clients.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "code": {
                    "type": "string",
                    "minLength": 1
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "phone": {
                    "type": "string"
                  },
                  "address": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  },
                  "regNo": {
                    "type": "string"
                  },
                  "taxId": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "relatedParty": {
                    "type": "boolean"
                  },
                  "tin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "idType": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "BRN",
                              "NRIC",
                              "PASSPORT",
                              "ARMY"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "idValue": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sstNo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "postcode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "state": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sstExempt": {
                    "type": "boolean"
                  },
                  "sstExemptionRef": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sstExemptUntil": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/clients/{id}": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Read a client",
        "description": "Needs the clients.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Clients"
        ],
        "summary": "Change a client",
        "description": "Needs the clients.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "code": {
                    "type": "string",
                    "minLength": 1
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "phone": {
                    "type": "string"
                  },
                  "address": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  },
                  "regNo": {
                    "type": "string"
                  },
                  "taxId": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "relatedParty": {
                    "type": "boolean"
                  },
                  "tin": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "idType": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "BRN",
                              "NRIC",
                              "PASSPORT",
                              "ARMY"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "idValue": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sstNo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "postcode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "state": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sstExempt": {
                    "type": "boolean"
                  },
                  "sstExemptionRef": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sstExemptUntil": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Clients"
        ],
        "summary": "Delete a client",
        "description": "Needs the clients.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/projects": {
      "get": {
        "tags": [
          "Projects"
        ],
        "summary": "List projects",
        "description": "Needs the projects.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Projects"
        ],
        "summary": "Create a project",
        "description": "Needs the projects.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "status": {
                    "default": "ACTIVE",
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "COMPLETED",
                      "ON_HOLD",
                      "CANCELLED"
                    ]
                  },
                  "startDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "endDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "memberIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "stageId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "leaderUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "budgetVendor": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 999999999999.99
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "budgetClaims": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 999999999999.99
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "budgetHours": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 99999999.99
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "clientId",
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/projects/{id}": {
      "get": {
        "tags": [
          "Projects"
        ],
        "summary": "Read a project",
        "description": "Needs the projects.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Projects"
        ],
        "summary": "Change a project",
        "description": "Needs the projects.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "COMPLETED",
                      "ON_HOLD",
                      "CANCELLED"
                    ]
                  },
                  "startDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "endDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "memberIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "stageId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "leaderUserId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "budgetVendor": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 999999999999.99
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "budgetClaims": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 999999999999.99
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "budgetHours": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 99999999.99
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Projects"
        ],
        "summary": "Delete a project",
        "description": "Needs the projects.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/quotations": {
      "get": {
        "tags": [
          "Quotations"
        ],
        "summary": "List quotations",
        "description": "Needs the quotations.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Quotations"
        ],
        "summary": "Create a quotation",
        "description": "Needs the quotations.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "projectId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "SENT",
                      "ACCEPTED",
                      "REJECTED",
                      "EXPIRED",
                      "CONVERTED"
                    ]
                  },
                  "issueDate": {
                    "type": "string"
                  },
                  "expiryDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "default": 0,
                    "type": "number"
                  },
                  "taxAmount": {
                    "default": 0,
                    "type": "number"
                  },
                  "discount": {
                    "default": 0,
                    "type": "number"
                  },
                  "total": {
                    "type": "number"
                  },
                  "currency": {
                    "default": "MYR",
                    "type": "string"
                  },
                  "fxRate": {
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "type": "string"
                  },
                  "terms": {
                    "type": "string"
                  },
                  "internalNotes": {
                    "type": "string"
                  }
                },
                "required": [
                  "clientId",
                  "projectId",
                  "issueDate",
                  "items",
                  "subtotal",
                  "total"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/quotations/{id}": {
      "get": {
        "tags": [
          "Quotations"
        ],
        "summary": "Read a quotation",
        "description": "Needs the quotations.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Quotations"
        ],
        "summary": "Change a quotation",
        "description": "Needs the quotations.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "projectId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "SENT",
                      "ACCEPTED",
                      "REJECTED",
                      "EXPIRED",
                      "PARTIALLY_CONVERTED",
                      "CONVERTED"
                    ]
                  },
                  "issueDate": {
                    "type": "string"
                  },
                  "expiryDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "type": "number"
                  },
                  "taxAmount": {
                    "type": "number"
                  },
                  "discount": {
                    "type": "number"
                  },
                  "total": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "fxRate": {
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "type": "string"
                  },
                  "terms": {
                    "type": "string"
                  },
                  "internalNotes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Quotations"
        ],
        "summary": "Delete a quotation",
        "description": "Needs the quotations.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/invoices": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "List invoices",
        "description": "Needs the invoices.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Create a invoice",
        "description": "Needs the invoices.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "bankAccountId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "projectId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "quotationId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "default": "DRAFT",
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "SENT",
                      "PARTIAL",
                      "PAID",
                      "OVERDUE",
                      "CANCELLED"
                    ]
                  },
                  "issueDate": {
                    "type": "string"
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "default": 0,
                    "type": "number"
                  },
                  "taxAmount": {
                    "default": 0,
                    "type": "number"
                  },
                  "discount": {
                    "default": 0,
                    "type": "number"
                  },
                  "total": {
                    "type": "number"
                  },
                  "currency": {
                    "default": "MYR",
                    "type": "string"
                  },
                  "fxRate": {
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "type": "string"
                  },
                  "terms": {
                    "type": "string"
                  },
                  "internalNotes": {
                    "type": "string"
                  },
                  "purchaseOrderNumber": {
                    "type": "string"
                  }
                },
                "required": [
                  "clientId",
                  "issueDate",
                  "items",
                  "subtotal",
                  "total"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/invoices/{id}": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Read a invoice",
        "description": "Needs the invoices.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Invoices"
        ],
        "summary": "Change a invoice",
        "description": "Needs the invoices.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bankAccountId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "clientId": {
                    "type": "string"
                  },
                  "projectId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "SENT",
                      "CANCELLED"
                    ]
                  },
                  "issueDate": {
                    "type": "string"
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "type": "number"
                  },
                  "taxAmount": {
                    "type": "number"
                  },
                  "discount": {
                    "type": "number"
                  },
                  "total": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "fxRate": {
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "type": "string"
                  },
                  "terms": {
                    "type": "string"
                  },
                  "internalNotes": {
                    "type": "string"
                  },
                  "purchaseOrderNumber": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Invoices"
        ],
        "summary": "Delete a invoice",
        "description": "Needs the invoices.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/payments": {
      "get": {
        "tags": [
          "Payments"
        ],
        "summary": "List payments received",
        "description": "Needs the payments.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/credit-notes": {
      "get": {
        "tags": [
          "Credit notes"
        ],
        "summary": "List credit notes",
        "description": "Needs the creditNotes.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Credit notes"
        ],
        "summary": "Create a credit note",
        "description": "Needs the creditNotes.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "invoiceId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "projectId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "items": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "default": 0,
                    "type": "number"
                  },
                  "taxAmount": {
                    "default": 0,
                    "type": "number"
                  },
                  "discount": {
                    "default": 0,
                    "type": "number"
                  },
                  "total": {
                    "type": "number"
                  },
                  "currency": {
                    "default": "MYR",
                    "type": "string"
                  },
                  "fxRate": {
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "internalNotes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "clientId",
                  "items",
                  "subtotal",
                  "total"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/credit-notes/{id}": {
      "get": {
        "tags": [
          "Credit notes"
        ],
        "summary": "Read a credit note",
        "description": "Needs the creditNotes.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Credit notes"
        ],
        "summary": "Change a credit note",
        "description": "Needs the creditNotes.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string"
                  },
                  "invoiceId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "projectId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "type": "number"
                  },
                  "taxAmount": {
                    "type": "number"
                  },
                  "discount": {
                    "type": "number"
                  },
                  "total": {
                    "type": "number"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "fxRate": {
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "internalNotes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Credit notes"
        ],
        "summary": "Delete a credit note",
        "description": "Needs the creditNotes.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/debit-notes": {
      "get": {
        "tags": [
          "Debit notes"
        ],
        "summary": "List debit notes",
        "description": "Needs the debitNotes.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Debit notes"
        ],
        "summary": "Create a debit note",
        "description": "Needs the debitNotes.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invoiceId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "default": 0,
                    "type": "number"
                  },
                  "taxAmount": {
                    "default": 0,
                    "type": "number"
                  },
                  "discount": {
                    "default": 0,
                    "type": "number"
                  },
                  "total": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "reason": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "internalNotes": {
                    "type": "string"
                  }
                },
                "required": [
                  "invoiceId",
                  "items",
                  "subtotal",
                  "total"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/debit-notes/{id}": {
      "get": {
        "tags": [
          "Debit notes"
        ],
        "summary": "Read a debit note",
        "description": "Needs the debitNotes.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Debit notes"
        ],
        "summary": "Change a debit note",
        "description": "Needs the debitNotes.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "subtotal": {
                    "type": "number"
                  },
                  "taxRate": {
                    "type": "number"
                  },
                  "taxAmount": {
                    "type": "number"
                  },
                  "discount": {
                    "type": "number"
                  },
                  "total": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "reason": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "internalNotes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Debit notes"
        ],
        "summary": "Delete a debit note",
        "description": "Needs the debitNotes.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/vendors": {
      "get": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "List vendors",
        "description": "Needs the vendors.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "Create a vendor",
        "description": "Needs the vendors.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "code": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "regNo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "taxId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "website": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "category": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paymentTermsDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "currency": {
                    "type": "string",
                    "maxLength": 10
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "ON_HOLD",
                      "BLOCKED"
                    ]
                  },
                  "relatedParty": {
                    "type": "boolean"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/vendors/{id}": {
      "get": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "Read a vendor",
        "description": "Needs the vendors.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "Change a vendor",
        "description": "Needs the vendors.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "code": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "regNo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "taxId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "website": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "category": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paymentTermsDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "currency": {
                    "type": "string",
                    "maxLength": 10
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "ON_HOLD",
                      "BLOCKED"
                    ]
                  },
                  "relatedParty": {
                    "type": "boolean"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "Delete a vendor",
        "description": "Needs the vendors.write permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/vendor-bills": {
      "get": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "List vendor bills",
        "description": "Needs the bills.read permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "Create a vendor bill",
        "description": "Needs the bills.write permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expenseScope": {
                    "type": "string",
                    "enum": [
                      "COMPANY",
                      "PROJECT",
                      "UNCLASSIFIED",
                      "PAYROLL"
                    ]
                  },
                  "expenseCategory": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "Rent",
                          "Utilities",
                          "Internet & telephone",
                          "Subscriptions",
                          "Insurance",
                          "Cleaning",
                          "Maintenance",
                          "Professional fees",
                          "Office supplies",
                          "Other"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "outletId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "serviceFrom": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "serviceTo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "obligationId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "obligationMonth": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(19|[2-9]\\d)\\d{2}-(0[1-9]|1[0-2])$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "purchaseOrderId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "projectId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "vendorInvoiceNo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "billDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "dueDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "items": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 10000
                        },
                        "quantity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000
                        },
                        "unitPrice": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "amount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "itemType": {
                          "type": "string",
                          "enum": [
                            "standard",
                            "payment",
                            "section"
                          ]
                        },
                        "percentage": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxInclusive": {
                          "type": "boolean"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 50
                        },
                        "taxCodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "classificationCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{3}$"
                            },
                            {
                              "type": "string",
                              "const": ""
                            }
                          ]
                        },
                        "unitCode": {
                          "type": "string",
                          "maxLength": 3
                        },
                        "taxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "appliedTaxRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "taxAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "discountAmount": {
                          "type": "number",
                          "minimum": 0
                        },
                        "notes": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "description",
                        "quantity",
                        "unitPrice",
                        "amount"
                      ]
                    }
                  },
                  "taxAmount": {
                    "type": "number",
                    "minimum": 0
                  },
                  "currency": {
                    "type": "string",
                    "maxLength": 10
                  },
                  "fxRate": {
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "overPoReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "files": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fileUrl": {
                          "type": "string",
                          "format": "starts_with",
                          "pattern": "^\\/api\\/files\\/vendor-files\\/.*"
                        },
                        "fileName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "fileSize": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "fileUrl",
                        "fileName",
                        "fileSize"
                      ]
                    }
                  }
                },
                "required": [
                  "vendorId",
                  "vendorInvoiceNo",
                  "billDate",
                  "items"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/vendor-bills/{id}": {
      "get": {
        "tags": [
          "Vendors and bills"
        ],
        "summary": "Read a vendor bill",
        "description": "Needs the bills.read permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/employees": {
      "get": {
        "tags": [
          "Employees"
        ],
        "summary": "List employees",
        "description": "Needs the people.directory or people.manage permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Employees"
        ],
        "summary": "Create a employee",
        "description": "Needs the people.manage permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fullName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "preferredName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workEmail": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "position": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "departmentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "managerId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "gradeId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "employmentType": {
                    "type": "string",
                    "enum": [
                      "PERMANENT",
                      "CONTRACT",
                      "PART_TIME",
                      "INTERN"
                    ]
                  },
                  "joinDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "confirmationDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resignDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workState": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "gender": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "FEMALE",
                          "MALE"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "RESIGNED",
                      "TERMINATED"
                    ]
                  },
                  "employeeNo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 30
                  },
                  "workWeek": {
                    "anyOf": [
                      {},
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "fullName"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/employees/{id}": {
      "get": {
        "tags": [
          "Employees"
        ],
        "summary": "Read a employee",
        "description": "Needs the people.directory or people.manage permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Employees"
        ],
        "summary": "Change a employee",
        "description": "Needs the people.manage permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fullName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "preferredName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workEmail": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "position": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 150
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "departmentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "managerId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "gradeId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "employmentType": {
                    "type": "string",
                    "enum": [
                      "PERMANENT",
                      "CONTRACT",
                      "PART_TIME",
                      "INTERN"
                    ]
                  },
                  "joinDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "confirmationDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "resignDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workState": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "gender": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "FEMALE",
                          "MALE"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "RESIGNED",
                      "TERMINATED"
                    ]
                  },
                  "employeeNo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 30
                  },
                  "workWeek": {
                    "anyOf": [
                      {},
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/leave": {
      "get": {
        "tags": [
          "Leave"
        ],
        "summary": "List leave requests",
        "description": "Needs the leave.applyOwn or leave.readAll permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Leave"
        ],
        "summary": "Create a leave request",
        "description": "Needs the leave.applyOwn or leave.approve permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "leaveTypeId": {
                    "type": "string"
                  },
                  "startDate": {
                    "type": "string"
                  },
                  "endDate": {
                    "type": "string"
                  },
                  "isHalfDay": {
                    "default": false,
                    "type": "boolean"
                  },
                  "halfDayPeriod": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "AM",
                          "PM"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "type": "string"
                  },
                  "userId": {
                    "type": "string"
                  },
                  "notifyUserIds": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "expectedDays": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 366
                  },
                  "startTime": {
                    "type": "string",
                    "maxLength": 5
                  },
                  "hours": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 24
                  },
                  "attachments": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fileUrl": {
                          "type": "string",
                          "format": "starts_with",
                          "pattern": "^\\/api\\/files\\/leave-files\\/.*"
                        },
                        "fileName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "fileSize": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "fileUrl",
                        "fileName",
                        "fileSize"
                      ]
                    }
                  }
                },
                "required": [
                  "leaveTypeId",
                  "startDate",
                  "endDate"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/leave/{id}": {
      "get": {
        "tags": [
          "Leave"
        ],
        "summary": "Read a leave request",
        "description": "Needs the leave.applyOwn or leave.readAll permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/claims": {
      "get": {
        "tags": [
          "Claims"
        ],
        "summary": "List claims",
        "description": "Needs the claims.submitOwn or claims.readAll or claims.payout permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Claims"
        ],
        "summary": "Create a claim",
        "description": "Needs the claims.submitOwn permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "type": {
                    "default": "GENERAL",
                    "type": "string",
                    "enum": [
                      "GENERAL",
                      "PROJECT"
                    ]
                  },
                  "projectId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "title"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/claims/{id}": {
      "get": {
        "tags": [
          "Claims"
        ],
        "summary": "Read a claim",
        "description": "Needs the claims.submitOwn or claims.readAll or claims.payout permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "patch": {
        "tags": [
          "Claims"
        ],
        "summary": "Change a claim",
        "description": "Needs the claims.submitOwn permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "type": {
                    "default": "GENERAL",
                    "type": "string",
                    "enum": [
                      "GENERAL",
                      "PROJECT"
                    ]
                  },
                  "projectId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 5000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Claims"
        ],
        "summary": "Delete a claim",
        "description": "Needs the claims.submitOwn permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    },
    "/api/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "description": "Needs the webhooks.manage permission on the API key's role.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Add a webhook",
        "description": "Needs the webhooks.manage permission on the API key's role.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2000,
                    "format": "uri"
                  },
                  "secret": {
                    "type": "string",
                    "minLength": 16,
                    "maxLength": 512
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 80
                    }
                  }
                },
                "required": [
                  "url",
                  "secret",
                  "events"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          }
        }
      }
    },
    "/api/webhooks/{id}": {
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Switch a webhook on or off",
        "description": "Needs the webhooks.manage permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "description": "Needs the webhooks.manage permission on the API key's role.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The body is not valid; `error` says why"
          },
          "401": {
            "description": "No valid API key"
          },
          "403": {
            "description": "The key's role lacks the permission, or the module is off"
          },
          "404": {
            "description": "Not found in this company"
          }
        }
      }
    }
  }
}
