Make Your First Request

Welcome to the exciting part - sending your first API request to Busha! This tutorial will guide you through making a simple GET request to retrieve your account’s wallet balances. Completing this will confirm your setup is correct and you’re ready to integrate with Busha’s services.

What You’ll Achieve:

  1. Successfully sent an authenticated request to the Busha API.

  2. Retrieve your current wallet balances.

  3. Confirm your API keys are working correctly.

PrerequisitesCopied!

Before you start, make sure you have:

Step 1: Understand the API EnvironmentCopied!

Busha provides different environments for testing and live operations. For this first request, we’ll focus on your Sandbox environment if you’re testing, or Production if your account is fully approved.

  • Sandbox (Testing Environment): https://api.sandbox.busha.so

    You can create a sandbox account from the Sandbox business registration page using the same steps from the Quick Start guide. Sandbox personal accounts require 2FA, and businesses are automatically verified.

  • Live (Production Environment): https://api.busha.co

For your first successful test, we recommend using the Sandbox environment if your account isn’t fully verified for production yet. This ensures you can test without affecting live data.

Step 2: Set Up AuthorizationCopied!

All requests to the Busha API require authentication using your Secret API Key. You’ll include this key in the Authorization header of your requests using a Bearer token.

The Authorization: Bearer {your_secret_api_key} header tells the Busha API who is making the request, ensuring it’s coming from your verified business account.

Keep your Secret API Key handy. You’ll replace {your_secret_api_key} in the upcoming command, with your actual key.

Step 3: Make Your First GET RequestCopied!

Now, let’s retrieve your wallet balances using a curl command. This is a basic GET request, meaning we are simply asking for information from the API.

To make your first GET request:

  1. Open your terminal or command prompt

  2. Copy the curl command below

    $ curl -X GET "YOUR_BASE_URL/v1/balances" \
      -H "Authorization: Bearer {YOUR_SECRET_API_KEY}" \
      -H "Content-Type: application/json"

    Replace YOUR_BASE_URL with your desired API environment and YOUR_SECRET_API_KEY with your secret API key.

Step 4: Verify the ResponseCopied!

After executing the curl command, the Busha API will send back a response.

A successful response will return a JSON object containing an array of your wallet balances. It should look something like this (actual values will vary):

{
  "status": "success",
  "message": "Fetched balances successfully",
  "data": [
    {
      "id": "96da4899-ff99-4821-88df-5182b8d37300",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "GHS",
      "name": "Cedi",
      "type": "fiat",
      "available": {
        "amount": "0",
        "currency": "GHS"
      },
      "pending": {
        "amount": "0",
        "currency": "GHS"
      },
      "total": {
        "amount": "0",
        "currency": "GHS"
      }
    },
    {
      "id": "05320e5e-a8ff-48e4-ac0b-23f7b1aa14d7",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "KES",
      "name": "Shilling",
      "type": "fiat",
      "available": {
        "amount": "0",
        "currency": "KES"
      },
      "pending": {
        "amount": "0",
        "currency": "KES"
      },
      "total": {
        "amount": "0",
        "currency": "KES"
      }
    },
    {
      "id": "960ab09d-cd55-4118-8b6e-c12b340efec3",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "NGN",
      "name": "Naira",
      "type": "fiat",
      "available": {
        "amount": "0",
        "currency": "NGN"
      },
      "pending": {
        "amount": "0",
        "currency": "NGN"
      },
      "total": {
        "amount": "0",
        "currency": "NGN"
      }
    },
    {
      "id": "1ebeabb4-6e4f-449f-8c0f-18a9c9d9187a",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "USD",
      "name": "US Dollar",
      "type": "fiat",
      "available": {
        "amount": "0",
        "currency": "USD"
      },
      "pending": {
        "amount": "0",
        "currency": "USD"
      },
      "total": {
        "amount": "0",
        "currency": "USD"
      }
    },
    {
      "id": "bc1dfeae-055e-4d4e-a583-0c8030e5a1cd",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "BTC",
      "name": "Bitcoin",
      "type": "crypto",
      "available": {
        "amount": "0",
        "currency": "BTC"
      },
      "pending": {
        "amount": "0",
        "currency": "BTC"
      },
      "total": {
        "amount": "0",
        "currency": "BTC"
      }
    },
    {
      "id": "b8dbf5e4-4d1f-4489-81fe-2a5e1e9816e1",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "ETH",
      "name": "Ethereum",
      "type": "crypto",
      "available": {
        "amount": "0",
        "currency": "ETH"
      },
      "pending": {
        "amount": "0",
        "currency": "ETH"
      },
      "total": {
        "amount": "0",
        "currency": "ETH"
      }
    },
    {
      "id": "ec5744b6-ab06-4180-b354-e672b9a5f30a",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "USDC",
      "name": "USD Coin",
      "type": "crypto",
      "available": {
        "amount": "0",
        "currency": "USDC"
      },
      "pending": {
        "amount": "0",
        "currency": "USDC"
      },
      "total": {
        "amount": "0",
        "currency": "USDC"
      }
    },
    {
      "id": "fb891621-0b15-45f5-9b81-ea3995cbf891",
      "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "user_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
      "currency": "USDT",
      "name": "USD Token",
      "type": "crypto",
      "available": {
        "amount": "0",
        "currency": "USDT"
      },
      "pending": {
        "amount": "0",
        "currency": "USDT"
      },
      "total": {
        "amount": "0",
        "currency": "USDT"
      }
    }
  ],
  "pagination": {
    "current_entries_size": 8
  }
}

If you see a ”status”: “success” and data about your accounts, congratulations! You’ve successfully made your first request.

Troubleshooting:

  • Unauthorized request or 401 error: Double-check that you replaced {YOUR_SECRET_API_KEY} with your actual Secret API Key, and ensure there are no extra spaces or characters.

  • Resource Not Found or 404 error: Verify the base URL is correct (Sandbox vs. Live) and the endpoint path (/v1/balances ) is accurate.

  • No response: Check your internet connection and ensure curl is correctly installed and accessible in your terminal.

What’s Next?Copied!

Now that you’ve successfully made your first API request, you can:

  • Explore more API functionalities and endpoints in the Sandbox Environment.

  • Refer to the Busha API Reference for comprehensive details on all available endpoints, request bodies, and responses.

  • Move on to more specific tasks by checking out our How-to Guides.