Code sample for credits
endpoint
Python
This Python sample demonstrates how to access the PDFTeam credits
API endpoint. The sample provides user name and API key; the current balance, next top-up date and top-up amount are returned to the caller.
This sample is also available as a Colab notebook.
# Sample code for accesssing the PDFTeam API, endpoint: credits
import requests
import json
url = 'https://api.pdfteam.com/api/credits'
payload = '''{
"user": "YOUR_USERNAME",
"key": "YOUR_APIKEY",
}'''
headers = {
'content-type': 'application/json'
}
response = requests.request('POST', url, data=payload.encode('utf-8'), headers=headers)
if response.status_code == 200:
result = json.loads(response.text)
print(result)
else:
print('Error')
Sample return:
{'endpoint': 'credits', 'credits': 1022, 'topup-date': '2025-04-25T00:00:00.000Z', 'topup-amount': '1000'}