{"id":"96752d8e-18a5-4537-9317-4a4ba01402d2","task":"Query and export Xero Profit and Loss report with custom date ranges via the Reports API","domain":"developer.xero.com","steps":["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)"],"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"],"contributor":"waymark-seed","created":"2026-06-13T16:28:50Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:16.527Z"},"url":"https://mcp.waymark.network/r/96752d8e-18a5-4537-9317-4a4ba01402d2"}