Introduction

API Basics

The Lahza API provides comprehensive access to the various features available on our dashboard, allowing you to leverage and expand their functionality within your own application. Our API follows RESTful principles and is structured around the primary resources that you'll interact with, with a few exceptions worth mentioning.

Sign up for a free Lahza account to access and test the API. Test keys will be provided for making API calls. Requests and Response

Requests and Response

{
  "status": [boolean],  // Only true if the details provided could be processed and no error occured while processing
  "message": [string], // Explains why status is false... Entirely informational. Please only log this but do not use for your checks
  "data": [object]    // contains actionable result of processing if present
}

We recommend using HTTP status codes to determine the outcome of an API call. However, we also provide additional keys to give you more information about the response.

The "status" key indicates whether the request was successful or not. If it is set to true, the request was successful. If it is set to false, there was an error.

The "message" key provides a summary of the response and its status. For example, when retrieving a list of customers, the message might say "Customers retrieved". In case of an error, the message will contain a description of the error, such as the authorization header situation mentioned earlier. This key is consistent across all requests.

The "data" key contains the actual result of the request. It can be an object or an array, depending on the type of request made. For example, retrieving a single customer will return a customer object in the data key, while retrieving a list of customers will return an array of customer objects.

The "meta" key is used to provide additional contextual information about the contents of the data key. For instance, when retrieving a list of transactions for a customer, pagination parameters can be included in the meta key to limit the result set. The meta key will contain an object with relevant attributes to provide this context.

"meta": {
  "total": 2,
  "skipped": 0,
  "perPage": 50,
  "page": 1,
  "pageCount": 1
}

Keys

Total Number

This is the total number of transactions that were performed by the customer.

Skipped Number

This is the number of records skipped before the first record in the array returned.

PerPage Number

This is the maximum number of records that will be returned per request. This can be modified by passing a new value as a perPage query parameter. Default: 50

Page Number

This is the current page being returned. This is dependent on what page was requested using the page query parameter. Default: 1

PageCount Number

This is how many pages in total are available for retrieval considering the maximum records per page specified. For context, if there are 51 records and perPage is left at its default value, pageCount will have a value of 2.

Last updated