Intervals API Resource:

invoiceitem

The base URL for this resource is located at
https://api.myintervals.com/invoiceitem/

Invoice line items can either be created automatically upon invoice creation (in the case of prefilled invoices) or they can be user generated (in the case of freeform invoices, or line items added to prefilled invoices). You can tell the difference by reading the custom field value, which will be true in the case of user generated line items and false in the case of line items that were generated automatically.

For custom line items, you may edit any field value. For non-custom line items, however, the only editable field is the description field. Furthermore, non-custom line items are not deletable by any level of user. This is done to ensure that a project and its invoices always match up.

Collection

Allowed HTTP Methods
MethodGroup Access
GETAdministrator, Manager, Executive
Allowed Filters
Filter NameRequired?ExpectsDefaultDescription
invoiceid yes integer Limits the list to invoice items belonging to the invoice with the ID passed.
sortfield no string Sort the list by any of the following fields: id, invoiceid, name, description, quantity, rate, and amount.
sortdir no string Sets the sort direction of the returned list. Must be either "ASC" or "DESC".
offset no integer Return invoiceitems starting from the nth invoiceitem.
limit no integer 10 Sets a limit to the amount of invoiceitems 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 filter the list based on certain parameters:

GET /invoiceitem/?limit={value}

Note: You can string together multiple filters.

Member

Allowed HTTP Methods
MethodGroup Access
GETAdministrator, Manager, Executive
DELETEAdministrator, Manager
POSTAdministrator, Manager
PUTAdministrator, Manager
Settable Fields for PUT and POST Requests
Field NameRequired?ExpectsDefaultDescription
invoiceid yes integer The ID of the invoice to which this item applies. Not settable for existing non-custom items.
name yes string (255) The name for this line item.
description no string The line item description.
quantity no double Settable only for new/custom line items.
rate no double Settable only for new/custom line items.
amount yes double The value for the amount must be the product of the quantity and the rate, if they are both specified. Not settable for existing non-custom items.

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 NameNullableDescription
id no Unique identifier for the invoice line item
invoiceid no ID of the parent invoice
name no Line item title or label
description yes Line item description (may be empty)
quantity yes Quantity (empty for custom lines or when not used; may be a string in JSON)
rate yes Rate per unit (empty when not used; may be a string in JSON)
amount no Line total amount (May be returned as a string in JSON)
custom no Whether this is a custom line item ("t") or a standard/catalog line ("f")
priority no Display sort order on the invoice (lower first; often a string in JSON)

When retrieving a collection (GET /invoiceitem/), the response envelope includes: personid (authenticated user's ID), status ("OK"), code (200), listcount (total matching records before limit/offset), and invoiceitem (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 /invoiceitem/{id}/

Assuming no errors, the server will respond with 200 OK and the object requested.

To delete a particular member resource:

DELETE /invoiceitem/{id}/

Assuming no errors, the server will respond with 200 OK.

To create a new member resource:

POST /invoiceitem/
{
    "invoiceid": value,
    "name": value,
    "amount": 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 /invoiceitem/{id}/
{
    "description": value,
    "amount": value
}

Assuming no errors, the server will respond with 202 Accepted and the entire element. This will allow you to verify the field values.

Start tracking time today

Join 5,000+ companies spending their time wisely with Intervals.

Try Intervals free