An OpenAPI (Swagger) specification for the Xero API with OAuth 2.0 security schema.
This repository holds the official Xero OpenAPI descriptions.
OpenAPI spec 3.0 In Release (used for one or more SDKs)
Use Conventional Commits for all commits.
Why this matters:
- We use semantic-release to calculate versions automatically.
- Consistent commit formatting keeps versioning predictable and release notes accurate.
Versioning rules:
feat:-> minor version bumpfix:-> patch version bump!in the header orBREAKING CHANGE:footer -> major version bump
Examples:
feat(accounting): add includeArchived query parameter to GET /Accounts
fix(files): correct nullable schema for File.ContentLength
feat(payroll-nz)!: remove deprecated EarningsRateID field from Payslip response
BREAKING CHANGE: clients must use EarningsRateIdentifier instead of EarningsRateID.
We are using OpenAPI generator along with these OAS yaml files to generate our new SDKs.
There are lots of tools available for viewing and editing OpenAPI descriptions in a nicely formatted way. A popular tool is SwaggerHub - a version of which is hosted here.
Once you sign up or login, you can create a new API under your account and import a Xero API spec.
If you have Node.js you can use the Swagger UI via an NPM package (it will open a webpage in your default browser):
npx -y open-swagger-ui --open ./xero_accounting.yaml
To view a local file via Docker, run:
docker run -p 8080:8080 -e SWAGGER_JSON=/local/xero_accounting.yaml -v $PWD:/local docker.swagger.io/swaggerapi/swagger-ui
To view a hosted file via Docker, run:
docker run -p 8080:8080 -e SWAGGER_JSON_URL=https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_accounting.yaml docker.swagger.io/swaggerapi/swagger-ui
If you find something missing or incorrect please open an issue or send us a pull request.
This repository includes automated API diff checking using oasdiff to detect breaking changes and modifications to the OpenAPI specifications.
# Check all xero*.yaml files against master branch
./scripts/api-diff/api-diff.sh
# Check a single file
./scripts/api-diff/api-diff.sh xero_accounting.yamlBy default, API diff checks fail when breaking changes are detected.
Breaking changes are allowed only when commit messages include a Conventional Commits breaking marker:
!in the commit header, for examplefeat!: remove deprecated endpointBREAKING CHANGE:in the commit body/footer
For detailed usage, configuration options, environment variables, and integration details, see scripts/api-diff/README.md.
This software is published under the MIT License.
Copyright (c) 2019 Xero Limited
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
