Intervals API Resource:
invoice
The base URL for this resource is located at
https://api.myintervals.com/invoice/
There are two types of invoices:
Freeform invoices are blank invoices, and contain no line items initially. To add line items, you must create them through the invoiceitem resource.
Prefilled invoices are based on work performed, and on creation include line items based on time entries from the project to which the invoice belongs.
You can specify the type of invoice you want by using the datebegin and dateend fields. If you leave these fields blank, the invoice will be created as freeform. However, if you enter values for either of these fields, time entries will be imported from the invoice's project according to the date range you specify.
Once an invoice has been created, you cannot change the type of invoice it is, though you can add and edit line items no matter what the type (see the invoiceitem resource for more information about invoice restrictions).
If you have a prefilled invoice, you can rebuild it by changing either the datebegin or dateend field (or both). This has the effect of re-importing all time entries for your date range, while preserving any custom line items that your invoice may contain.
Collection
| Allowed HTTP Methods | |
|---|---|
| Method | Group Access |
| GET | Administrator, Manager, Executive |
| Allowed Filters | ||||
|---|---|---|---|---|
| Filter Name | Required? | Expects | Default | Description |
| localid | no | integer1 | Restricts the list based on a invoice's "localid," which is the number that appears associated with the invoice in the Intervals application. | |
| clientid | no | integer1 | Limits the list to invoices belonging to the client with the ID passed. | |
| projectid | no | integer1 | Limits the list to invoices belonging to the project with the ID passed. | |
| datebegin | no | date | Limits the list to expenses having a date on or after the date passed. | |
| dateend | no | date | Limits the list to expenses having a date on or before the date passed. | |
| status | no | string | Useful for specifying specific invoice statuses. Can be either "outstanding" or "paid". | |
| search | no | string | Limits the list to invoices that match the search string.. Searches title, description, localid, purchase order and address fields. | |
| sortfield | no | string | Sort the list by any of the following fields: id, projectid, date, title, description, localid, purchaseorder, project, client, datepaid, subtotal, total, payments, balance, datedue, daysoverdue, projectlabelid, projectlabel (sorted by project labels alphabeticaly), and projectabel_order (sorted by project label order in Settings & Defaults). | |
| sortdir | no | string | Sets the sort direction of the returned list. Must be either "ASC" or "DESC". | |
| offset | no | integer | Return invoices starting from the nth invoice. | |
| limit | no | integer | 10 | Sets a limit to the amount of invoices returned in the response. |
1 Indicates that multiple values are allowed, in CSV format (e.g. "3,5,11,19").
2 This field accepts HTML, but certain HTML elements may be stripped out.
Examples
To retrieve the entire list of this resource:
GET /invoice/
To filter the list based on certain parameters:
GET /invoice/?datebegin={value}
Note: You can string together multiple filters.
Member
| Allowed HTTP Methods | |
|---|---|
| Method | Group Access |
| GET | Administrator, Manager, Executive |
| DELETE | Administrator, Manager |
| POST | Administrator, Manager |
| PUT | Administrator, Manager |
| Settable Fields for PUT and POST Requests | ||||
|---|---|---|---|---|
| Field Name | Required? | Expects | Default | Description |
| projectid | yes | integer | ||
| date | yes | date | ||
| termid | yes | integer | ||
| termother | no | string (255) | If you specify the termid as "other" (6), you can assign a custom term name to this invoice. | |
| termotherdatedue | no | date | If you specify the termid as "other" (6), you must specify the custom due date of this invoice. | |
| title | yes | string (255) | The invoice title. | |
| description | no | string | ||
| addressfrom | no | string | ||
| addressto | no | string | ||
| purchaseorder | no | string (55) | ||
| tax | no | double | ||
| secondtax | no | double | For places with dual taxation levels, the value of the secondary tax level. | |
| secondtaxcompound | no | boolean | f | For places with dual taxation levels, true if the second tax is compounded, false if the second tax is added. |
| disclaimer | no | string | ||
| datebegin | no | date | If you wish to create a pre-filled invoice based on work performed, set this to the start date of the time entries you wish to include. | |
| dateend | no | date | If you wish to create a pre-filled invoice based on work performed, set this to the end date of the time entries you wish to include. | |
string (xxx) indicates a string with a maximum length of xxx characters.
Response Fields
The fields below are returned in GET responses. Boolean values are "t" / "f" strings. Numeric IDs and floats are returned as strings. Nullable fields may be JSON null.
| Response Fields | ||
|---|---|---|
| Field Name | Nullable | Description |
| id | no | Unique identifier for the invoice |
| projectid | no | ID of the associated project |
| date | no | Invoice date (YYYY-MM-DD) |
| termid | no | ID of the payment term |
| termother | yes | Custom term text when using a non-standard term (empty when using a predefined term) |
| termotherdatedue | yes | Due date when using a custom term (empty when not applicable) |
| title | no | Invoice title |
| description | yes | Invoice description |
| localid | no | Human-readable invoice number / local ID (zero-padded) |
| addressfrom | yes | Billing address (from) |
| addressto | yes | Billing address (to) |
| purchaseorder | yes | Purchase order number |
| tax | yes | Primary tax rate or configuration (empty when none; often a string in JSON) |
| disclaimer | yes | Invoice disclaimer text |
| datebegin | yes | Work period start (invoiced range, YYYY-MM-DD) (Admin/Manager only) |
| dateend | yes | Work period end (invoiced range, YYYY-MM-DD) (Admin/Manager only) |
| second_tax | yes | Second tax rate or configuration (empty when dual tax not used) |
| second_tax_compound | yes | Second tax compound flag or value (empty when not applicable) |
| project | no | Name of the associated project |
| client | yes | Name of the associated client (empty when none) |
| clientid | yes | ID of the associated client (may be absent in some serializers; empty when none) |
| term | no | Human-readable payment term label (e.g. Net 90) |
| datepaid | yes | Date the invoice was fully paid (empty when unpaid) |
| subtotal | no | Invoice subtotal before taxes (May be returned as a string in JSON) |
| taxamount | yes | Computed primary tax amount (empty when none) |
| secondtaxamount | yes | Computed second tax amount (empty when none) |
| numitems | no | Count of line items on the invoice |
| total | no | Invoice total after taxes (May be returned as a string in JSON) |
| payments | no | Total payments applied to this invoice (May be returned as a string in JSON) |
| balance | no | Outstanding balance (total minus payments) (May be returned as a string in JSON) |
| datedue | yes | Invoice due date (YYYY-MM-DD) |
| daysoverdue | no | Days past the due date (0 when not overdue; often a string in JSON) |
| daysoverduepaid | yes | Days overdue before paid, or related paid-overdue metric (empty when not applicable) |
| status | no | Invoice status (e.g. overdue, paid — values depend on account) |
| projectlabel | yes | Name of the associated project label |
| projectlabel_order | yes | Sort order of the project label within the account |
| projectlabelid | yes | ID of the associated project label |
When retrieving a collection (GET /invoice/), the response envelope includes: personid (authenticated user's ID), status ("OK"), code (200), listcount (total matching records before limit/offset), and invoice (array of result objects). Defaults, no cap on limit, and how to paginate using listcount are described in the API Introduction (Pagination).
Examples
To retrieve one member resource:
GET /invoice/{id}/
Assuming no errors, the server will respond with 200 OK and the object requested.
To delete a particular member resource:
DELETE /invoice/{id}/
Assuming no errors, the server will respond with 200 OK.
To create a new member resource:
POST /invoice/
{ "projectid": value, "date": value, "termid": value, "title": value }
Assuming no errors, the server will respond with 201 Created and the newly-created element. This will allow you to get the id of the item you just created and verify the field values. Note: Only required fields were listed here. The entire list of possible fields is above.
To update a member resource:
PUT /invoice/{id}/
{ "tax": value, "dateend": value }
Assuming no errors, the server will respond with 202 Accepted and the entire element. This will allow you to verify the field values.
Documentation
Resources
- client
- contactdescriptor
- contacttype
- document
- expense
- group
- invoice
- invoiceitem
- invoicenote
- invoiceterm
- me
- milestone
- milestonenote
- module
- payment
- paymenttype
- person
- personcontact
- project
- projectlabel
- projectmodule
- projectnote
- projectteam
- projectworktype
- quota
- request
- task
- tasklistfilter
- tasknote
- taskpriority
- taskstatus
- time
- timer
- worktype
API Support
Looking for help?
Contact our support team.
OpenAPI
OpenAPI JSON spec (public)
Start tracking time today
Join 5,000+ companies spending their time wisely with Intervals.
Try Intervals free