Endpoint Details
- Method:
PATCH
- URL:
/api/v0/invoices/{invoice_id}
- Content-Type:
application/json
- Authentication: Required (API Key & Secret)
- Rate Limiting: 100 requests per minute
- Idempotency: Supported (recommended for updates)
Authentication
This endpoint requires API key authentication using:x-client-key
: Your API client keyx-client-secret
: Your API client secret
Path Parameters
Parameter | Type | Description | Required |
---|---|---|---|
invoice_id | string | Unique identifier for the invoice | Yes |
Request Body
All fields are optional - only provide the fields you want to update.Updatable Fields
Field | Type | Description | Validation |
---|---|---|---|
name | string | Invoice name/title | 1-255 characters |
string | Customer email address | Valid email format | |
address | string | Customer address | Optional string |
phone_number | string | Customer phone number | Optional string |
logo | string | Company logo URL | Valid URL format |
items | array | Invoice line items | Array of item objects |
due_date | string | Payment due date (YYYY-MM-DD) | Future date, ISO format |
send_date | string | Invoice send date (YYYY-MM-DD) | ISO date format |
status | enum | Invoice status | Valid InvoiceStatus enum |
payment_methods | array | Accepted payment methods | Array of PaymentMethod enums |
delivery | enum | Delivery method | EMAIL or MANUALLY |
payment_link | boolean | Generate payment link | Boolean |
partial_payment | boolean | Allow partial payments | Boolean |
taxId | string | Tax configuration ID | Valid UUID, must exist |
Item Structure
When updating items, provide the complete items array:Field | Type | Description | Required |
---|---|---|---|
product_id | string | Product identifier | Yes |
quantity | number | Quantity of the product | Yes |
Item Updates: When updating items, provide the complete array of items you want on the invoice. Existing items will be replaced with the new array.
Request Schema
Response
Success Response (200 OK)
Example Requests
Error Responses
Business Logic & Constraints
Status Transition Rules
DRAFT → OPEN
DRAFT → OPEN
- Allowed: Yes, when sending invoice to customer
- Requirements: Must have valid customer email and items
- Side Effects: Invoice becomes visible to customer, payment link activated
OPEN → PAID
OPEN → PAID
- Allowed: Automatically when full payment received
- Requirements: Payment transactions totaling full amount
- Side Effects: Invoice marked as completed, customer notified
PAID → OPEN
PAID → OPEN
- Allowed: Only if refund issued and balance remains
- Requirements: Refund transaction reducing amount paid
- Side Effects: Invoice reopened for remaining balance
Invalid Transitions
Invalid Transitions
- PAID → DRAFT: Cannot revert paid invoices to draft
- PARTIALLYPAID → DRAFT: Cannot revert invoices with payments
- PASTDUE → DRAFT: Cannot revert overdue invoices to draft
Update Restrictions
PAID Invoice Restrictions
PAID Invoice Restrictions
- Line Items: Cannot modify items on paid invoices
- Amounts: Cannot change pricing on paid invoices
- Payment Methods: Can add methods for future transactions
- Customer Info: Can update contact information
Overdue Invoice Handling
Overdue Invoice Handling
- Due Date: Can extend due date for overdue invoices
- Payment Methods: Can add payment options to encourage payment
- Status: Can manually mark as paid when payment confirmed
- Reminders: Update triggers automatic reminder recalculation
Draft Invoice Flexibility
Draft Invoice Flexibility
- Full Edit: Draft invoices can be completely modified
- Items: Add, remove, or update line items freely
- Customer: Change customer details and billing information
- Terms: Modify payment terms and due dates
Automatic Calculations
Recalculation: When line items or tax settings are updated, invoice totals are automatically recalculated including subtotal, tax amount, and total amount.
Financial Recalculation
Financial Recalculation
- Subtotal: Sum of all line item totals
- Tax Amount: Applied based on taxId configuration
- Total Amount: Subtotal + tax amount
- Amount Due: Total amount - amount paid
Status Updates
Status Updates
- Overdue Check: Due date changes trigger overdue status recalculation
- Payment Status: Amount changes affect PAID/PARTIALLYPAID status
- Days Until Due: Automatically calculated based on current date
Update Patterns
Status Management
Use Cases
Invoice Correction
Fix errors in draft invoices before sending to customers
Payment Method Updates
Add or modify accepted payment methods based on customer preferences
Due Date Extensions
Extend payment deadlines for customers requesting more time
Line Item Adjustments
Modify invoice items based on scope changes or corrections
Status Management
Manage invoice lifecycle from draft through payment completion
Customer Information Updates
Update customer contact information and billing details
Implementation Examples
Best Practices
1
Validate Before Update
Always validate update data before sending to the API:
2
Use Idempotency Keys
Include idempotency keys for update operations to prevent duplicate changes:
3
Check Current State
Retrieve current invoice state before making updates to avoid conflicts:
4
Handle Status Restrictions
Respect status-based update restrictions:
5
Audit Trail
Maintain audit trails for important updates:
Security Considerations
Invoice updates affect financial data and should be carefully controlled with proper authorization and audit logging.
Authorization Checks
Authorization Checks
Data Validation
Data Validation
- All update fields are validated for type and format
- Business logic prevents invalid state transitions
- Amount calculations are verified server-side
Audit Requirements
Audit Requirements
- All invoice updates should be logged for audit purposes
- Track who made changes, when, and what was changed
- Maintain change history for compliance requirements
Rate Limiting
This endpoint is subject to the standard API rate limits:- Production: 100 requests per minute per API key
- Development: 50 requests per minute per API key
Related Endpoints
POST /api/v0/invoices
- Create a new invoiceGET /api/v0/invoices
- List all invoicesGET /api/v0/invoices/{id}
- Fetch specific invoice detailsGET /api/v0/products
- List products for line items