Intervals API Resource:

expense

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

Collection

Allowed HTTP Methods
MethodGroup Access
GETAdministrator, Manager, Executive
Allowed Filters
Filter NameRequired?ExpectsDefaultDescription
projectid no integer1 Limits the list to expenses belonging to the projects with the ID(s) passed.
personid no integer1 Limits the list to expenses added by the persons with the ID passed.
clientid no integer1 Limits the list to expenses belonging to a project belonging to the clients with the ID passed.
managerid no integer1 Limits the list to expenses belonging to a project managed by the persons 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.
date no date Limits the list to expenses having the date passed.
sortfield no string date Sort the list by any of the following fields: id, projectid, date, expense, fee, note, personid, project, client, and person
sortdir no string DESC Sets the sort direction of the returned list. Must be either "ASC" or "DESC".
offset no integer Return expenses starting from the nth expense.
limit no integer 10 Sets a limit to the amount of expenses 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 /expense/

To filter the list based on certain parameters:

GET /expense/?sortdir={value}

Note: You can string together multiple filters.

Member

Allowed HTTP Methods
MethodGroup Access
GETAdministrator, Manager, Executive
DELETEAdministrator
POSTAdministrator, Manager
PUTAdministrator, Manager
Settable Fields for PUT and POST Requests
Field NameRequired?ExpectsDefaultDescription
projectid yes integer
personid no integer Set the person for the expense. If omitted, it defaults to the current person who is saving the expense.
date yes date The date that the expense was incurred.
expense yes double The amount of the expense is what the expense cost the company. Executive users do not see this value.
fee yes double This is what you are charging the client. If you are marking up the expense, the fee should be greater than the expense value. If you are not marking up the expense, this should be the same as the expense value.
note no string (255) The description of the expense.

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 expense
projectid no ID of the associated project
date no Date the expense was incurred (YYYY-MM-DD)
expense no Amount the expense cost the company (Not shown to Executive users; may be returned as a string in JSON)
fee no Amount charged to the client (markup over expense when higher) (May be returned as a string in JSON)
note yes Description of the expense
personid no ID of the person the expense belongs to (Not shown to Executive users)
dateiso no Same calendar date as `date` in ISO YYYY-MM-DD form (duplicated for clients that read `dateiso`)
project no Name of the associated project
projectlabel yes Project label name (empty when the project has no label)
projectlabelcolor yes Project label color for UI (e.g. hex without #)
client yes Name of the associated client (empty when none)
person no Full name of the person the expense belongs to (Not shown to Executive users)
clientlocalid yes Client local ID when a client is linked (empty otherwise)
projectlocalidunpadded yes Project local ID without zero-padding
clientid yes ID of the associated client
clientlocalidunpadded yes Client local ID without zero-padding (empty when no client)

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

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

To delete a particular member resource:

DELETE /expense/{id}/

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

To create a new member resource:

POST /expense/
{
    "projectid": value,
    "date": value,
    "expense": value,
    "fee": 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 /expense/{id}/
{
    "projectid": value,
    "expense": 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