{"skill":{"slug":"xero","displayName":"Xero","summary":"Xero API integration with managed OAuth. Manage contacts, invoices, payments, accounts, and run financial reports. Use this skill when users want to interact...","description":"---\nname: xero\ndescription: |\n  Xero API integration with managed OAuth. Manage contacts, invoices, payments, accounts, and run financial reports. Use this skill when users want to interact with Xero accounting data. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).\ncompatibility: Requires network access and valid Maton API key\nmetadata:\n  author: maton\n  version: \"1.0\"\n  clawdbot:\n    emoji: 🧠\n    requires:\n      env:\n        - MATON_API_KEY\n---\n\n# Xero\n\nAccess the Xero API with managed OAuth authentication. Manage contacts, invoices, payments, bank transactions, and run financial reports.\n\n## Quick Start\n\n```bash\n# List contacts\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://api.maton.ai/xero/api.xro/2.0/Contacts')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n```\n\n## Base URL\n\n```\nhttps://api.maton.ai/xero/{native-api-path}\n```\n\nMaton proxies requests to `api.xero.com` and automatically injects your OAuth token and Xero-Tenant-Id header.\n\n## Authentication\n\nAll requests require the Maton API key in the Authorization header:\n\n```\nAuthorization: Bearer $MATON_API_KEY\n```\n\n**Environment Variable:** Set your API key as `MATON_API_KEY`:\n\n```bash\nexport MATON_API_KEY=\"YOUR_API_KEY\"\n```\n\n### Getting Your API Key\n\n1. Sign in or create an account at [maton.ai](https://maton.ai)\n2. Go to [maton.ai/settings](https://maton.ai/settings)\n3. Copy your API key\n\n## Connection Management\n\nManage your Xero OAuth connections at `https://api.maton.ai`.\n\n### List Connections\n\n```bash\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://api.maton.ai/connections?app=xero&status=ACTIVE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n```\n\n### Create Connection\n\n```bash\npython <<'EOF'\nimport urllib.request, os, json\ndata = json.dumps({'app': 'xero'}).encode()\nreq = urllib.request.Request('https://api.maton.ai/connections', data=data, method='POST')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Content-Type', 'application/json')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n```\n\n### Get Connection\n\n```bash\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://api.maton.ai/connections/{connection_id}')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n```\n\n**Response:**\n```json\n{\n  \"connection\": {\n    \"connection_id\": \"{connection_id}\",\n    \"status\": \"ACTIVE\",\n    \"creation_time\": \"2025-12-08T07:20:53.488460Z\",\n    \"last_updated_time\": \"2026-01-31T20:03:32.593153Z\",\n    \"url\": \"https://connect.maton.ai/?session_token=...\",\n    \"app\": \"xero\",\n    \"metadata\": {}\n  }\n}\n```\n\nOpen the returned `url` in a browser to complete OAuth authorization.\n\n### Delete Connection\n\n```bash\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://api.maton.ai/connections/{connection_id}', method='DELETE')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n```\n\n### Specifying Connection\n\nIf you have multiple Xero connections, specify which one to use with the `Maton-Connection` header:\n\n```bash\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://api.maton.ai/xero/api.xro/2.0/Contacts')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nreq.add_header('Maton-Connection', '{connection_id}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n```\n\nIf you have multiple connections, always include this header to ensure requests go to the intended account.\n\n## Security & Permissions\n\n- Access is scoped to contacts, invoices, payments, accounts, and run financial reports within the connected Xero account.\n- **All write operations require explicit user approval.** Before executing any create, update, or delete call, confirm the target resource and intended effect with the user.\n\n## API Reference\n\n### Contacts\n\n#### List Contacts\n\n```bash\nGET /xero/api.xro/2.0/Contacts\n```\n\n#### Get Contact\n\n```bash\nGET /xero/api.xro/2.0/Contacts/{contactId}\n```\n\n#### Create Contact\n\n```bash\nPOST /xero/api.xro/2.0/Contacts\nContent-Type: application/json\n\n{\n  \"Contacts\": [{\n    \"Name\": \"John Doe\",\n    \"EmailAddress\": \"john@example.com\",\n    \"Phones\": [{\"PhoneType\": \"DEFAULT\", \"PhoneNumber\": \"555-1234\"}]\n  }]\n}\n```\n\n### Invoices\n\n#### List Invoices\n\n```bash\nGET /xero/api.xro/2.0/Invoices\n```\n\n#### Create Invoice\n\n```bash\nPOST /xero/api.xro/2.0/Invoices\nContent-Type: application/json\n\n{\n  \"Invoices\": [{\n    \"Type\": \"ACCREC\",\n    \"Contact\": {\"ContactID\": \"xxx\"},\n    \"LineItems\": [{\n      \"Description\": \"Service\",\n      \"Quantity\": 1,\n      \"UnitAmount\": 100.00,\n      \"AccountCode\": \"200\"\n    }]\n  }]\n}\n```\n\n### Accounts\n\n#### List Accounts\n\n```bash\nGET /xero/api.xro/2.0/Accounts\n```\n\n### Payments\n\n#### List Payments\n\n```bash\nGET /xero/api.xro/2.0/Payments\n```\n\n### Bank Transactions\n\n#### List Bank Transactions\n\n```bash\nGET /xero/api.xro/2.0/BankTransactions\n```\n\n### Reports\n\n#### Profit and Loss\n\n```bash\nGET /xero/api.xro/2.0/Reports/ProfitAndLoss?fromDate=2024-01-01&toDate=2024-12-31\n```\n\n#### Balance Sheet\n\n```bash\nGET /xero/api.xro/2.0/Reports/BalanceSheet?date=2024-12-31\n```\n\n#### Trial Balance\n\n```bash\nGET /xero/api.xro/2.0/Reports/TrialBalance?date=2024-12-31\n```\n\n### Organisation\n\n```bash\nGET /xero/api.xro/2.0/Organisation\n```\n\n## Invoice Types\n\n- `ACCREC` - Accounts Receivable (sales invoice)\n- `ACCPAY` - Accounts Payable (bill)\n\n## Code Examples\n\n### JavaScript\n\n```javascript\nconst response = await fetch(\n  'https://api.maton.ai/xero/api.xro/2.0/Contacts',\n  {\n    headers: {\n      'Authorization': `Bearer ${process.env.MATON_API_KEY}`\n    }\n  }\n);\n```\n\n### Python\n\n```python\nimport os\nimport requests\n\nresponse = requests.get(\n    'https://api.maton.ai/xero/api.xro/2.0/Contacts',\n    headers={'Authorization': f'Bearer {os.environ[\"MATON_API_KEY\"]}'}\n)\n```\n\n## Notes\n\n- `Xero-Tenant-Id` header is automatically injected\n- Dates are in `YYYY-MM-DD` format\n- Multiple records can be created in a single request using arrays\n- Use `where` query parameter for filtering\n- IMPORTANT: When using curl commands, use `curl -g` when URLs contain brackets (`fields[]`, `sort[]`, `records[]`) to disable glob parsing\n- IMPORTANT: When piping curl output to `jq` or other commands, environment variables like `$MATON_API_KEY` may not expand correctly in some shell environments. You may get \"Invalid API key\" errors when piping.\n\n## Error Handling\n\n| Status | Meaning |\n|--------|---------|\n| 400 | Missing Xero connection |\n| 401 | Invalid or missing Maton API key |\n| 429 | Rate limited (10 req/sec per account) |\n| 4xx/5xx | Passthrough error from Xero API |\n\n### Troubleshooting: API Key Issues\n\n1. Check that the `MATON_API_KEY` environment variable is set:\n\n```bash\necho $MATON_API_KEY\n```\n\n2. Verify the API key is valid by listing connections:\n\n```bash\npython <<'EOF'\nimport urllib.request, os, json\nreq = urllib.request.Request('https://api.maton.ai/connections')\nreq.add_header('Authorization', f'Bearer {os.environ[\"MATON_API_KEY\"]}')\nprint(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))\nEOF\n```\n\n### Troubleshooting: Invalid App Name\n\n1. Ensure your URL path starts with `xero`. For example:\n\n- Correct: `https://api.maton.ai/xero/api.xro/2.0/Contacts`\n- Incorrect: `https://api.maton.ai/api.xro/2.0/Contacts`\n\n## Resources\n\n- [Xero API Overview](https://developer.xero.com/documentation/api/accounting/overview)\n- [Contacts](https://developer.xero.com/documentation/api/accounting/contacts)\n- [Invoices](https://developer.xero.com/documentation/api/accounting/invoices)\n- [Accounts](https://developer.xero.com/documentation/api/accounting/accounts)\n- [Payments](https://developer.xero.com/documentation/api/accounting/payments)\n- [Reports](https://developer.xero.com/documentation/api/accounting/reports)\n- [Maton Community](https://discord.com/invite/dBfFAcefs2)\n- [Maton Support](mailto:support@maton.ai)\n","topics":["Accounting","Api Integration","Financial"],"tags":{"latest":"1.0.5"},"stats":{"comments":3,"downloads":18865,"installsAllTime":646,"installsCurrent":13,"stars":12,"versions":6},"createdAt":1770024065831,"updatedAt":1781739759130},"latestVersion":{"version":"1.0.5","createdAt":1777593545152,"changelog":"- Updated all API endpoint URLs to use https://api.maton.ai instead of previous gateway or ctrl domains.\n- Clarified connection management instructions to match new API base URL.\n- Added explicit note in the connection section: always set the Maton-Connection header if you have multiple connections.\n- Added a new Security & Permissions section noting that all write operations require explicit user approval.\n- Removed LICENSE.txt file.","license":"MIT-0"},"metadata":{"setup":[{"key":"MATON_API_KEY","required":true}],"os":null,"systems":null},"owner":{"handle":"byungkyu","userId":"s174c3s2kc1ehqj1ytzntezj2983e2aj","displayName":"byungkyu","image":"https://avatars.githubusercontent.com/u/16563684?v=4"},"moderation":null}