Overview

This guide will walk you through the process of making your first successful API call to the GetBill External API. By the end of this tutorial, you’ll have retrieved your company profile information.

Prerequisites

Before you start, make sure you have:
  • A GetBill account with API access enabled
  • Created an OAuth client in your dashboard
  • Your Client ID and Client Secret ready
Keep your Client Secret secure and never expose it in client-side code or public repositories.

Step 1: Obtain an Access Token

First, you need to get an OAuth 2.0 access token. We’ll use the Client Credentials grant type for this example.

Expected Response

Save the access_token - you’ll need it for all subsequent API calls. Tokens expire after 1 hour.

Step 2: Make Your First API Call

Now that you have an access token, let’s retrieve your company profile:

Expected Response

To get additional company statistics like debt counts and user counts, use the Get Company Statistics endpoint.

Step 3: Understanding the Response

Let’s break down what you received:
boolean
Indicates if the request was successful (false) or failed (true)
string
Human-readable message about the request result
object
The actual data you requested - in this case, your company profile

Step 4: Error Handling

Always implement proper error handling:

Step 5: Next Steps

Congratulations! You’ve successfully made your first API call. Here’s what you can do next:

List Your Debts

Try retrieving your debt collection portfolio:

Get Statistics

Fetch company statistics and analytics:

Create a Debt

Add a new debt to your system:

Explore Documentation

Browse the complete API reference to discover all available endpoints and features.

Common Issues and Solutions

Problem: Your access token is invalid or expired.Solution:
  • Check that you’re including the token in the Authorization header
  • Ensure the token format is Bearer YOUR_TOKEN
  • If expired, request a new token with your client credentials
Problem: Your token doesn’t have the required scopes.Solution:
  • Check the endpoint documentation for required scopes
  • Request a new token with the appropriate scopes
  • Verify your OAuth client has permission for those scopes
Problem: You’ve hit the rate limit.Solution:
  • Wait before making more requests (check Retry-After header)
  • Implement exponential backoff in your code
  • Consider caching responses to reduce API calls
Problem: Connection issues or timeouts.Solution:
  • Check your internet connection
  • Implement retry logic with exponential backoff
  • Set appropriate timeout values
  • Check our status page for any ongoing issues

Complete Example

Here’s a complete working example that handles authentication and makes several API calls:

Resources

Ready to build something amazing? Start exploring the full API capabilities!