Creates an invoice.
const response = await client.invoices.create(
{
invoice_id: 'invoice_2024_001',
line_items: [
{
amount: '1000',
currency_code: 'USD',
description: 'Professional services for January 2026',
product_id: 'prod_1234567890',
type: 'payout',
user: { id: 'user_abc123' }
}
]
}
);| Name | Description |
|---|---|
invoice_idstring, required | Unique ID for the invoice. |
line_itemsobject[], required | Line items to create with the invoice. |
tagsobject[] | Tags for the invoice. |
| Name | Description |
|---|---|
dataobject | Invoice object. |
{
"data": {
"id": "inv_1234567890",
"workspace_id": "ws_1234567890",
"line_items": [
{
"id": "item_1234567890",
"type": "payout",
"product_id": "prod_1234567890",
"price": {
"amount": "1000",
"unit_price": "1000",
"quantity": 1
},
"currency_code": "USD",
"description": "Professional services for January 2026",
"user_id": "user_ext_456",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
],
"created": "2024-01-13T00:00:00Z",
"modified": "2024-01-13T00:00:00Z",
"version": 1,
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
}Lists all invoices.
const response = await client.invoices.list();| Name | Description |
|---|---|
dataobject[] | List of invoices. |
{
"data": [
{
"id": "inv_1234567890",
"workspace_id": "ws_1234567890",
"line_items": [
{
"id": "item_1234567890",
"type": "payout",
"product_id": "prod_1234567890",
"price": {
"amount": "1000",
"unit_price": "1000",
"quantity": 1
},
"currency_code": "USD",
"description": "Professional services for January 2026",
"user_id": "user_ext_456",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
],
"created": "2024-01-13T00:00:00Z",
"modified": "2024-01-13T00:00:00Z",
"version": 1,
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
]
}Retrieves the version history of an invoice.
const response = await client.invoices.listHistory('inv_1234567890');| Name | Description |
|---|---|
idstring, required | Unique identifier for the invoice. |
| Name | Description |
|---|---|
dataobject[] | Version history of the invoice. |
{
"data": [
{
"id": "inv_1234567890",
"workspace_id": "ws_1234567890",
"line_items": [
{
"id": "item_1234567890",
"type": "payout",
"product_id": "prod_1234567890",
"price": {
"amount": "1000",
"unit_price": "1000",
"quantity": 1
},
"currency_code": "USD",
"description": "Professional services for January 2026",
"user_id": "user_ext_456",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
],
"created": "2024-01-13T00:00:00Z",
"modified": "2024-01-13T00:00:00Z",
"version": 1,
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
]
}Retrieves an invoice.
const response = await client.invoices.retrieve('inv_1234567890');| Name | Description |
|---|---|
idstring, required | Unique identifier for the invoice. |
| Name | Description |
|---|---|
dataobject | Invoice object. |
{
"data": {
"id": "inv_1234567890",
"workspace_id": "ws_1234567890",
"line_items": [
{
"id": "item_1234567890",
"type": "payout",
"product_id": "prod_1234567890",
"price": {
"amount": "1000",
"unit_price": "1000",
"quantity": 1
},
"currency_code": "USD",
"description": "Professional services for January 2026",
"user_id": "user_ext_456",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
],
"created": "2024-01-13T00:00:00Z",
"modified": "2024-01-13T00:00:00Z",
"version": 1,
"tags": [
{
"key": "department",
"value": "engineering"
}
],
"users": [
{
"id": "user_ext_789",
"external_id": "user_ext_789",
"balances": [
{
"payins": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"payouts": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"net": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"currency": "USD"
}
]
}
],
"balances": [
{
"payins": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"payouts": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"net": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"currency": "USD"
}
],
"payments": [
{
"amount": "150",
"currency": "USD",
"transaction": {
"id": "txn_dHhuX2ZyYWdfMDAx",
"external_id": "bank_txn_123",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
},
"type": "payin",
"posted": "2024-01-13T00:00:00Z",
"user": {
"id": "user_abc123",
"external_id": "user_ext_001"
}
}
]
}
}Updates an invoice.
const response = await client.invoices.update(
'inv_1234567890',
{
current_invoice_version: 3,
line_items: {
update: [
{
id: 'li_1234567890',
price: { amount: '2000' }
}
]
},
tags: { set: [{ key: 'department', value: 'engineering' }] }
}
);| Name | Description |
|---|---|
idstring, required | Unique identifier for the invoice. |
current_invoice_versionnumber, required | Current version of the invoice. Must match the stored version. |
tagsobject | Tag updates. |
line_itemsobject | Line item updates. |
| Name | Description |
|---|---|
dataobject | Invoice object. |
{
"data": {
"id": "inv_1234567890",
"workspace_id": "ws_1234567890",
"line_items": [
{
"id": "item_1234567890",
"type": "payout",
"product_id": "prod_1234567890",
"price": {
"amount": "1000",
"unit_price": "1000",
"quantity": 1
},
"currency_code": "USD",
"description": "Professional services for January 2026",
"user_id": "user_ext_456",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
],
"created": "2024-01-13T00:00:00Z",
"modified": "2024-01-13T00:00:00Z",
"version": 1,
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
}Searches invoices.
const response = await client.invoices.search(
{ filter: { status: 'open' } }
);| Name | Description |
|---|---|
filterobject, required | Filter criteria for the search. |
page_infoobject | Pagination parameters. |
| Name | Description |
|---|---|
dataobject | Search results for invoices. |
{
"data": {
"invoices": [
{
"id": "inv_1234567890",
"workspace_id": "ws_1234567890",
"line_items": [
{
"id": "item_1234567890",
"type": "payout",
"product_id": "prod_1234567890",
"price": {
"amount": "1000",
"unit_price": "1000",
"quantity": 1
},
"currency_code": "USD",
"description": "Professional services for January 2026",
"user_id": "user_ext_456",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
}
],
"created": "2024-01-13T00:00:00Z",
"modified": "2024-01-13T00:00:00Z",
"version": 1,
"tags": [
{
"key": "department",
"value": "engineering"
}
],
"users": [
{
"id": "user_ext_789",
"external_id": "user_ext_789",
"balances": [
{
"payins": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"payouts": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"net": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"currency": "USD"
}
]
}
],
"balances": [
{
"payins": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"payouts": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"net": {
"expected": "10000",
"actual": "5000",
"remaining": "5000"
},
"currency": "USD"
}
],
"payments": [
{
"amount": "150",
"currency": "USD",
"transaction": {
"id": "txn_dHhuX2ZyYWdfMDAx",
"external_id": "bank_txn_123",
"tags": [
{
"key": "department",
"value": "engineering"
}
]
},
"type": "payin",
"posted": "2024-01-13T00:00:00Z",
"user": {
"id": "user_abc123",
"external_id": "user_ext_001"
}
}
]
}
],
"page_info": {
"next_cursor": "string"
}
}
}