API Pagination

All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list tickets, list transactions, and list devices. These list API methods share a common structure, taking at least these three parameters: limit, starting_after, and ending_before.

Copper utilizes cursor-based pagination via the starting_after and ending_before parameters. Both parameters take an existing resource id value. The API returns objects in reverse chronological order. The ending_before parameter returns objects listed before the named object. The starting_after parameter returns objects listed after the named object. These parameters are mutually exclusive - only one of starting_after or ending_before may be used.

Parameters

All pagination parameters are optional.

Name Type Description
limit integer A limit on the number of objects to be returned, between 1 and 100. Default value is 10.
starting_after string A cursor for use in pagination. This is a resource ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.
ending_before string A cursor for use in pagination. This is a resource ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

List Response Format

API responses returning lists of resources will generally have the same structure:

{
  "object": "list",
  "data": [ /* 1st resource */, /* 2nd resource */, /* etc */ ],
  "has_more": true
}

Descriptions for the object, data and has_more response properties follows.

Name Type Description
object string Describes the object type returned. For list responses, this is always list.
data array An array containing the actual response objects, paginated by any request parameters.
has_more boolean Whether or not there are more elements available after this set. If false, this set comprises the end of the list.