Skip to Content
🚀 {xpay✦} is building the future of x402 payments - Join the developer beta →

Run an RDA

Execute an RDA and receive the output.

Endpoint

POST /run

Authentication

Required. Bearer token in Authorization header.

Request

Headers

Authorization: Bearer YOUR_TOKEN Content-Type: application/json

Body

{ "rdaSlug": "research-report-generator", "inputs": { "topic": "Competitor Analysis", "industry": "SaaS" }, "modelId": "claude-3.5-sonnet" }

Parameters

FieldTypeRequiredDescription
rdaSlugstringYesRDA identifier (slug or ID)
inputsobjectYesInput values matching RDA schema
modelIdstringNoModel ID for prompts (uses default if omitted)

Response

Success (200)

{ "success": true, "runId": "run_abc123", "output": "## Research Report\n\n### Executive Summary...", "cost": 0.05, "duration": 3500, "modelId": "claude-3.5-sonnet", "usage": { "prompt_tokens": 150, "completion_tokens": 250, "total_tokens": 400 } }

Response Fields

FieldTypeDescription
successbooleanWhether execution succeeded
runIdstringUnique run identifier
outputstringRDA output (format varies by type)
costnumberAmount charged (USDC)
durationnumberExecution time (ms)
modelIdstringModel used (for prompts)
usageobjectToken usage (for prompts)

Error Responses

Insufficient Balance (402)

{ "error": "Insufficient balance", "required": 0.05, "available": 0.02, "runId": "run_abc123" }

RDA Not Found (404)

{ "error": "RDA not found: invalid-slug", "runId": "run_abc123" }

Invalid Input (400)

{ "error": "Invalid input", "details": { "topic": "Required field missing" }, "runId": "run_abc123" }

Execution Error (500)

{ "error": "Execution failed: LLM timeout", "runId": "run_abc123" }

Examples

Run a Prompt RDA

curl -X POST https://api.xpay.sh/hub/run \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rdaSlug": "competitor-analysis", "inputs": { "companyName": "Acme Corp", "industry": "saas", "depth": "detailed" }, "modelId": "gpt-4o" }'

Run an Agent RDA

curl -X POST https://api.xpay.sh/hub/run \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rdaSlug": "lead-research", "inputs": { "companyName": "Acme Corp", "researchDepth": "standard" } }'

Run a Tool RDA

curl -X POST https://api.xpay.sh/hub/run \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rdaSlug": "company-lookup", "inputs": { "domain": "example.com" } }'

Code Examples

JavaScript

const response = await fetch('https://api.xpay.sh/hub/run', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ rdaSlug: 'research-report-generator', inputs: { topic: 'SaaS Pricing', depth: 'comprehensive' } }) }) const result = await response.json() console.log(result.output)

Python

import requests response = requests.post( 'https://api.xpay.sh/hub/run', headers={ 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' }, json={ 'rdaSlug': 'research-report-generator', 'inputs': { 'topic': 'SaaS Pricing', 'depth': 'comprehensive' } } ) result = response.json() print(result['output'])

Notes

  • Failed runs are not charged
  • Runs are logged in your history
  • Cost is deducted from available balance
  • Long-running agents may take up to 180 seconds
Last updated on: