BillionMail API Usage Guide
1. Obtain API Key
Go to the
Settings
page to view and copy the API key.
2. Enable Swagger API Documentation
Swagger is a popular API documentation tool. To enable it:
Enable Swagger on the
Settings
page.
3. Access Swagger Documentation
After the service starts, you can access the Swagger UI through the following URL:
https://your-domain.com/swagger
In the Swagger interface, you can:
View all available API endpoints
View the request parameters and response formats for each API
Test API calls directly
4. Set Request Header for Authentication
When calling the API, you need to add authentication information to the request header:
Authorization: Bearer your_api_key_here
Example curl command:
curl -X GET "https://your-domain.com/api/endpoint" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json"
5. API Debugging and Integration
Debugging the API
Test API calls directly using the Swagger interface.
Use tools like Postman to build requests:
Set the correct HTTP method (GET/POST/PUT/DELETE, etc.)
Add the Authorization header
Add necessary request parameters or body
Check the response status code and returned data.
Integrating the API
Depending on your development environment, you can choose the following ways to integrate the API:
Frontend Integration
fetch('https://your-domain.com/api/endpoint', {
method: 'GET',
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data));
Backend Integration
import requests
url = "https://your-domain.com/api/endpoint"
headers = {
"Authorization": "Bearer your_api_key_here",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
print(response.json())
Command-Line Integration
# Using curl
curl -X GET "https://your-domain.com/api/endpoint" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json"