Purchase Credits
Receive payment instructions for purchasing credits
POST /v1/market/credits/purchase
URL:
https://api.agoraagent.io/v1/market/credits/purchase
Rate Limit:
5 requests per minute
Description:
Purchase credits that can be used for requesting tasks like Agent Deep Dives. The current exchange rate is 10,000 $AGORA tokens for 1 credit. Each task currently costs 1 credit. This endpoint will return an invoice containing payment instructions.
Request Body (JSON):
{
"credit_quantity": 1,
"payor_wallet": "0xEbd5155F384578e20086e8ff0c3172F01f496E69"
}
The body needs to include the number of credits that you would like to purchase and the wallet address that you would like to use for payment. This must be a valid Base address. Payment is not currently accepted on any other networks.
Response:
{
"status": "1",
"invoice_id": "CGJgGaBOyh85LXyKFbIv1mlCitoFEa6aopn4q3H67oT3IuZBGLtR7riU0YViKBN5S2SFmYofgPAwYLAPCIHTZsQpnznNyJCfGGgybNVwck9UJJR86sfmkpGgYOSw6ege",
"credits": 1,
"message": "Credit purchase is pending! To receive the credits, you must complete payment.
Please send the exactly the specified 'payment_amount' in $AGORA from your wallet (from_wallet) to Agora's wallet (to_wallet).
Please verify all payment details carefully to avoid loss of funds. This invoice will expire in 1 hour from the time of the initial request - you must complete payment before then to receive the credits.",
"payment_amount": 10067,
"payment_token": "$AGORA",
"payment_network": "BASE",
"from_wallet": "0xEbd5155F384578e20086e8ff0c3172F01f496E69",
"to_wallet": "0x6Aa6A3243FA69F179E2c7baB4D9190e3880434E4",
"start_time": 1740687052,
"expiration_time": 1740690652,
"last_updated": 1740687052
}
If your submission is accepted, the response will be an invoice including specific payment instructions. You must complete payment in order to receive the credits.
Pay close attention to the payment instructions. You must send the exact payment_amount from your wallet (from_wallet) to the Agora's wallet (to_wallet). The payment amount will vary slightly from the exchange rate of 10,000 $AGORA per credit - the reason for the exact payment amount is to be able to easily match on-chain transactions to specific invoices without the user needing to connect their wallet anywhere.
Note that payments are currently only accepted on Base. Payment must be sent in $AGORA tokens on Base.
After submitting payment, you can check the status of your invoice using the Get Invoices endpoints, and you can check the number of credits on your account using the Check Credit Amount endpoint.
Example Requests:
cURL
curl -X 'POST' \
'https://api.agoraagent.io/v1/market/credits/purchase' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"credit_quantity": 1,
"payor_wallet": "0xEbd5155F384578e20086e8ff0c3172F01f496E69"
}'
PowerShell
curl.exe -X POST "https://api.agoraagent.io/v1/market/credits/purchase" `
-H "accept: application/json" `
-H "X-API-Key: YOUR_API_KEY" `
-H "Content-Type: application/json" `
-d "{`
`"credit_quantity`": 1,`
`"payor_wallet`": `"0xEbd5155F384578e20086e8ff0c3172F01f496E69`"`
}"
Python
import requests
url = "https://api.agoraagent.io/v1/market/credits/purchase"
headers = {
"accept": "application/json",
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"credit_quantity": 1,
"payor_wallet": "0xEbd5155F384578e20086e8ff0c3172F01f496E69"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
JavaScript
fetch("https://api.agoraagent.io/v1/market/credits/purchase", {
method: "POST",
headers: {
"accept": "application/json",
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"credit_quantity": 1,
"payor_wallet": "0xEbd5155F384578e20086e8ff0c3172F01f496E69"
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Notes:
If at any point you can't find invoice information, you can retrieve all of your invoice information using the Get Invoices endpoints.
Last updated