Pular para o conteúdo

Lists and Pagination

List routes return your company's items, newest first, in pages.

Pagination

ParameterDefaultWhat it does
page1The page, starting at 1
limit10Items per page, from 1 to 100
sortcreated_atThe field to sort by
directiondescasc or desc

The response contains the items in data, the page URLs in links and the totals in meta:

JSON
{
  "data": [{ "id": 315968, "name": "Maria Silva" }],
  "links": {
    "first": "https://payments.cefis.com.br/api/v1/customers?page=1",
    "last": "https://payments.cefis.com.br/api/v1/customers?page=4",
    "prev": null,
    "next": "https://payments.cefis.com.br/api/v1/customers?page=2"
  },
  "meta": { "current_page": 1, "last_page": 4, "per_page": 10, "total": 37 }
}

To read everything, increase page up to meta.last_page.

Plans

GET /plans only paginates when you send page or limit. Without either, it returns all plans at once, without links and meta.

Filters

Filters that accept a list are repeated in the query string: status[]=active&status[]=overdue. Date ranges (YYYY-MM-DD) only apply when both the start and the end are sent.

GET /customers

FilterWhat it does
querySearches the name, email, CPF or CNPJ
status[]1 (active) or 2 (inactive)

GET /subscriptions

FilterWhat it does
customer_idA customer's subscriptions
plan_idA plan's subscriptions
status[]new, trial, active, overdue, paused, canceled or expired
querySearches the customer's name, email, CPF or CNPJ, the plan name and the custom_data values
created_at_start and created_at_endCreated within the range
end_at_start and end_at_endEnding within the range

It also accepts sort=customer_name, to sort by customer name.

GET /payments

FilterWhat it does
subscription_idA subscription's invoices
payment_link_idThe payments of a payment link
show_only_individualtrue: only one-off charges (no subscription, link or payment booklet)
method[]credit, debit, pix or billet
status[]unpaid, paid, unauthorized, canceled or reversed
querySearches the customer's name, email, CPF or CNPJ, the amount and the card digits
created_at_start and created_at_endCreated within the range
due_date_start and due_date_endDue within the range
paid_at_start and paid_at_endPaid within the range

Card validations and the start of trial periods do not appear in the payments list.