API reference
/- Get invoice by ID
List invoices
Search invoices
List a client's unpaid invoices
Get invoice by ID
🔐 Required role:
API_ADMIN📖 Data dictionary: Invoice
Retrieve a specific invoice by its unique identifier
This endpoint provides detailed invoice information including:
- Complete invoice details and line items
- Invoice status and payment tracking
- Client and project relationships
- Tax calculations and compliance data
- Payment history and outstanding balances
- Document generation and delivery status
Invoice Management Features:
- Invoice lifecycle tracking
- Payment status monitoring
- Tax calculation and compliance
- Client relationship integration
- Document generation and delivery
Invoice Details Include:
- Invoice number and reference
- Invoice status and payment status
- Client and project information
- Line items and amounts
- Tax calculations
- Payment history
Business Applications:
- Invoice status monitoring
- Payment tracking and reconciliation
- Client billing history
- Revenue recognition analysis
- Tax compliance reporting
The invoice is wrapped in an invoice property. An id that matches no invoice returns 200 with "invoice": null; the endpoint never returns 404.
Response Example:
{
"invoice": {
"arTranId": 45678,
"invoiceNumber": "INV-2024-001",
"dueDate": "2024-12-31T23:59:59Z",
"status": "POSTED",
"tax": 2000.00,
"interest": 0.00,
"description": "Q4 Financial Audit",
"createdAt": "2024-12-01T09:00:00Z",
"updatedAt": "2024-12-15T10:30:00Z",
"ar_tran": {
"id": 45678,
"pmsRef": "AR-2024-045678",
"transactionDate": "2024-12-01T00:00:00Z",
"amount": 22000.00,
"allocated": 15000.00,
"clientId": 789
}
}
}Security
(BearerAuth and CfAccessClientId and CfAccessClientSecret) or BearerAuth
- Sandbox (requires Cloudflare Access headers)https://api.sandbox.aiwyn.app/gql/v1/invoice/{id}
- Staging (requires Cloudflare Access headers)https://api.staging.aiwyn.app/gql/v1/invoice/{id}
- Production (your live firm data; no Cloudflare Access headers)https://api.aiwyn.ai/gql/v1/invoice/{id}
curl -i -X GET \
https://api.sandbox.aiwyn.app/gql/v1/invoice/45678 \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'CF-Access-Client-Id: YOUR_API_KEY_HERE' \
-H 'CF-Access-Client-Secret: YOUR_API_KEY_HERE'Response
{ "invoice": { "arTranId": 45678, "invoiceNumber": "INV-2024-001", "dueDate": "2024-12-31T23:59:59", "status": "POSTED", "tax": 2000, "interest": 0, "description": "Q4 Financial Audit", "createdAt": "2024-12-01T09:00:00Z", "updatedAt": "2024-12-15T10:30:00Z", "postedAt": "2024-05-12T22:50:20.595961+00:00", "deliveryMethod": "EMAIL", "emailRecipients": "ap@techflow.example", "invoiceFileId": 88231, "reversalReason": null, "reversedAt": null, "reversedByStaffId": null, "ar_tran": { … } } }