API Authentication

In order to integrate with Hubtel APIs, you will need to create API keys for authentication purposes. Each API has specific keys that would need to be created to access them.

Authentication Methods

There are two main API authentication methods used: HTTP Basic Authentication, URL Authentication

Basic Authentication


The easiest way to authenticate is by using HTTP Basic Authentication. Basic Auth requires a Base64 encoded string of your **ClientID or API ID** as your username and **ClientSecret or API Key** as your password. The encoded string is sent in the HTTP Authorization header. See below for a sample header request information.

Authorization: Basic {base64_encode(ClientID:ClientSecret)}

So if khsqolyu is your ClientID and muahwiao is your ClientSecret, then the following header will be sent in the request:

Authorization: Basic a2hzcW9seXU6bXVhaHdpYW8=

👍

Sample Authorization Header

Authorization: Basic a2hzcW9sb3U6bWdhaHdpYW8=

Basic Authorization for SMS API using Postman

URL Authentication


URL Authentication involves passing your **ClientId** and **ClientSecret** as request parameters in the URL of each request. This form of authentication is used for the **Hubtel Quick Send SMS API**.

https://domain.website.com?From={From}&To={To}&Content={Content}&ClientId={ClientId}&ClientSecret={ClientSecret}&RegisteredDelivery={RegisteredDelivery}

Creating Keys


Creating Keys for the Sales API


API keys can be created on your account by an Employee with an Administrator role by:

  • Navigating to Manage on your account
  • Click "Programmable Integrations"
  • Select "Add New" to add a new API key

Click here to add a new API key to your account.

You will receive an API ID and API Key once this is processed.

All Sales made by your API Key will

  • Be linked to an Employee
  • Be linked to a Branch of your Business
  • Be linked to an inventory item of your Business

Use the API ID and API Key in Basic Authentication format to authenticate your requests.

NB: Be sure to copy and store your API details as these are not shown on your portal after you complete the process


Creating Keys for the SMS API


To create API keys for the SMS API, follow these steps:

  1. Login to your Hubtel account here and select your business.
  2. Navigate to the Manage tab.
  3. Select the Manage Messaging option to the left and proceed to choose Programmable SMS.
  4. Click the Create New API Keys button.
  5. Fill in the form and select Create.
  6. the Key is created successfully. To view the Client ID and Client Secret, select the API Key in the list. a pop up window with the details should be seen. Copy and keep your Client ID and Client Secret safe.

You can use the Client ID and Client Secret in the Basic HTTP Authentication format to authenticate your requests.



API Security Tips


Ensure that you keep your API keys safe and protected from any unauthorised use.
Do not share your API keys with any unauthorised third party. If you have reasons to believe that your API keys have been compromised, you can easily regenerate new API keys.

Updated 7 days ago

API Authentication


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.