Clientary provides programmatic access to recurring schedules which can be used to periodically generate new invoices.
GET /api/v2/recurring/
{
"page_size": 10,
"page_count": 1,
"total_count": 2,
"recurring": [
{
"action":0,
"client_id":4,
"compound_tax":false,
"currency_code":"USD",
"due_period":10,
"id":2,
"next_date":"2014-03-16",
"note":"",
"number":"1000001",
"occurrences_remaining":10,
"payment_profile_id":null,
"po":null,
"status":0,
"summary":null,
"tax":8.25,
"tax2":2.0,
"tax2_label":"",
"tax_label":"",
"tax3_label": "",
"tax3": 0,
"time_interval":3,
"title":"Monthly Retainer",
"unlimited":false,
"updated_at":"2013-02-06T21:23:21-08:00",
"subtotal":49.99,
"total_cost":49.99,
"client":
{
...
},
"recurring_schedule_items": [
{
"id":3,
"item_type":1,
"price":"49.99",
"quantity":1.0,
"recurring_schedule_id":2,
"title":"Subscription",
"taxable?":false,
"secondary_tax?":false,
"tertiary_tax?":false,
"total_tax":0
},
...
]
},
...
]
}
0: Active1: Paused2: Stopped
0: Section Header3: Regular Invoice Line Item
0: Send1: Draft2: Autobill. payment_profile_id must be set to a valid ID.
1: Weekly2: Every 2 Weeks3: Semimonthly4: Every 4 Weeks5: Monthly6: Every 2 Months7: Quarterly8: Every 6 Months9: Annually10: Every 2 Years11: Every 4 MonthsGET /api/v2/recurring?page=2On a bulk GET Clientary will return 30 results at once. To paginate through more results, you can use the page parameter.
GET /api/v2/recurring/:id
{
"action":0,
"client_id":4,
"compound_tax":false,
"currency_code":"USD",
"due_period":10,
"id":2,
"next_date":"2014-03-16",
"note":"",
"number":"1000001",
"occurrences_remaining":10,
"payment_profile_id":null,
"po":null,
"status":0,
"summary":null,
"tax":8.25,
"tax2":2.0,
"tax2_label":"",
"tax_label":"",
"tax3_label": "",
"tax3": 0,
"time_interval":3,
"title":"Monthly Retainer",
"unlimited":false,
"updated_at":"2013-02-06T21:23:21-08:00",
"subtotal":49.99,
"total_cost":49.99,
"client":
{
...
},
"recurring_schedule_items": [
{
"id":3,
"item_type":1,
"price":"49.99",
"quantity":1.0,
"recurring_schedule_id":2,
"title":"Subscription",
"taxable?":false,
"secondary_tax?":false,
"tertiary_tax?":false,
"total_tax":0
},
...
]
}
POST /api/v2/recurring
{
"recurring_schedule": {
"number": 185,
"next_date": "2015-07-29",
"due_period": 30,
"currency_code": "USD",
"time_interval": 4,
"client_id": 123,
"recurring_schedule_items_attributes": [
{
"title": "foo",
"quantity": 1,
"price": 100
},
{
"title": "bar",
"quantity": 2,
"price": 200
}
]
}
}
Required Fields: due_period (in days), currency_code, next_date, time_interval, client_id (HTTP 422 on failure)
Optional Fields: number will be autoincremented from previous invoice numbers if not provided
Conditional Fields: invoice_item_attributes.title, invoice_item_attributes.quantity, invoice_item_attributes.price must be provided if any items are added (HTTP 422 on failure)
Unique Fields: number (HTTP 422 on failure)
PUT /api/v2/recurring/:idYou may provide a partial list of fields to update
{
"recurring_schedule": {
"number": 185,
"recurring_schedule_items_attributes": [
{
"id": 501,
"_destroy": true
},
{
"id": 502
"title": "bar",
"quantity": 2,
"price": 200
},
{
"title": "bar",
"quantity": 2,
"price": 200
}
]
}
}
In recurring_schedule_items_attributes, provide id to edit an existing recurring_schedule_items or omit id to create new recurring schedule items. Provide _destroy attribute along with id to delete the recurring schedule item.
Unique Fields: number (HTTP 422 on failure)
DELETE /api/v2/recurring/:id