Pagination
List endpoints in the Cobrofácil API use Laravel's length-aware pagination format. Results are returned in data, and pagination metadata is returned alongside the collection so you can move between pages and show record counts in your application.
Paginated endpoints use the page query parameter. The default page size is 25 items, and the current page size is reported in the per_page response field.
Requesting a page
Pass page to request a specific page of results. When next_page_url is null, you are on the last page. When prev_page_url is null, you are on the first page.
- Name
page- Type
- integer
- Description
The page number to return. If omitted, the API returns page 1.
Manual pagination using cURL
curl -G https://api.cobrofacil.com/api/v1/transactions \
-H "Authorization: Bearer {token}" \
-H "X-Environment: sandbox" \
-d page=2
Paginated response
{
"current_page": 2,
"data": [
{
"id": "019734bb-1f46-73bb-95d0-62e98a2f6247",
// ...
}
],
"first_page_url": "https://api.cobrofacil.com/api/v1/transactions?page=1",
"from": 26,
"last_page": 4,
"last_page_url": "https://api.cobrofacil.com/api/v1/transactions?page=4",
"links": [
{
"url": "https://api.cobrofacil.com/api/v1/transactions?page=1",
"label": "pagination.previous",
"page": 1,
"active": false
},
{
"url": "https://api.cobrofacil.com/api/v1/transactions?page=1",
"label": "1",
"page": 1,
"active": false
},
{
"url": "https://api.cobrofacil.com/api/v1/transactions?page=2",
"label": "2",
"page": 2,
"active": true
},
{
"url": "https://api.cobrofacil.com/api/v1/transactions?page=3",
"label": "3",
"page": 3,
"active": false
},
{
"url": "https://api.cobrofacil.com/api/v1/transactions?page=3",
"label": "pagination.next",
"page": 3,
"active": false
}
],
"next_page_url": "https://api.cobrofacil.com/api/v1/transactions?page=3",
"path": "https://api.cobrofacil.com/api/v1/transactions",
"per_page": 25,
"prev_page_url": "https://api.cobrofacil.com/api/v1/transactions?page=1",
"to": 50,
"total": 87
}
Response fields
- Name
current_page- Type
- integer
- Description
Current page number.
- Name
data- Type
- array
- Description
The resources returned for the current page.
- Name
first_page_url- Type
- string
- Description
URL for the first page.
- Name
from- Type
- integer
- Details
- nullable
- Description
Number of the first item on the current page. This is
nullwhen there are no results.
- Name
last_page- Type
- integer
- Description
Last page number.
- Name
last_page_url- Type
- string
- Description
URL for the last page.
- Name
links- Type
- array
- Description
Pagination links for previous, numbered pages, and next. Each link contains
url,label,page, andactive.
- Name
next_page_url- Type
- string
- Details
- nullable
- Description
URL for the next page, or
nullwhen there is no next page.
- Name
path- Type
- string
- Description
URL for the paginated endpoint without the page query parameter.
- Name
per_page- Type
- integer
- Description
Number of items per page.
- Name
prev_page_url- Type
- string
- Details
- nullable
- Description
URL for the previous page, or
nullwhen there is no previous page.
- Name
to- Type
- integer
- Details
- nullable
- Description
Number of the last item on the current page. This is
nullwhen there are no results.
- Name
total- Type
- integer
- Description
Total number of items matching the request.