Skip to content
On this page

Response structure

Explore the structure of our API, let's look at some status responses and errors codes.

Success response

Success response comes with HTTP status 2xx, and its structure is like below :

json
    {
      "status": "success",
      "data"  : [...],
      "meta"  : {
        "pagination" :  {
          "total": 100,
          "count": 10,
          "per_page": 10,
          "current_page": 1,
          "total_pages": 1,
          "links": {
            "next": "<baseUrl>/<version>/<endpoint>?page=2",
            "previous": null,
            "first": "<baseUrl>/<version>/<endpoint>?page=1",
            "last": "<baseUrl>/<version>/<endpoint>?page=10",
          }
        }
      }
    }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

The success response is organized into three parts: "status" indicates success, "data" holds the requested information, and "meta" offers extra details.

Meta

In success response "meta" provides extra details such as pagination

Pagination

Pagination details comes in meta object with pagination information's :

FieldDescription
totalTotal number of items in the dataset.
countNumber of items on the current page.
per_pageNumber of items per page.
current_pageThe current page number being viewed.
total_pagesTotal number of pages based on page size.
links.next Link to the next page of results, if available.
links.previousLink to the previous page of results, if available.
links.firstLink to the first page.
links.lastLink to the last page.

Error response

Error response comes with HTTP status 3xx, 4xx, 5xx and its structure is like below :

json
    {
      "status": "error",
      "message"  : "error message",
      "code"  : "XXX"
    }
1
2
3
4
5

The error response consists of three parts: "status" marks the error, "message" explains the issue, and "code" provides a unique identifier for swift resolution.

Custom errors

In some contexts, the API may return errors with specific codes, below some examples

Error CodeDescription
10005Currency was not found
20000lead already exists in the system