openapi: 3.0.0
servers:
  - description: Xero Identity service API
    url: https://api.xero.com
info:
  contact:
    email: api@xero.com
    name: Xero Platform Team
    url: https://developer.xero.com
    x-twitter: XeroAPI
  description: These endpoints are related to managing authentication tokens and
    identity for Xero API
  license:
    name: MIT
    url: https://github.com/XeroAPI/Xero-OpenAPI/blob/master/LICENSE
  termsOfService: https://developer.xero.com/xero-developer-platform-terms-conditions/
  title: Xero OAuth 2 Identity Service API
  version: 2.9.4
  x-apisguru-categories:
    - financial
  x-origin:
    - format: openapi
      url: https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/master/xero-identity.yaml
      version: "3.0"
  x-providerName: xero.com
  x-serviceName: xero-identity
paths:
  /Connections:
    get:
      description: Override the base server url that include version
      operationId: getConnections
      parameters:
        - description: Filter by authEventId
          example: 00000000-0000-0000-0000-000000000000
          in: query
          name: authEventId
          required: false
          schema:
            format: uuid
            type: string
      responses:
        "200":
          content:
            application/json:
              example: '[ { "id": "7cb59f93-2964-421d-bb5e-a0f7a4572a44", "tenantId":
                "fe79f7dd-b6d4-4a92-ba7b-538af6289c58", "tenantName": "Demo
                Company (NZ)", "tenantType": "ORGANISATION", "createdDateUtc":
                "2019-12-07T18:46:19.5165400", "updatedDateUtc":
                "2019-12-07T18:46:19.5187840" } ]'
              schema:
                items:
                  $ref: "#/components/schemas/Connection"
                type: array
          description: Success - return response of type Connections array with 0 to n
            Connection
      security:
        - OAuth2: []
      summary: Retrieves the connections for this user
      tags:
        - identity
      x-basepath: https://api.xero.com
  "/Connections/{id}":
    delete:
      description: Override the base server url that include version
      operationId: deleteConnection
      parameters:
        - description: Unique identifier for retrieving single object
          in: path
          name: id
          required: true
          schema:
            format: uuid
            type: string
      responses:
        "204":
          description: Success - connection has been deleted no content returned
        "404":
          description: Resource not found
      security:
        - OAuth2: []
      summary: Deletes a connection for this user (i.e. disconnect a tenant)
      tags:
        - identity
      x-basepath: https://api.xero.com
components:
  schemas:
    AccessToken:
      externalDocs:
        url: http://developer.xero.com
      properties:
        access_token:
          description: access token provided during authentication flow
          type: string
        expires_in:
          description: time in milliseconds until access token expires.
          format: int
          type: number
        id_token:
          description: Xero unique identifier
          type: string
        refresh_token:
          description: token used to refresh an expired access token
          type: string
        token_type:
          description: type of token i.e. Bearer
          type: string
      type: object
    Connection:
      externalDocs:
        url: http://developer.xero.com
      properties:
        authEventId:
          description: Identifier shared across connections authorised at the same time
          format: uuid
          type: string
        createdDateUtc:
          description: The date when the user connected this tenant to your app
          format: date-time
          type: string
          x-is-datetime: true
          x-php-format: \DateTime
        id:
          description: Xero identifier
          format: uuid
          type: string
        tenantId:
          description: Xero identifier of organisation
          format: uuid
          type: string
        tenantName:
          description: Xero tenant name
          type: string
        tenantType:
          description: Xero tenant type (i.e. ORGANISATION, PRACTICE)
          type: string
        updatedDateUtc:
          description: The date when the user most recently connected this tenant to your
            app. May differ to the created date if the user has disconnected and
            subsequently reconnected this tenant to your app.
          format: date-time
          type: string
          x-is-datetime: true
          x-php-format: \DateTime
    RefreshToken:
      externalDocs:
        url: http://developer.xero.com
      properties:
        client_id:
          description: client id for Xero app
          type: string
        client_secret:
          description: client secret for Xero app 2
          type: string
        grant_type:
          description: Xero grant type
          type: string
        refresh_token:
          description: refresh token provided during authentication flow
          type: string
      type: object
  securitySchemes:
    BasicAuth:
      scheme: basic
      type: http
    OAuth2:
      description: For more information
      flows:
        authorizationCode:
          authorizationUrl: https://login.xero.com/identity/connect/authorize
          scopes:
            accounting.attachments: Grant read-write access to
            accounting.attachments.read: Grant read-only access to
            accounting.contacts: Grant read-write access to
            accounting.contacts.read: Grant read-only access to
            accounting.journals.read: Grant read-only access to journals
            accounting.reports.read: Grant read-only access to accounting reports
            accounting.settings: Grant read-write access to organisation and account settings
            accounting.settings.read: Grant read-only access to organisation and account settings
            accounting.transactions: Grant read-write access to bank transactions, credit
              notes, invoices, repeating invoices
            accounting.transactions.read: Grant read-only access to invoices
            assets assets.read: Grant read-only access to
            email: Grant read-only access to your email
            files: Grant read-write access to
            files.read: Grant read-only access to
            openid: Grant read-only access to your open id
            payroll: Grant read-write access to
            payroll.employees: Grant read-write access to
            payroll.employees.read: Grant read-only access to
            payroll.leaveapplications: Grant read-write access to
            payroll.leaveapplications.read: Grant read-only access to
            payroll.payitems: Grant read-write access to
            payroll.payitems.read: Grant read-only access to
            payroll.payrollcalendars: Grant read-write access to
            payroll.payrollcalendars.read: Grant read-only access to
            payroll.payruns: Grant read-write access to
            payroll.payruns.read: Grant read-only access to
            payroll.payslip: Grant read-write access to
            payroll.payslip.read: Grant read-only access to
            payroll.read: Grant read-only access to
            payroll.settings.read: Grant read-only access to
            payroll.superfundproducts.read: Grant read-only access to
            payroll.superfunds: Grant read-write access to
            payroll.superfunds.read: Grant read-only access to
            payroll.timesheets: Grant read-write access to
            payroll.timesheets.read: Grant read-only access to
            profile: your profile information
            projects: Grant read-write access to projects
            projects.read: Grant read-only access to projects
          tokenUrl: https://identity.xero.com/connect/token
      type: oauth2
