Developers

API Setup

Introduction

 
Important

Please read this page carefully and make sure that you have all your credentials and necessary assets available before you start. If you need help, contact Inbenta.

The purpose of the Search API is to grant access to the contents stored on Inbenta's Search application. You can then use this content in any user-generated application and track event data for usage analysis. You can find these reports in the Dashboard of the Search App.

This page describes how to set up the Search API, request and retrieve information.

Obtain Authentication and Authorization Keys

All requests to the Search API endpoints will be authenticated and authorized.
To obtain your credentials, see Finding your API credentials in the Help Center.

  • The API Key will grant you access to the APIs.
  • The Secret allows the request to access your instance's data.
  • The Domain Key allows the request to access your instance's data, but only for requests coming from the browser (front-side integrations) and from a limited set of domains.
 
Note

For a complete description of keys and authorization methods, see the Authorization section.

 
Caution

Your Secret must remain confidential. To prevent third parties from accessing your API, always perform this request in a server-side environment. Never expose your secret in client-side integrations. For more information, see the Authorization page.

Use the access token

You need a valid access token to use the Search API. Follow the steps listed in the Authorization section to set up your page with your token and refresh it. Once you obtain the access token, you must append it to every request inside the Authorization header, with the format Bearer <your_access_token>.

Get the API URL

The base URLs of the Search API are dependent on the instance, so that Inbenta can offer worldwide service and allow service auto-escalation. This base URL may change over time. Do not store or cache it persistently. Instead, get it every time you obtain a new valid access token.

To get the current API URL for your instance, get the apis parameter from the same response that gave you the access token. Extract the URL corresponding to the instance product:

{
    "accessToken": "******************",
    "expiration": 1573563837,
    "expires_in": 1200,
    "apis": {
        ...
        "search": "https://endpoint.inbenta.example/prod/search"
        ...
    }
}

Use this response to pick the URL for the product that you want to use.

 
Caution

Do not perform this request after each API call. You would quickly exceed your rate limits.

Specify the version

Once you have picked the appropriate product URL for your implementation, remember to specify the version of the API.

You specify the version at the end of the URL with v + {version}.

Examples:

The URLs for the current latest version of each product API look like this:

  • Search: "https://endpoint.inbenta.example/prod/search/v1"

Use the API

Authorization

 
Note

For a complete description of keys and authorization methods, see the Authorization section.

You need a valid access token to use the Search API. Follow the steps listed in the Authorization section to set up your page with your token and refresh it.

 
Caution

Your Secret must remain confidential. To prevent third parties from accessing your API, always perform this request in a server-side environment. Never expose your secret in client-side integrations.

Start Session

Once authorized, you may start the session. This operation is not mandatory, but it is strongly recommended. Having a session allows you to relate all events performed by a user within their interaction with your platform. In order to start the session, you will need a session token that can be generated using the POST /tracking/session endpoint.

 
Note

For more information, see the Tracking Events section.

Retrieve information

The next step is to retrieve information from the Content Base.

Example: Obtain results from a user question using the POST /federated-search endpoint, which allows to make a search in the content database. This endpoint requires the API Key, an access token and a query that searches the database.

For more information about POST /federated-search and other endpoints, see the API routes section.

Track events

  • For more information on what data Inbenta tracks and how, see the Tracking Events section.
  • Inbenta provides tracking codes for every content shown. For specific information about what each API endpoint tracks by default, see the API Routes section.
  • To improve the accuracy of your analytics, Inbenta recommends tracking as many event types as possible. To see these recommendations per endpoint, see the Search Tracking Guidelines section.