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
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.- curl
- JavaScript
- Python
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:- curl
- JavaScript
- Python
Expected Response
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:- JavaScript
- Python
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
403 Forbidden
403 Forbidden
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
429 Too Many Requests
429 Too Many Requests
Problem: You’ve hit the rate limit.Solution:
- Wait before making more requests (check
Retry-Afterheader) - Implement exponential backoff in your code
- Consider caching responses to reduce API calls
Network Errors
Network Errors
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:- JavaScript
Resources
- Authentication Guide - Detailed OAuth 2.0 setup
- Error Handling - Complete error reference
- Rate Limits - Understanding API limits
- API Reference - Complete endpoint documentation