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 a Super Administrator and an Administrator role by:

  • Kindly log into your hubtel account here

  • A product item must be created in your account after logging into your Hubtel account here

  • Kindly click on the Add button on the top right corner and add the name of the product and fill the necessary blank spaces with the needed requirements.

  • After the description has been given for the API item, kindly endeavour to fill the Quantity and Pricing Columns with an amount of GHS 1 .ei. for both the Cost Price and Selling Price. For the Quantity in Stock, this could be 5 where the Low Stock Limit could be 1 preferrably.
    NB: This does not affect the money in your account in anyway, go ahead to Save and Continue

  • 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 after the creation of a product item.

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

Kindly check out the video tutorial below


Creating Keys for the SMS API as a Business.


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

  • Login to your Hubtel account here and select your business.

  • Navigate to the Manage tab.

  • Select the Manage Messaging option to the left and proceed to choose Programmable SMS.

  • Click the Create New API Keys button.

  • Fill in the form and select Create.

  • 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.

NB: Be sure to copy and store your API details

Kindly check out the video tutorial below


Creating Keys for the SMS API as a User


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

  • Log in to your Hubtel account here.

  • Navigate to the Messaging and opt for Manage.

  • Select the Programmable SMS.

  • Click the Create New API Keys button.
    NB: It is mandatory to add your Sender ID when creating your API Keys because messages sent will use the Sender ID affiliated to API Keys.
    NB: Kindly endeavor to top up your API keys when creating your Sender ID by clicking on TOP UP?

  • Fill in the form and select Create.

  • 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.

NB: Be sure to copy and store your API details

Kindly check out the video tutorial below


API Security Tips

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

Updated 2 months 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.