{
  "swagger": "2.0",
  "info": {
    "description": "This is a description of API provided by TIMEOFF.GURU. `TimeOffApiKey` for authorization is provided by TIMEOFF.GURU administrator.",
    "version": "2.1.0",
    "title": "TIMEOFF.GURU API",
    "termsOfService": "https://timeoff.guru/pages/privacy-en",
    "contact": {
      "email": "admin@timeoff.guru"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "host": "timeoff.guru/to/<instance>",
  "basePath": "/xsp/resources/api",
  "tags": [
    {
      "name": "configuration",
      "description": "System configuration"
    },
    {
      "name": "leaves",
      "description": "Leaves information"
    },
    {
      "name": "employees",
      "description": "Information about employees"
    }
  ],
  "schemes": [
    "https",
    "http"
  ],
  "paths": {
    "/configuration/organizations": {
      "get": {
        "tags": [
          "configuration"
        ],
        "summary": "available organizations in instance",
        "operationId": "organizations",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/OrganizationsApiResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/configuration/leaveTypes": {
      "get": {
        "tags": [
          "configuration"
        ],
        "summary": "leave types in configuration",
        "operationId": "leaveTypes",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "description": "ID of organization (only for multi-configuration instance)",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/LeaveTypesApiReponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/leaves/leaveRequestByUnid": {
      "get": {
        "tags": [
          "leaves"
        ],
        "summary": "leave request by UNID",
        "operationId": "leaveRequestByUnid",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "unid",
            "in": "query",
            "description": "UNID of leave request",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/LeaveRequestApiReponse"
            }
          },
          "401": {
            "description": "unauthorized"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/leaves/leaveRequestsByEmployee": {
      "get": {
        "tags": [
          "leaves"
        ],
        "summary": "leaves requests created by employee",
        "operationId": "leaveRequestsByEmployee",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "employeeId",
            "in": "query",
            "description": "ID of employee",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/LeaveRequestsApiResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/leaves/leaveRequestByMonth": {
      "get": {
        "tags": [
          "leaves"
        ],
        "summary": "leaves requests within selected month of year. Result NOT includes requests in following statuses [Rejected, Canceled, Current]",
        "operationId": "leaveRequestByMonth",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "description": "year of leave period",
            "required": true,
            "type": "number"
          },
          {
            "name": "month",
            "in": "query",
            "description": "month of leave period",
            "required": true,
            "type": "number"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/LeaveRequestsApiResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/leaves/allLeaveRequestByMonth": {
      "get": {
        "tags": [
          "leaves"
        ],
        "summary": "All leaves requests within selected month of year. Result includes requests in all possible statuses",
        "operationId": "allLeaveRequestByMonth",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "year",
            "in": "query",
            "description": "year of leave period",
            "required": true,
            "type": "number"
          },
          {
            "name": "month",
            "in": "query",
            "description": "month of leave period",
            "required": true,
            "type": "number"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/LeaveRequestsApiResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/leaves/plannedLeaves": {
      "get": {
        "tags": [
          "leaves"
        ],
        "summary": "planned by employee leaves",
        "operationId": "plannedLeaves",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "employeeId",
            "in": "query",
            "description": "ID of employee",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/PlannedLeavesApiResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/leaves/leaveRequestsInProgress": {
      "get": {
        "tags": [
          "leaves"
        ],
        "summary": "leaves requests in status accepted, cancelled within current day and modified within current day ",
        "operationId": "leaveRequestsInProgress",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "daysBack",
            "in": "query",
            "description": "How many days ago data will be taken. Applicable only for groups [cancelledRequests, modifiedRequests, archivedRequests] ",
            "required": false,
            "type": "number"
          },
          {
            "name": "exclude",
            "in": "query",
            "description": "Groups to exclude from result. Accepts one or multipe of [accepted, current, cancelled, modified, archived]. Concatenate constants when exclude multiple",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/LeaveRequestsInProgressApiResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          }
        }
      }
    },
    "/employees/employeeById": {
      "get": {
        "tags": [
          "employees"
        ],
        "summary": "return employee info",
        "operationId": "employeeById",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "employeeId",
            "in": "query",
            "description": "ID of employee",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/EmployeeByIdApiReponse"
            }
          },
          "401": {
            "description": "unauthorized"
          },
          "403": {
            "description": "employees API is not available in this instance of TIMEOFF"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/employees/compensationsByEmployee": {
      "get": {
        "tags": [
          "employees"
        ],
        "summary": "compensations by employee id",
        "operationId": "compensationsByEmployee",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "employeeId",
            "in": "query",
            "description": "ID of employee",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/CompensationsApiResponse"
            }
          },
          "401": {
            "description": "unauthorized"
          },
          "403": {
            "description": "employees API is not available in this instance of TIMEOFF"
          }
        }
      }
    }
  },
  "securityDefinitions": {
    "api_key": {
      "type": "apiKey",
      "name": "TimeOffApiKey",
      "in": "header"
    }
  },
  "definitions": {
    "OrganizationsApiResponse": {
      "type": "object",
      "properties": {
        "organizations": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "country": {
                "type": "string"
              },
              "unid": {
                "type": "string"
              },
              "address": {
                "type": "string"
              },
              "deleted": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "fullName": {
                "type": "string"
              },
              "bulstat": {
                "type": "string"
              }
            }
          }
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "LeaveTypesApiReponse": {
      "type": "object",
      "properties": {
        "leaveTypes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "format": "int32"
              },
              "uuid": {
                "type": "string"
              },
              "name": {
                "type": "object",
                "properties": {
                  "default": {
                    "type": "string"
                  },
                  "bg": {
                    "type": "string"
                  },
                  "en": {
                    "type": "string"
                  }
                }
              },
              "shortName": {
                "type": "string"
              },
              "notes": {
                "type": "object",
                "properties": {
                  "default": {
                    "type": "string"
                  },
                  "bg": {
                    "type": "string"
                  },
                  "en": {
                    "type": "string"
                  }
                }
              },
              "paid": {
                "type": "boolean"
              },
              "deduct": {
                "type": "boolean"
              },
              "active": {
                "type": "boolean"
              },
              "attachFile": {
                "type": "boolean"
              },
              "kind": {
                "type": "string"
              }
            }
          }
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "LeaveRequestApiReponse": {
      "type": "object",
      "properties": {
        "requestInfo": {
          "$ref": "#/definitions/RequestInfo"
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "RequestInfo": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string"
        },
        "periodMode": {
          "type": "string"
        },
        "unid": {
          "type": "string"
        },
        "usedYears": {
          "type": "object",
          "properties": {
            "year": {
              "type": "object",
              "properties": {
                "days": {
                  "type": "integer",
                  "format": "int32"
                },
                "hours": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        },
        "endDate": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "substitutes": {
          "type": "object"
        },
        "statusLog": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              },
              "approveComment": {
                "type": "string"
              },
              "effectiveEmployee": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              "employee": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              "status": {
                "type": "string"
              }
            }
          }
        },
        "approvedBy": {
          "type": "object",
          "properties": {
            "employee_id": {
              "type": "string"
            }
          }
        },
        "description": {
          "type": "string"
        },
        "dates": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "type": {
          "type": "string"
        },
        "hoursRange": {
          "type": "string"
        },
        "requestor": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "employeeNumber": {
          "type": "string"
        },
        "rejectReason": {
          "type": "string"
        },
        "leaveType": {
          "type": "string"
        },
        "days": {
          "type": "integer",
          "format": "int32"
        },
        "typeId": {
          "type": "integer",
          "format": "int32"
        },
        "startDate": {
          "type": "string"
        },
        "hoursAmount": {
          "type": "integer",
          "format": "int32"
        },
        "status": {
          "type": "string"
        }
      }
    },
    "LeaveRequestsApiResponse": {
      "type": "object",
      "properties": {
        "requests": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RequestInfo"
          }
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "PlannedLeavesApiResponse": {
      "type": "object",
      "properties": {
        "planned": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "endDate": {
                "type": "string"
              },
              "days": {
                "type": "integer",
                "format": "int32"
              },
              "dates": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "startDate": {
                "type": "string"
              }
            }
          }
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "CompensationsApiResponse": {
      "type": "object",
      "properties": {
        "compensations": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string"
              },
              "unid": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "days": {
                "type": "integer",
                "format": "int32"
              },
              "status": {
                "type": "string"
              }
            }
          }
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "EmployeeByIdApiReponse": {
      "type": "object",
      "properties": {
        "employee": {
          "type": "object",
          "properties": {
            "organization": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "department": {
              "type": "string"
            },
            "workingHours": {
              "type": "integer",
              "format": "int32"
            }
          }
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "LeaveRequestsInProgressApiResponse": {
      "type": "object",
      "properties": {
        "acceptedRequests": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RequestInProgressInfo"
          }
        },
        "currentRequests": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RequestInProgressInfo"
          }
        },
        "cancelledRequests": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RequestInProgressInfo"
          }
        },
        "modifiedRequests": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RequestInProgressInfo"
          }
        },
        "archivedRequests": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RequestInProgressInfo"
          }
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "RequestInProgressInfo": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string"
        },
        "periodMode": {
          "type": "string"
        },
        "unid": {
          "type": "string"
        },
        "endDate": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "substitutes": {
          "type": "object"
        },
        "approvedBy": {
          "type": "object"
        },
        "description": {
          "type": "string"
        },
        "employeeId": {
          "type": "string"
        },
        "dates": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "type": {
          "type": "string"
        },
        "requestor": {
          "type": "string"
        },
        "hoursRange": {
          "type": "string"
        },
        "rejectReason": {
          "type": "string"
        },
        "leaveType": {
          "type": "string"
        },
        "days": {
          "type": "integer",
          "format": "int32"
        },
        "typeId": {
          "type": "integer",
          "format": "int32"
        },
        "email": {
          "type": "string"
        },
        "startDate": {
          "type": "string"
        },
        "hoursAmount": {
          "type": "integer",
          "format": "int32"
        },
        "status": {
          "type": "string"
        }
      }
    }
  },
  "externalDocs": {
    "description": "FAQ",
    "url": "https://timeoff.guru/faq"
  }
}