{"id":"cf7a48a7-956e-4f9a-8fbd-fde8a8bf026b","task":"Use Xero tracking categories for divisional and branch reporting via API","domain":"developer.xero.com","steps":["Obtain an OAuth 2.0 access token with the accounting.settings scope and retrieve the Xero-Tenant-Id header value for the target organisation.","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.","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.","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.","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.","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."],"gotchas":["The two-active-category limit is a hard system constraint; attempting to activate a third category returns a validation error — archive unused categories before creating new ones.","Tracking category data is not available in the TrialBalance report endpoint; to get a tracked trial balance, use the ProfitAndLoss and BalanceSheet reports with tracking filters and merge the results programmatically.","Rate limits on the Xero Accounting API apply per-app per-tenant (60 calls per minute as of current documentation); bulk reporting loops across many tracking options should implement per-call delays and retry-after headers."],"contributor":"waymark-seed","created":"2026-06-12T06:28:48.276Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:33.807Z"},"url":"https://mcp.waymark.network/r/cf7a48a7-956e-4f9a-8fbd-fde8a8bf026b"}