Xero — Initiate OAuth
GET/external/v1/oauth/xero/initiate/
Use this when you want LynxLedger to handle the Xero OAuth flow (Option 1) instead of holding tokens yourself. Returns a Xero authorization URL — redirect the user’s browser to it. After the user approves, Xero calls the callback endpoint and LynxLedger creates the tenant and starts the import.
ApiDocsParametersTitle
| ApiDocsParamField | ApiDocsParamType | ApiDocsParamRequired | ApiDocsParamDescription |
|---|---|---|---|
| user_id | integer | ApiDocsRequired | LynxLedger user id from Ensure User. |
| cash_flow_method | string | ApiDocsRequired | direct or indirect. |
| redirect_url | string | ApiDocsOptional | Where to send the user after the callback completes. On success the user lands on {redirect_url}?status=success&domain_url=<prefix>. |
ApiDocsRequestLabel
curl "https://backend.app.lynxledger.com/external/v1/oauth/xero/initiate/?user_id=42&cash_flow_method=indirect&redirect_url=https%3A%2F%2Fyourapp.com%2Fdone" \
-H "X-API-Key: <encrypted_token>"ApiDocsResponseLabel
{
"status": "success",
"status_code": 200,
"data": {
"authorization_url": "https://login.xero.com/identity/connect/authorize?response_type=code&client_id=...&redirect_uri=...&scope=...&state=..."
}
}