# Introduction

KPro Marketing provides APIs to synchronize your own system data with ours. Three APIs are available:

  • The Leads API to push leads from other platforms or pull your leads from KPro Marketing.

  • The Inventory API to synchronize your developments and properties.

  • The Listings API to push your listings to KPro Marketing and make them visible in Keaze and Homes for Londoners, or get them from KPro Marketing to publish them in another portal.

The Inventory API provide endpoints to do bulk operation, but also to insert or update a single development or property.

# API Reference

There are two kinds of APIs, the ones organized around REST and the ones oriented to do bulk operations. All of them have predictable resource-oriented URLs, accepts JSON-encoded request bodies and returns JSON-encoded responses, and uses standard HTTP response codes and verbs.

RESTful APIs use the prefix api/rest/ while Bulk APIs start with api/bulk/.

# Authorization

The API uses keys for authorization, which are tokens that should be provided when making API calls. The key must be sent in the query string using the parameter api_key.

You can generate your API key in the KPro Marketing Settings section. If you forgot or think you API key security has been compromised, you can generate a new one, although the previous one will be deprecated.

Example:

GET /api/bulk/leads?api_key=2582c42948404c69a35ad3daeed47484d4a54cd56a264e8b8980fcac3897ff75

# Responses and Errors

Any API request will receive a standard HTTP response code.

# Response Ranges

2xx: Sucessful request

4xx: Failed Request (Client error)

5xx: Failed Request (Server error)

# Common response codes are

HTTP Status Code Description Verbs
200 OK Successful. GET, PUT, PATCH, DELETE
201 Created Created. POST
400 Bad Request Bad input parameter. All
401 Unauthorized Missing or bad API key. All
404 Not Found Resource not found, usually when ID not found or invalid. When using GET for collections, it will never return 404, but an empty data array. GET, PUT, PATCH, DELETE
405 Method Not Allowed The resource doesn't support the specified HTTP verb. All
409 Conflict Conflict. Duplicate data or invalid data state would occur. POST
422 Unprocessable Entity Usually when there are validation errors. Attribute message will contain the kind of error, attribute errors will contain the list of errors related to each parameter. POST, PUT, PATCH
500 Internal Server Error Servers are not working as expected. The request is probably valid but needs to be requested again later. All
503 Service Unavailable Service Unavailable. All

# Envelopes

When returning single objects no envelope will be used.

For collections, an envelope will be always used, which will contain the field data for the collection.

{
  "data": [items]
}

Paginated collections envelopes will also contain two more attributes, pagination and links, with the following structure:

{
  "data": [items],
  "pagination": {
    "currentPage": 2, // current page number
    "perPage": 10,    // number of items to be shown per page
    "total": 212,     // total number of items
    "from": 11,       // number of the first item in the result
    "to": 20,         // number of the last item in the result  
    "lastPage": 23,   // last page number
  }
  "links": {
    "first": "url to the first page",
    "prev": "url to the previous page",
    "next": "url to the next page",
    "last": "url to the last page",
  }
}

# Test and Production environments

KPro Marketing provides a Test environment to test your solution during the implementation process. The base url for the Test API is:

https://test.api.keaze.com

Contact us to get access to the Test environment.

Once your solution is ready to go to production, just change the base url by the production one:

https://api.keaze.com

All endpoints in this guide will use relative urls, which are independent of the environment. To build the absolute url just use the right base url.