Easily make tool calls directly via API requests - great for custom programs and extra flexibility
Send API Calls to Tools Directly
Sometimes it's 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're building. Or maybe your agent just works better with API calls instead of an MCP tool connection. Whatever the reason, you can access AgentPMT the same way you would make any other API call.
Prerequisites#
Bearer Token: Dashboard → AI Budgets → select budget → copy Bearer Token
Base URL#
Authentication#
Include your Bearer token in the Authorization header of every request:
- Authorization: Bearer YOUR_BEARER_TOKEN
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=10" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_BEARER_TOKEN"Response Example:
{
"success": true,
"details": {
"tools_on_this_page": 1,
"total_qualified_tools": 298,
"page_returned": 1,
"page_size_requested": 10,
"total_pages": 30,
"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 'Authorization: Bearer <your_bearer_token>' -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-pricing": {
"unit_type": "request",
"price_per_unit": 0.01,
"currency": "credits"
}
}
],
"pagination": {
"current_page": 1,
"page_size": 10,
"total_count": 298,
"total_pages": 30,
"has_next": true,
"has_prev": false
}
}Response Field Definitions
- x-pricing: Outlines the pricing structure for the tool
- unit_type: What constitutes a billable unit (e.g., "request")
- price_per_unit: Cost per single use in credits
- currency: Payment method (credits)
- pagination: Tells you if you should make another call to fetch the next page of tools
Use a Tool (Execute)#
**Endpoint:**POST /products/purchase
Each tool call is individually deducted from your prepaid usage credits (purchased from your dashboard).
cURL Example:
curl -X POST "https://api.agentpmt.com/products/purchase" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_BEARER_TOKEN" \
-d '{
"name": "<tool_name>",
"parameters": {
"<required_parameter_1>": "<value_1>",
"<required_parameter_2>": "<value_2>"
}
}'Response Example:
{
"success": true,
"instance_id": "550e8400-e29b-41d4-a716-446655440000",
"response": {
"success": true,
"status_code": 200,
"data": {
"output": {
"<tool-specific output data>"
}
}
}
}Standard Response Format#
Successful responses follow this structure:
{
"success": true,
"instance_id": "<uuid>",
"response": {
"success": true,
"status_code": 200,
"data": { ... }
}
}- success: Indicates the API call was processed successfully
- instance_id: Unique identifier for this request (useful for debugging/support)
- response: The downstream tool response object, containing its own success, status_code, and data fields
Error responses return this format:
{
"detail": "Error message describing what went wrong"
}Common HTTP status codes for errors: 400 (bad request/invalid parameters), 401 (unauthorized/invalid or missing token), 402 (payment required/insufficient credits), 500 (internal server error).
Troubleshooting#
Authentication Errors#
If you receive a 401 Unauthorized or 403 Forbidden error, double-check your Authorization header format (should be Bearer YOUR_TOKEN). Ensure the token is copied correctly with no extra spaces, and verify the budget is not paused in your dashboard.
Tool Access Errors#
If a tool is not found or you receive an unauthorized error, confirm the tool is live (published, not draft). Verify the tool is added to your budget and check that your budget is not paused.
Insufficient Credits#
If you run out of credits, check your credit balance in the dashboard, purchase additional credits, and retry after credits are added to your account.
Request Validation Errors#
If you receive a 400 Bad Request error, make sure you match the tool's parameter schema exactly (correct types and required fields). Check parameter names for typos, ensure JSON formatting is valid, and 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#
- Monitor your credits: Track your credit balance in the dashboard to avoid running out mid-task
- Error handling: Implement retry logic for transient errors, but not for authentication failures
- Secure your token: Never expose your Bearer token in client-side code or public repositories
- Use pagination: When fetching tools, iterate through pages to get the complete list

