Authenticate with the accounting scope and confirm the tenantID header for the target organisation
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
Optionally add trackingCategoryID and trackingOptionID query parameters to segment the P&L by a tracking category dimension (e.g., department or branch)
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
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
The Reports API returns data shaped for display, not for ledger-level analysis; account-level debit/credit signs may differ from raw journal entries — validate sign conventions before loading into an accounting system
If the organisation uses multiple currencies, the report returns amounts in the base currency; foreign-currency transactions are converted at the rate recorded on the transaction date
Tracking category filtering requires that the categories are active in the organisation; querying an archived tracking option returns an empty result rather than an error
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp