Terraswitch
  • Terraswitch - Get Started
  • Test & Live Environments
  • Onboarding as a Business
  • GUIDES
    • 🎾Authentication
    • 🧀Webhooks
    • 🫓Status & Responses
    • 🏉API Rate Limits
    • 🚀Transactions & Destinations
    • 🍊Testing Credentials
    • 🚐Crafting Metadata
  • API ENDPOINTS
    • Account
      • Get Account Details
      • Get Banks
      • Get Beneficiaries
      • Add Bank
      • Change Settlement Bank
    • Wallet
      • Get Wallet Details
      • Get Wallet Transactions
    • Collections
      • Checkout
        • Initialize Transaction
      • Transfer
        • Generate Account
      • Charge
        • Create Charge
        • Authorize Charge
        • Charge Authorization
      • Bank
        • Pay with Opay
    • Payout
      • Bank Transfer
      • Withdraw Money
    • Products
      • List Products
      • Search Products
      • Filter Products
      • Fetch Product
      • Create Product
      • Update Product
    • Subaccounts
      • List Subaccounts
      • Search Subaccounts
      • Filter Subaccounts
      • Fetch Subaccount
      • Create Subaccount
      • Update Subaccount
    • Payment Links
      • List Payment Links
      • List Payment Link Transactions
      • Search Payment Links
      • Filter Payment Links
      • Fetch Payment Link
      • Create Payment Link
      • Update Payment Link
      • Attach Payment Resource
      • Remove Subaccount
      • Enable Payment Link
      • Disable Payment Link
    • Invoices
      • List Invoices
      • Search Invoices
      • Filter Invoices
      • Fetch Invoice
      • Create Invoice
      • Update Invoice
      • Remove Invoice Item
    • Transactions
      • List Transactions
      • Search Transactions
      • Filter Transactions
      • Verify Transaction
    • Refunds
      • List Refunds
      • Fetch Refund
      • Create Refund
    • Bills Payment
      • List Mobile Networks
      • List Bill Categories
      • List Bill Sub-Categories
      • List Mobile Data Plans
      • Validate Biller
      • Validate Bill Status
      • Validate Top-Up Status
      • Buy Airtime
      • Buy Data
      • Pay Bill
    • Resources
      • List Banks
      • List Countries
      • Resolve Bank Account
Powered by GitBook
On this page
  • 🖐 Important Headers!
  • Obtaining your API Key
  • Generating New API Key
  1. GUIDES

Authentication

This page describes how you make a call to our APIs. The header properties and the required parameters needed to make a successful API call.

PreviousOnboarding as a BusinessNextWebhooks

Last updated 11 months ago

Every API endpoint requires some form of authentication using a bearer token header and two major header parameters. The key required for each request is your API Key. To enable communication between your application and Terraswitch, you'll need your API Key. Terraswitch authenticates every request your application makes with your API key. Generally, every corporate account comes with a single API Key for Staging and Live accounts. Your API key is required for accessing any financial data and can be used to make any API call on your account. Your key should never be shared on any client-side code or exposed on any application that is not yours. Treat them like any other password. And, if for any reason you believe your API key has been compromised simply reset them by generating new key. You can generate new API key from your dashboard.

🖐 Important Headers!

For every endpoint, you must specify the headers below.

Property
Value
Description

Content-Type

"application/json"

Request content type

lg

"en"

Language Type. This value should be "en"

ch

"web"

Channel Type. This is defaulted to "web" but can be any of "web", "mobile", "watch" or "desktop"

Authorization

"Bearer {{ YOUR_API_KEY }}"

Token for authourization

Obtaining your API Key

Your API key is always available on your dashboard. To find your API key,

  • Login to your Terraswitch account

  • Navigate to "Settings" on the side menu

  • Click "Webhook & API Key" on the sub-menu

  • In the Vacepay API Keys section, you’d see both your API Key and Webhook configuration section. You'll also see a button to generate a new API Key and make changes to your preferred webhook URL.

The API Keys for TEST ( i.e. Staging ) mode and LIVE mode are different. So you need to always ensure that you do not misuse the keys when you switch between modes.

Generating New API Key

You should always keep your API keys safe and protect your account. However, in the event where your API keys have been compromised, you can easily generate new API keys. Simply click the "Re-Generate Key" button under the "Your API Key" section on the API Keys page.

Once you generate new API keys, the old keys become void - you can no longer use them to make API calls. Make sure to update your application to use the newly generated keys.

If you fail to include your key when making an API request or provide an incorrect key, Terraswitch will respond with an error message. Check sample error below

{
    "error": true,
    "errors": [
        "user is not authorized to access this route"
    ],
    "data": {},
    "message": "Error",
    "status": 401
}
🎾
Webhook & API Key Section on Terraswitch Dashboard
Generate new API key using the button in the screenshot