Recurring Billing (Retainers)
Set up and manage recurring billing agreements. Retainers automatically generate documents on a schedule.
Use cases: Use retainers to automate monthly invoicing for subscription services or ongoing contracts.
GET
/retainersList all retainers.
Query Parameters
| Name | Type | Description | |
|---|---|---|---|
page | number | Page number (default 1). | |
limit | number | Items per page (default 50). |
Request
curl -X GET "https://api.glance.co.il/retainers" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"data": [
{
"id": 1,
"client": {
"visibleId": 1,
"name": "Acme Corp"
},
"amount": 5000,
"frequency": "monthly",
"documentType": "invoiceReceipt",
"startDate": "2024-01-01",
"status": "active",
"nextDate": "2024-04-01"
}
],
"pagination": {
"total": 5,
"limit": 50,
"offset": 0,
"hasMore": false
}
}GET
/retainers/:idGet a single retainer.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
id | number | required | The retainer ID. |
Request
curl -X GET "https://api.glance.co.il/retainers/:id" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"data": {
"id": 1,
"client": {
"visibleId": 1,
"name": "Acme Corp"
},
"amount": 5000,
"frequency": "monthly",
"documentType": "invoiceReceipt",
"startDate": "2024-01-01",
"status": "active",
"nextDate": "2024-04-01",
"products": [
{
"description": "Monthly Consulting",
"units": 1,
"price": 5000
}
],
"notes": "Auto-generated monthly invoice"
}
}POST
/retainers/createCreate a new retainer / recurring billing agreement.
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
clientId | number | required | Client visible ID. |
amount | number | required | Recurring amount. |
frequency | string | required | Billing frequency: "monthly", "quarterly", or "yearly". |
startDate | string | required | Start date (YYYY-MM-DD). |
documentType | string | required | Type of document to generate: "invoice" or "invoiceReceipt". |
products | object[] | Line items for the generated documents. | |
description | string | Line item description. | |
units | number | Quantity. | |
price | number | Price per unit. | |
notes | string | Notes to include on generated documents. |
Request
curl -X POST "https://api.glance.co.il/retainers/create" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"clientId": 0,
"amount": 0,
"frequency": "example_frequency",
"startDate": "example_startDate",
"documentType": "example_documentType",
"products": "example_products",
"notes": "example_notes"
}'Response
Response
{
"data": {
"id": 3,
"clientId": 2,
"amount": 3000,
"frequency": "monthly",
"documentType": "invoice",
"startDate": "2024-04-01",
"status": "active",
"nextDate": "2024-04-01"
}
}PUT
/retainers/:idUpdate a retainer.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
id | number | required | The retainer ID. |
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
clientId | number | Client visible ID. | |
amount | number | Recurring amount. | |
frequency | string | Billing frequency: "monthly", "quarterly", or "yearly". | |
startDate | string | Start date (YYYY-MM-DD). | |
documentType | string | Document type: "invoice" or "invoiceReceipt". | |
products | object[] | Line items. | |
notes | string | Notes. |
Request
curl -X PUT "https://api.glance.co.il/retainers/:id" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"clientId": 0,
"amount": 0,
"frequency": "example_frequency",
"startDate": "example_startDate",
"documentType": "example_documentType",
"products": "example_products",
"notes": "example_notes"
}'Response
Response
{
"data": {
"id": 1,
"amount": 6000,
"frequency": "monthly",
"status": "active"
}
}DELETE
/retainers/:idDelete (deactivate) a retainer.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
id | number | required | The retainer ID. |
Request
curl -X DELETE "https://api.glance.co.il/retainers/:id" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"data": {
"success": true
}
}POST
/retainers/reactivate/:idReactivate a previously deactivated retainer.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
id | number | required | The retainer ID. |
Request
curl -X POST "https://api.glance.co.il/retainers/reactivate/:id" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"data": {
"id": 1,
"status": "active",
"nextDate": "2024-04-01"
}
}