{
  "openapi": "3.1.0",
  "info": {
    "title": "TRAK connector operations for Xero Payroll AU",
    "version": "1.0.0",
    "description": "Outbound operations used by TRAK. The provider hosts these endpoints. Field lists describe the portion used by the connector."
  },
  "servers": [
    {
      "url": "https://api.xero.com/payroll.xro"
    }
  ],
  "security": [
    {
      "bearer": [],
      "xeroOrg": []
    }
  ],
  "paths": {
    "/1.0/Employees": {
      "get": {
        "summary": "List payroll employees",
        "description": "List payroll employees.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "Page number, starting at 1.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "Xero Payroll AU resource data used by the selected workflow.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "Employees": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "EmployeeID": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "Status": {
                            "type": "string"
                          },
                          "FirstName": {
                            "type": "string"
                          },
                          "LastName": {
                            "type": "string"
                          },
                          "PayrollCalendarID": {
                            "type": "string",
                            "format": "uuid"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "Employees"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "get_1_0_employees"
      }
    },
    "/1.0/Employees/{employeeID}": {
      "get": {
        "summary": "Read employee status and pay calendar",
        "description": "Read employee status and pay calendar.",
        "parameters": [
          {
            "name": "employeeID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "Xero Payroll AU resource data used by the selected workflow.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "Employees": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "EmployeeID": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "Status": {
                            "type": "string"
                          },
                          "FirstName": {
                            "type": "string"
                          },
                          "LastName": {
                            "type": "string"
                          },
                          "PayrollCalendarID": {
                            "type": "string",
                            "format": "uuid"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "Employees"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "get_1_0_employees_employeeid"
      }
    },
    "/1.0/PayrollCalendars/{calendarID}": {
      "get": {
        "summary": "Read the open pay calendar",
        "description": "Read the open pay calendar.",
        "parameters": [
          {
            "name": "calendarID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "Xero Payroll AU resource data used by the selected workflow.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "PayrollCalendars": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "PayrollCalendarID": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "CalendarType": {
                            "type": "string"
                          },
                          "StartDate": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "PayrollCalendars"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "get_1_0_payrollcalendars_calendarid"
      }
    },
    "/1.0/PayItems": {
      "get": {
        "summary": "List earnings rates",
        "description": "List earnings rates.",
        "responses": {
          "2XX": {
            "description": "Xero Payroll AU resource data used by the selected workflow.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "PayItems": {
                      "type": "object",
                      "properties": {
                        "EarningsRates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "EarningsRateID": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "Name": {
                                "type": "string"
                              },
                              "RateType": {
                                "type": "string"
                              },
                              "EarningsType": {
                                "type": "string"
                              },
                              "IsActive": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "PayItems"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "get_1_0_payitems"
      }
    },
    "/2.0/timesheets": {
      "get": {
        "summary": "Find the employee’s timesheet",
        "description": "Find the employee’s timesheet.",
        "parameters": [
          {
            "name": "filter",
            "in": "query",
            "description": "employeeId=={employeeID}",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "description": "First period date.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "description": "Last period date.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "Match the employee, pay calendar and period before updating time.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "timesheets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "timesheetID": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "employeeID": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "payrollCalendarID": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "startDate": {
                            "type": "string"
                          },
                          "endDate": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "timesheetLines": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "timesheetLineID": {
                                  "type": "string",
                                  "format": "uuid"
                                },
                                "earningsRateID": {
                                  "type": "string",
                                  "format": "uuid"
                                },
                                "numberOfUnits": {
                                  "type": "number"
                                },
                                "date": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "timesheets"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "get_2_0_timesheets"
      },
      "post": {
        "summary": "Create an employee timesheet",
        "description": "Applies to an authorized Payroll AU delivery for one employee and pay period.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable key for the same authorized write.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "The provider accepted the operation."
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Period"
              }
            }
          }
        },
        "operationId": "post_2_0_timesheets"
      }
    },
    "/2.0/timesheets/{timesheetID}": {
      "get": {
        "summary": "Read the owned timesheet",
        "description": "Read the owned timesheet.",
        "parameters": [
          {
            "name": "timesheetID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "Match the employee, pay calendar and period before updating time.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "timesheet": {
                      "type": "object",
                      "properties": {
                        "timesheetID": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "employeeID": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "payrollCalendarID": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "startDate": {
                          "type": "string"
                        },
                        "endDate": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "timesheetLines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "timesheetLineID": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "earningsRateID": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "numberOfUnits": {
                                "type": "number"
                              },
                              "date": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "timesheet"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "get_2_0_timesheets_timesheetid"
      }
    },
    "/2.0/timesheets/{timesheetID}/reverttodraft": {
      "post": {
        "summary": "Return the owned timesheet to draft",
        "description": "Applies to an authorized Payroll AU delivery for one employee and pay period.",
        "parameters": [
          {
            "name": "timesheetID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable key for the same authorized write.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "The provider accepted the operation."
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "post_2_0_timesheets_timesheetid_reverttodraft"
      }
    },
    "/2.0/timesheets/{timesheetID}/lines": {
      "post": {
        "summary": "Create an approved time line",
        "description": "Applies to an authorized Payroll AU delivery for one employee and pay period.",
        "parameters": [
          {
            "name": "timesheetID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable key for the same authorized write.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "The provider accepted the operation."
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayrollLine"
              }
            }
          }
        },
        "operationId": "post_2_0_timesheets_timesheetid_lines"
      }
    },
    "/2.0/timesheets/{timesheetID}/lines/{lineID}": {
      "put": {
        "summary": "Update a previously delivered time line",
        "description": "Applies to an authorized Payroll AU delivery for one employee and pay period.",
        "parameters": [
          {
            "name": "timesheetID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "lineID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable key for the same authorized write.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "The provider accepted the operation."
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayrollLine"
              }
            }
          }
        },
        "operationId": "put_2_0_timesheets_timesheetid_lines_lineid"
      },
      "delete": {
        "summary": "Remove a superseded delivered line",
        "description": "Applies to an authorized Payroll AU delivery for one employee and pay period.",
        "parameters": [
          {
            "name": "timesheetID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "lineID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable key for the same authorized write.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "The provider accepted the operation."
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "delete_2_0_timesheets_timesheetid_lines_lineid"
      }
    },
    "/2.0/timesheets/{timesheetID}/approve": {
      "post": {
        "summary": "Approve the reconciled timesheet",
        "description": "Applies to an authorized Payroll AU delivery for one employee and pay period.",
        "parameters": [
          {
            "name": "timesheetID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable key for the same authorized write.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "2XX": {
            "description": "The provider accepted the operation."
          },
          "default": {
            "description": "Provider error. Check authorization, resource access and the response before retrying."
          },
          "400": {
            "description": "Payroll validation failed; inspect the detail and invalid-field reason.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "problem": {
                      "type": "object",
                      "properties": {
                        "detail": {
                          "type": "string"
                        },
                        "invalidFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The payroll access token was rejected."
          },
          "403": {
            "description": "Verify the organisation, Payroll AU consent and user access."
          },
          "429": {
            "description": "The provider rate limit has been reached."
          }
        },
        "operationId": "post_2_0_timesheets_timesheetid_approve"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      },
      "xeroOrg": {
        "type": "apiKey",
        "in": "header",
        "name": "xero-tenant-id"
      }
    },
    "schemas": {
      "Period": {
        "type": "object",
        "properties": {
          "employeeID": {
            "type": "string",
            "format": "uuid"
          },
          "payrollCalendarID": {
            "type": "string",
            "format": "uuid"
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          }
        },
        "required": [
          "employeeID",
          "payrollCalendarID",
          "startDate",
          "endDate"
        ]
      },
      "PayrollLine": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "earningsRateID": {
            "type": "string",
            "format": "uuid"
          },
          "numberOfUnits": {
            "type": "number"
          }
        },
        "required": [
          "date",
          "earningsRateID",
          "numberOfUnits"
        ]
      }
    }
  }
}
