Parameters

All collection endpoints are paginated with the following optional parameters:

Parameter Type Default Range Description
page integer 1 1 or more The page number to use in pagination.
per_page integer 100 1 to 100 The number of records to return per page.

Paging example

For example, to retrieve the first page of clients, you would make the following request:

curl "https://api.harvestapp.com/v2/clients" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (yourname@example.com)"

Response:

{
  "clients": [
    "{100 client objects}"
  ],
  "page": 1,
  "total_pages": 3,
  "total_entries": 257,
  "next_page": 2,
  "previous_page": null,
  "links": {
    "first": "https://api.harvestapp.com/v2/clients?page=1&per_page=100",
    "next": "https://api.harvestapp.com/v2/clients?page=2&per_page=100",
    "previous": null,
    "last": "https://api.harvestapp.com/v2/clients?page=3&per_page=100"
  }
}

To retrieve the next page of clients, add page=2 to the URL:

curl "https://api.harvestapp.com/v2/clients?page=2" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (yourname@example.com)"

Response:

{
  "clients": [
    "{100 client objects}"
  ],
  "page": 2,
  "total_pages": 3,
  "total_entries": 257,
  "next_page": 2,
  "previous_page": 1,
  "links": {
    "first": "https://api.harvestapp.com/v2/clients?page=1&per_page=100",
    "next": "https://api.harvestapp.com/v2/clients?page=3&per_page=100",
    "previous": "https://api.harvestapp.com/v2/clients?page=1&per_page=100",
    "last": "https://api.harvestapp.com/v2/clients?page=3&per_page=100"
  }
}

To retrieve the final page of clients, change the page parameter to 3:

curl "https://api.harvestapp.com/v2/clients?page=3" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (yourname@example.com)"

Response:

{
  "clients": [
    "{57 client objects}"
  ],
  "page": 3,
  "total_pages": 3,
  "total_entries": 257,
  "next_page": null,
  "previous_page": 2,
  "links": {
    "first": "https://api.harvestapp.com/v2/clients?page=1&per_page=100",
    "next": null,
    "previous": "https://api.harvestapp.com/v2/clients?page=2&per_page=100",
    "last": "https://api.harvestapp.com/v2/clients?page=3&per_page=100"
  }
}

Per page example

To decrease the number of records returned, add the per_page parameter to the URL. For example, to retrieve the most recently created client:

curl "https://api.harvestapp.com/v2/clients?per_page=1" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Harvest-Account-Id: $ACCOUNT_ID" \
  -H "User-Agent: MyApp (yourname@example.com)"

Response:

{
  "clients": [
    "{1 client object}"
  ],
  "page": 1,
  "total_pages": 257,
  "total_entries": 257,
  "next_page": 2,
  "previous_page": null,
  "links": {
    "first": "https://api.harvestapp.com/v2/clients?page=1&per_page=1",
    "next": "https://api.harvestapp.com/v2/clients?page=2&per_page=1",
    "previous": null,
    "last": "https://api.harvestapp.com/v2/clients?page=257&per_page=1"
  }
}