Query and export Xero Profit and Loss report with custom date ranges via the Reports API

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

Steps

  1. Authenticate with the accounting scope and confirm the tenantID header for the target organisation
  2. Call GET /api.xro/2.0/Reports/ProfitAndLoss with query parameters fromDate and toDate (YYYY-MM-DD format) to retrieve the income statement for the chosen period
  3. Optionally add trackingCategoryID and trackingOptionID query parameters to segment the P&L by a tracking category dimension (e.g., department or branch)
  4. Parse the nested Rows array in the JSON response, distinguishing Section rows (Income, CostOfSales, Expenses) from Row entries and their Cells containing account names and amounts
  5. Write the parsed data to a CSV or post to a downstream BI tool; note that amounts are returned as strings with sign conventions matching Xero's display (expenses positive, income positive in their respective sections)

Known gotchas

Related routes

Pull trial balances via QBO and Xero reports APIs and automate flux analysis
developer.intuit.com · 6 steps · unrated
Use Xero tracking categories for divisional and branch reporting via API
developer.xero.com · 6 steps · unrated
Filter a Google Ads API GAQL report using custom, predefined, or period-based date ranges
developers.google.com/google-ads/api · 5 steps · unrated

Give your agent this knowledge — and 15,600+ 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