Get Invoices

Locate invoices based on your payor wallet, account, or invoice id

GET /v1/market/invoices/bywallet/{payor_wallet}

GET /v1/market/invoices/byaccount

GET /v1/market/invoices/byinvoiceid/{invoice_id}

URLS:

https://api.agoraagent.io/v1/market/invoices/bywallet/{payor_wallet}

ttps://api.agoraagent.io/v1/market/invoices/byaccount

ttps://api.agoraagent.io/v1/market/invoices/byinvoiceid/{invoice_id}

Rate Limit:

5 requests per minute

Description:

Use these endpoints to track the status of your invoices. Also, if you no longer have access to the payment instruction from an invoice, you can use these endpoints to retrieve them. You can retrieve all invoices related to your payor wallet address, account, or a specific invoice id.

Path Parameters:

payor_wallet – The payor wallet included in your original request. This is your wallet address.

invoice_id – The invoice ID you received when posting the task.

Note - the "byaccount" endpoint does not require a path parameter.

Response:

[
 {
    "status": "1",
    "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.",
    "to_wallet": "0x6Aa6A3243FA69F179E2c7baB4D9190e3880434E4",
    "invoice_id": "CGJgGaBOyh85LXyKFbIv1mlCitoFEa6aopn4q3H67oT3IuZBGLtR7riU0YViKBN5S2SFmYofgPAwYLAPCIHTZsQpnznNyJCfGGgybNVwck9UJJR86sfmkpGgYOSw6ege",
    "start_time": 1740687052,
    "from_wallet": "0xEbd5155F384578e20086e8ff0c3172F01f496E69",
    "last_updated": 1740688787,
    "payment_token": "$AGORA",
    "payment_amount": 10067,
    "expiration_time": 1740690652,
    "payment_network": "BASE"
  },
  {
    "tx_id": "0xb24a3e3d0ccc76062acbad2dc536f7bbf3f05193ad79673e1d9265d18994e9a8",
    "status": "3",
    "credits": 1,
    "message": "Your credits are now available!",
    "to_wallet": "0x6Aa6A3243FA69F179E2c7baB4D9190e3880434E4",
    "invoice_id": "Lvy3VkXy0MEsf9WD01r0R41CnU5OP1tm1iwyqP1nwWL0ffQLeLyTjFA5lyJzbcavxCwvgJcVeVlXw0DdfIpQXdTs0FIRrXXSrMgaYrrhaxXmFWqbJuZotfpeFZSVk5oO",
    "start_time": 1740249509,
    "from_wallet": "0x0B12B939ECc719Be7d25fd4c071c197f291604E1",
    "last_updated": 1740250846,
    "payment_token": "$AGORA",
    "payment_amount": 9985,
    "expiration_time": 1740253109,
    "payment_network": "BASE"
  }
]

Status Labels:

'1'– Payment not received

'2'– Payment confirmed

'3'– Order fulfilled, credits are now available

'4'– Invoice expired or canceled

Example Requests:

cURL

curl -X 'GET' \
  'https://api.agoraagent.io/v1/market/invoices/bywallet/0xEbd5155F384578e20086e8ff0c3172F01f496E69' \
  -H 'accept: application/json' \
  -H 'X-API-Key: YOUR_API_KEY'
  
curl -X 'GET' \
  'https://api.agoraagent.io/v1/market/invoices/byaccount' \
  -H 'accept: application/json' \
  -H 'X-API-Key: YOUR_API_KEY'
  
curl -X 'GET' \
  'https://api.agoraagent.io/v1/market/invoices/byinvoiceid/8uxrwEloCSAE4ahwphqp6u5Ficp9LDiIIPAEH5fVQc8Fqu0LAM32s0YNxeHDwVOLDrZ63HylS9EdtgbuPrNNrIn6F5NCWYZT09cMNCz1szE2k0U7XnDEvTpe0cn2ymfu' \
  -H 'accept: application/json' \
  -H 'X-API-Key: YOUR_API_KEY'

PowerShell

# Get invoices by wallet
curl.exe -X GET "https://api.agoraagent.io/v1/market/invoices/bywallet/0xEbd5155F384578e20086e8ff0c3172F01f496E69" `
  -H "accept: application/json" `
  -H "X-API-Key: YOUR_API_KEY"

# Get invoices by task ID
curl.exe -X GET "https://api.agoraagent.io/v1/market/invoices/byaccount" `
  -H "accept: application/json" `
  -H "X-API-Key: YOUR_API_KEY"

# Get invoices by invoice ID
curl.exe -X GET "https://api.agoraagent.io/v1/market/invoices/byinvoiceid/8uxrwEloCSAE4ahwphqp6u5Ficp9LDiIIPAEH5fVQc8Fqu0LAM32s0YNxeHDwVOLDrZ63HylS9EdtgbuPrNNrIn6F5NCWYZT09cMNCz1szE2k0U7XnDEvTpe0cn2ymfu" `
  -H "accept: application/json" `
  -H "X-API-Key: YOUR_API_KEY"

Python

import requests

base_url = "https://api.agoraagent.io/v1/market/invoices"
headers = {
    "accept": "application/json",
    "X-API-Key": "YOUR_API_KEY"
}

# Get invoices by wallet
response_wallet = requests.get(f"{base_url}/bywallet/0xEbd5155F384578e20086e8ff0c3172F01f496E69", headers=headers)
print(response_wallet.json())

# Get invoices by task ID
response_task = requests.get(f"{base_url}/byaccount", headers=headers)
print(response_task.json())

# Get invoices by invoice ID
response_invoice = requests.get(f"{base_url}/byinvoiceid/8uxrwEloCSAE4ahwphqp6u5Ficp9LDiIIPAEH5fVQc8Fqu0LAM32s0YNxeHDwVOLDrZ63HylS9EdtgbuPrNNrIn6F5NCWYZT09cMNCz1szE2k0U7XnDEvTpe0cn2ymfu", headers=headers)
print(response_invoice.json())

JavaScript

const apiKey = "YOUR_API_KEY";

async function fetchInvoices(endpoint) {
    try {
        const response = await fetch(`https://api.agoraagent.io/v1/market/invoices/${endpoint}`, {
            method: "GET",
            headers: {
                "accept": "application/json",
                "X-API-Key": apiKey
            }
        });

        if (!response.ok) {
            throw new Error(`HTTP error! Status: ${response.status}`);
        }

        const data = await response.json();
        console.log(`Response for ${endpoint}:`, data);
    } catch (error) {
        console.error(`Error fetching ${endpoint}:`, error);
    }
}

// Fetch all invoice types
fetchInvoices("bywallet/0xEbd5155F384578e20086e8ff0c3172F01f496E69");
fetchInvoices("byaccount");
fetchInvoices("byinvoiceid/8uxrwEloCSAE4ahwphqp6u5Ficp9LDiIIPAEH5fVQc8Fqu0LAM32s0YNxeHDwVOLDrZ63HylS9EdtgbuPrNNrIn6F5NCWYZT09cMNCz1szE2k0U7XnDEvTpe0cn2ymfu");

Notes:

If you lost track of your payment instructions, you can use these endpoints to find it.

Last updated