Making your first API call

Congratulations on setting up your account successfully! Now that everything is set up, you’re ready to make that first API call! Not to worry, we’re here to help you every step of the way.

Let's get started!

Step 1: Get Your API Key

The step for doing this is the same as defined in the Getting Started section.

  • Once you complete your sign up, head over to the Apps Menu and create an App.

  • Make sure to copy the API key displayed on your screen as you won’t be able to get it again except you Reset your API key

Step 2: Choose an Endpoint

Adjutor provides you with a host of different services needed to launch and scale your business. These include:

  • Authorizing direct debit, with consent, for repayments

  • Getting the bank accounts, with consent, tied to a customer's BVN

  • Matching a customer image against what's on their BVN

  • Getting the name and details of a bank account number

  • Getting credit information about a borrower

  • Getting "probable" fraud information from our Karma blacklist

  • Accessing credit performance information, for a borrower, from the Lendsqr ecosystem

Choose the endpoint you need to start your journey with Adjutor and make your first call.

Step 3: Make the API call

You might be doing this straight from your code base or testing this in Postman. It depends on the exact use case you have in mind. Not to worry. If you wish to make your API call directly from Postman, feel free to import the Postman collection and start calling the endpoints right away.

For those adding this directly to their code base, here’s a sample using Python

  1. Open your code Editor

  2. Copy the code below and paste in your editor. In this example, we’ll be testing the Get Banks endpoint for Direct Debit.

import requests

api_key = 'your_api_key_here'
url = 'https://adjutor.lendsqr.com/v2/direct-debit/banks'

headers = {
    'Authorization': f'Bearer {api_key}'
}

response = requests.get(url, headers=headers)
print(response.json())
  1. You should get a response similar to this:

{
  "status": "success",
  "message": "success",
  "data": {
    "data": [
      {
        "id": 1,
        "name": "Access Bank",
        "bank_code": "044",
        "institution_code": "000014",
        "url": "https://lendstack-s3.s3.us-east-2.amazonaws.com/bank_logos/044.png",
        "activation_amount": "50.00",
        "meta": "{\"mandate-activation-amount\":50,\"mandate-activation-bank\":\"Paystack-Titan\",\"mandate-activation-account-number\":\"9880218357\"}"
      },
      {
        "id": 10,
        "name": "First Bank of Nigeria",
        "bank_code": "011",
        "institution_code": "000016",
        "url": "https://lendstack-s3.s3.us-east-2.amazonaws.com/bank_logos/011.png",
        "activation_amount": "50.00",
        "meta": "{\"mandate-activation-amount\":50,\"mandate-activation-bank\":\"Paystack-Titan\",\"mandate-activation-account-number\":\"9880218357\"}"
      },
{
        "id": 40,
        "name": "United Bank For Africa",
        "bank_code": "033",
        "institution_code": "000004",
        "url": "https://lendstack-s3.s3.us-east-2.amazonaws.com/bank_logos/033.png",
        "activation_amount": "50.00",
        "meta": "{\"mandate-activation-amount\":50,\"mandate-activation-bank\":\"Paystack-Titan\",\"mandate-activation-account-number\":\"9880218357\"}"
      },
      {
        "id": 41,
        "name": "Zenith Bank",
        "bank_code": "057",
        "institution_code": "000015",
        "url": "https://lendstack-s3.s3.us-east-2.amazonaws.com/bank_logos/057.png",
        "activation_amount": "50.00",
        "meta": "{\"mandate-activation-amount\":50,\"mandate-activation-bank\":\"Paystack-Titan\",\"mandate-activation-account-number\":\"9880218357\"}"
      }
    ],
    "meta": {
      "records": 19,
      "page": "1",
      "pages": 1,
      "page_size": "100"
    }
  },
  "meta": {
    "cost": 1,
    "balance": 1010
  }
}

You can learn more about the response in the API Reference.

And that’s it! You’ve successfully made your first API call. 🎉

Troubleshooting Tips

If you see an error message, no need to panic. It’s just the system’s way of saying something needs fixing. Here are some things you can do to troubleshoot.

  • Confirm the endpoint URL being used is valid

  • Confirm variables being sent to the endpoint are correct and are in the right format

  • Make sure you are using the correct API key.

  • Confirm that the service you are trying to call was selected while creating your API key.

  • Ensure you have an active internet connection.

Next Steps

Now that you’ve made your first call, you can explore other endpoints. Try fetching transaction history, initiating payments, or any other exciting features our API offers.

Remember, we’re here to help. If you get stuck or have any questions, reach out to our support team. Happy coding!

Last updated