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/retainers

List all retainers.

Query Parameters

NameTypeDescription
page
numberPage number (default 1).
limit
numberItems 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/:id

Get a single retainer.

Path Parameters

NameTypeDescription
id
numberrequiredThe 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/create

Create a new retainer / recurring billing agreement.

Body Parameters

NameTypeDescription
clientId
numberrequiredClient visible ID.
amount
numberrequiredRecurring amount.
frequency
stringrequiredBilling frequency: "monthly", "quarterly", or "yearly".
startDate
stringrequiredStart date (YYYY-MM-DD).
documentType
stringrequiredType of document to generate: "invoice" or "invoiceReceipt".
products
object[]Line items for the generated documents.
description
stringLine item description.
units
numberQuantity.
price
numberPrice per unit.
notes
stringNotes 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/:id

Update a retainer.

Path Parameters

NameTypeDescription
id
numberrequiredThe retainer ID.

Body Parameters

NameTypeDescription
clientId
numberClient visible ID.
amount
numberRecurring amount.
frequency
stringBilling frequency: "monthly", "quarterly", or "yearly".
startDate
stringStart date (YYYY-MM-DD).
documentType
stringDocument type: "invoice" or "invoiceReceipt".
products
object[]Line items.
notes
stringNotes.

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/:id

Delete (deactivate) a retainer.

Path Parameters

NameTypeDescription
id
numberrequiredThe 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/:id

Reactivate a previously deactivated retainer.

Path Parameters

NameTypeDescription
id
numberrequiredThe 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"
  }
}