Hi n8n community,
I’m building an AP automation workflow that creates bills in Xero via API. The core workflow is working perfectly, but I’m hitting a 403 error when trying to upload PDF attachments to bills.
**What’s Working:**
Xero OAuth2 authentication (using n8n’s built-in Xero credential)
Creating contacts via Xero node
Creating bills/invoices via HTTP Request node with Xero OAuth2
All accounting transactions work fine
**What’s NOT Working:**
Uploading attachments to invoices via PUT request to `/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{filename}`
Getting 403 Forbidden error despite valid OAuth token
**My Setup:**
- Using Xero Web App (not Custom Connection) in Xero Developer Portal
- n8n’s built-in Xero OAuth2 API credential
- HTTP Request node configured with:
- Method: PUT
- Authentication: Predefined Credential Type → Xero OAuth2 API
- Body: n8n Binary File (PDF attachment)
- Content-Type: application/pdf
**The Issue:**
I believe the problem is that n8n’s Xero OAuth flow doesn’t request the `accounting.attachments` scope by default. The Xero API documentation states that file attachments require this scope, but I can’t find a way to add it in n8n’s Xero credential configuration.
**Questions:**
1. Is there a way to add custom scopes to n8n’s built-in Xero OAuth2 credential?
2. Do I need to use Generic OAuth2 instead and manually configure everything?
3. Has anyone successfully uploaded attachments to Xero invoices via n8n?
**Workaround I’m Using:**
Currently emailing the PDF to users who then manually attach it in Xero, but would be better to automate this fully. Any guidance would be greatly appreciated! Thanks in advance.