Use Xero tracking categories for divisional and branch reporting via API

domain: developer.xero.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Obtain an OAuth 2.0 access token with the accounting.settings scope and retrieve the Xero-Tenant-Id header value for the target organisation.
  2. List existing tracking categories with GET https://api.xero.com/api.xro/2.0/TrackingCategories; note that an organisation supports a maximum of two ACTIVE tracking categories and four total (including archived) — plan category names accordingly.
  3. Create a tracking category via PUT https://api.xero.com/api.xro/2.0/TrackingCategories with a JSON body containing Name and Status=ACTIVE, then create its options (e.g., division or branch names) by PUT-ing to /TrackingCategories/{TrackingCategoryID}/Options.
  4. Assign tracking options to invoice, bill, or journal line items by including a Tracking array on each LineItem object when creating or updating transactions, specifying TrackingCategoryID and TrackingOptionID.
  5. Pull divisional P&L by calling GET https://api.xero.com/api.xro/2.0/Reports/ProfitAndLoss with query parameters trackingCategoryID and trackingOptionID to filter the report to a specific branch.
  6. Export the report payload and load it into a data warehouse; automate nightly pulls using a scheduled job that iterates over all active tracking options to build a full divisional reporting matrix.

Known gotchas

Related routes

Create and apply Xero tracking categories to invoices and run segmented P&L reports
developer.xero.com · 6 steps · unrated
Query and export Xero Profit and Loss report with custom date ranges via the Reports API
developer.xero.com · 5 steps · unrated
Create and manage Xero Repeating Invoices via the Accounting API
developer.xero.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans