AgentPMT - The Agentic Economy
Documentation

API / HTTP

For extra flexibility, you and your agent can make tool calls directly via API requests

Created: 11/24/2025
Updated: 11/24/2025

Send API calls to tools directly

Sometimes it is helpful during prompt engineering to see exactly what your agent will see when they try to use a tool. Maybe you want to incorporate a tool or data source into a hardcoded workflow you are building. Or maybe your agent just works better with API calls instead of an MCP tool connection. Whatever the reason, you can access AgentPMT in the same way that you would make any other API call.


Prerequisites:

API Key: Dashboard → Account Details → API Key → Generate.

Budget Key: Dashboard → AI Budgets → select budget → Generate AI Key.


Base URL

https://api.agentpmt.com


Authentication

In every request, always include your keys in the headers like this:

X-API-KEY: YOUR_API_KEY

X-BUDGET-KEY: YOUR_BUDGET_KEY


Note: Header names are case-insensitive, but we recommend using uppercase for consistency.


Available Endpoints


List Tools Available on Your Budget

Endpoint: GET /products/fetch


Optional URL parameters:

page=1

page_size=10 (max 100)


Product fetch requests are paginated with a max size of 100 per page.


cURL Example:

curl -X GET "https://api.agentpmt.com/products/fetch?page=1&page_size=1" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-BUDGET-KEY: YOUR_BUDGET_KEY"


Response Example:

{
"success": true,
"details": {
"tools_on_this_page": 1,
"total_qualified_tools": 298,
"page_returned": 1,
"page_size_requested": 1,
"page_source": "query",
"page_size_source": "query",
"total_pages": 298,
"has_next_page": true,
"has_previous_page": false
},
"preprompt": "You have access to the following tools to complete your task...",
"example_tool_call": "curl -X POST https://api.agentpmt.com/products/purchase -H 'X-API-KEY: <your_api_key>' -H 'X-BUDGET-KEY: <your_budget_key>' -H 'Content-Type: application/json' -d '{\"name\": \"<name>\", \"parameters\": {\"required_parameter1\": \"<value1>\"}}'",
"tools": [
{
"type": "function",
"function": {
"name": "689df4ac8ee2d1dd79e9035b",
"description": "Smart Math Interpreter — A universal math engine...",
"parameters": { ... }
},
"x-prepaid-balance": {
"uses_purchased": 100,
"uses_consumed": 15,
"uses_remaining": 85
},
"x-pricing": {
"metering": "prepaid",
"unit_type": "request",
"price_per_unit": 0.01,
"minimum_order_size": 100,
"minimum_order_price": 1,
"currency": "USDC",
"approval_required": false
}
}
],
"pagination": {
"current_page": 1,
"page_size": 1,
"total_count": 298,
"total_pages": 298,
"has_next": true,
"has_prev": false
}
}


Response Field Definitions


x-prepaid-balance: Shows the current number of prepaid tool calls available on that tool. When "uses_remaining" reaches 0, the next call will trigger a new purchase of the minimum order size.


x-pricing: Outlines the pricing structure for the tool:

metering: "prepaid" means you buy uses in advance

price_per_unit: Cost per single use in USDC

minimum_order_size: Minimum number of uses you must purchase at once

minimum_order_price: Total cost of minimum order (minimum_order_size × price_per_unit)


pagination: Tells you if you should make another call to fetch the next page of tools


Use a Tool (Purchase/Execute)

Endpoint: POST /products/purchase


cURL Example:

curl -X POST "https://api.agentpmt.com/products/purchase" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-BUDGET-KEY: YOUR_BUDGET_KEY" \
-d '{
"name": "<tool_name>",
"parameters": {
"<required_parameter_1>": "<value_1>",
"<required_parameter_2>": "<value_2>"
}
}'


Response Example:

{
"success": true,
"response": {
"status_code": 200,
"data": {
"success": true,
"output": {
<tool-specific output data>
}
},
"success": true
},
"purchase_result": "used_existing_access_token",
"purchase_details": null
}


Purchase Response Fields


purchase_result: Indicates what happened with this request:

used_existing_access_token: Used prepaid access you already own

new_order_placed: Purchased new access (minimum order)

free_tool: Tool is free, no payment required


purchase_details: If a new order was placed, contains transaction details:

Order ID

Amount paid in USDC

Number of uses purchased

Blockchain transaction hash


See the Access Tokens & Orders documentation for detailed information on how purchases work.


Standard Response Format

All API responses follow this structure:

{
"success": true/false,
"response": {
<tool output or error details>
},
"purchase_result": "<result_type>",
"purchase_details": {<optional_transaction_info>}
}


Troubleshooting


Authentication Errors


401 Unauthorized or 403 Forbidden:

Double-check both X-API-KEY and X-BUDGET-KEY headers

Ensure keys are copied correctly (no extra spaces)

Verify Budget Key is not paused in your dashboard

Confirm the Budget Key matches the API Key (same user account)


Tool Access Errors


Tool not found or unauthorized:

Confirm the tool is live (published, not draft)

Verify the tool is added to your budget

Check that your budget is not paused


Payment Errors


Insufficient funds:

Check your wallet balance in the dashboard

Ensure your budget limit hasn't been exceeded

For paid tools, the minimum order amount must be available

Fund your wallet or increase budget limits, then retry


Payment authorization failed:

Verify your wallet is activated

Ensure you've approved USDC spending via the smart contract

Check that the smart contract authorization is not paused


Request Validation Errors


400 Bad Request:

Match the tool's parameter schema exactly (correct types and required fields)

Check parameter names for typos

Ensure JSON formatting is valid

Verify all required parameters are included


Rate Limits

API requests are subject to reasonable rate limits to ensure platform stability. If you exceed rate limits, you'll receive a 429 Too Many Requests response. Wait a moment and retry.


Best Practices

  1. Check prepaid balance: Before making calls, check x-prepaid-balance to see if you have remaining uses
  2. Handle purchases gracefully: When purchase_result indicates a new order, log the transaction details
  3. Monitor budget limits: Track your spending in the dashboard to avoid hitting budget caps
  4. Error handling: Implement retry logic for transient errors, but not for authentication failures
  5. Secure your keys: Never expose API keys or Budget keys in client-side code or public repositories