Header Authorization


There are two ways of authenticating requests made to the SMSLeopard API.

The above authentication methods require that you generate API keys from your account.

Header Authorization

If you are integrating with the SMSLeopard API without depending on a third-party implementation of an SMS client, kindly use Header Authorization. This authorization scheme uses a base64 encoding of the api_key and api_secret string combined with a colon i.e. base64(api_key:api_secret) . The resulting string is then included as the value for the authorization header as basic authorization.

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Below is a demonstration of how to perform base64 encoding

Code Examples

import base64
# Replace these with your actual api_key and api_secret
api_key = 'your_api_key'
api_secret = 'your_api_secret'
# Combine api_key and api_secret with a colon
credentials = f'{api_key}:{api_secret}'
# Convert the combined string to base64 encoding
base64_credentials = base64.b64encode(credentials.encode()).decode()
# Include base64_credentials in the authorization header
headers = {
    'Authorization': f'Basic {base64_credentials}'
# Now you can use the 'headers' dictionary in your API request