Base URL: http://localhost:3001 (development)
Production: https://api.agentforge.app
Last Updated: November 11, 2025
API Version: 1.5
All API requests require JSON content type unless specified.
Login with Phantom wallet signature.
Request:
{
"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"signature": "base64_encoded_signature",
"message": "Sign this message to login to AgentForge..."
}Response:
{
"success": true,
"data": {
"user": {
"id": "uuid",
"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"createdAt": "2025-11-06T12:00:00Z"
},
"token": "jwt_token_here"
}
}Login with Telegram user ID.
Request:
{
"telegramUserId": 123456789,
"username": "john_doe"
}Response: Same as Phantom login
Get current authenticated user.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"id": "uuid",
"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"credits": 50000,
"createdAt": "2025-11-06T12:00:00Z"
}
}Get user's credits balance.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"balance": 50000,
"lastToppedUp": "2025-11-06T12:00:00Z",
"totalPaid": 50.00
}
}Get usage statistics.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"todayUsage": 250,
"weekUsage": 2100,
"monthUsage": 8500,
"estimateDailyCost": 300
}
}Initiate x402 prepayment.
Headers: Authorization: Bearer {token}
Request:
{
"amountUsd": 50
}Response:
{
"success": true,
"data": {
"transactionId": "uuid",
"amount": 50,
"creditsIssued": 50000,
"paymentUrl": "solana:wallet_address?amount=50",
"expiresAt": "2025-11-06T12:10:00Z"
}
}Check prepayment status.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"status": "confirmed",
"creditsGranted": 50000,
"txHash": "5x7Kj..."
}
}Get transaction history.
Headers: Authorization: Bearer {token}
Query: ?page=1&limit=20
Response:
{
"success": true,
"data": {
"transactions": [
{
"id": "uuid",
"txHash": "5x7Kj...",
"amountUsd": 50,
"creditsIssued": 50000,
"status": "confirmed",
"facilitator": "coinbase",
"createdAt": "2025-11-06T12:00:00Z"
}
],
"total": 5,
"page": 1,
"limit": 20,
"totalPages": 1
}
}Get workflow environment variables.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"variables": [
{
"id": "uuid",
"workflowId": "uuid",
"key": "TELEGRAM_BOT_TOKEN",
"value": "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",
"description": "Telegram Bot Token from @BotFather",
"isSecret": true,
"isLocked": false,
"createdAt": "2025-11-10T12:00:00Z"
}
]
}
}Create or update workflow variable.
Headers: Authorization: Bearer {token}
Request:
{
"key": "TELEGRAM_BOT_TOKEN",
"value": "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",
"description": "Bot token from @BotFather",
"isSecret": true
}Response:
{
"success": true,
"data": {
"id": "uuid",
"workflowId": "uuid",
"key": "TELEGRAM_BOT_TOKEN",
"value": "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",
"isSecret": true,
"isLocked": false
}
}Lock or unlock a variable to prevent accidental changes.
Headers: Authorization: Bearer {token}
Request:
{
"isLocked": true
}Response:
{
"success": true,
"data": {
"id": "uuid",
"isLocked": true
}
}Delete workflow variable.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"success": true
}
}Activate workflow and register triggers (Telegram, Webhook, Schedule).
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"workflowId": "uuid",
"isActive": true,
"activatedAt": "2025-11-10T12:00:00Z",
"triggersRegistered": 2,
"triggers": [
{
"type": "telegram",
"config": {
"webhookUrl": "https://api.agentforge.app/webhooks/telegram/uuid",
"botUsername": "my_bot"
}
},
{
"type": "webhook",
"config": {
"webhookUrl": "https://api.agentforge.app/webhooks/generic/uuid"
}
}
]
}
}Deactivate workflow and unregister all triggers.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"workflowId": "uuid",
"isActive": false,
"triggersUnregistered": 2
}
}Get AI Assistant chat history for workflow.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"messages": [
{
"id": "uuid",
"workflowId": "uuid",
"role": "user",
"content": "Create a Telegram bot that sends SOL price",
"createdAt": "2025-11-10T12:00:00Z"
},
{
"id": "uuid",
"role": "assistant",
"content": "I'll create a workflow with...",
"metadata": {
"workflow": {
"nodes": [...],
"edges": [...]
}
},
"createdAt": "2025-11-10T12:00:30Z"
}
]
}
}Send message to AI Assistant to generate workflow.
Headers: Authorization: Bearer {token}
Request:
{
"message": "Create a Telegram bot that sends SOL price every hour",
"currentWorkflow": {
"nodes": [],
"edges": []
}
}Response:
{
"success": true,
"data": {
"workflow": {
"nodes": [
{
"id": "node_1",
"type": "schedule_trigger",
"data": {
"type": "schedule_trigger",
"config": {
"schedule": "0 * * * *"
}
}
},
{
"id": "node_2",
"type": "jupiter_token_info",
"data": {...}
}
],
"edges": [...]
},
"explanation": "This workflow runs every hour...",
"securityNotes": ["Never expose bot token", "..."],
"nextSteps": ["Test the workflow", "..."]
}
}Clear AI Assistant chat history for workflow.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"deleted": 15
}
}Get session key request configuration (for Telegram authorization).
Response:
{
"success": true,
"data": {
"sessionId": "uuid",
"userId": "telegram_123456",
"validUntil": "2025-11-10T18:00:00Z",
"maxTransactions": 100,
"maxAmountPerTx": 1000000000,
"allowedPrograms": ["JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB"],
"status": "pending_auth"
}
}Complete session key authorization after user approval.
Request:
{
"sessionId": "uuid",
"approved": true
}Response:
{
"success": true,
"data": {
"sessionKeyPublic": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"expiresAt": "2025-11-10T18:00:00Z",
"maxTransactions": 100
}
}Revoke user session key.
Request:
{
"sessionId": "uuid"
}Response:
{
"success": true,
"data": {
"revoked": true,
"revokedAt": "2025-11-10T14:00:00Z"
}
}Get user session information.
Response:
{
"success": true,
"data": {
"sessions": [
{
"id": "uuid",
"sessionKeyPublic": "7xKXtg...",
"isActive": true,
"expiresAt": "2025-11-10T18:00:00Z",
"transactionsUsed": 5,
"maxTransactions": 100
}
]
}
}Webhook endpoint for Telegram bot updates (auto-registered on activation).
Request: Telegram Update object
Response:
{
"ok": true
}Generic webhook endpoint for manual integrations.
Request: Any JSON payload
Response:
{
"success": true,
"executionId": "uuid"
}Server-Sent Events stream for real-time execution updates.
Headers: Authorization: Bearer {token}
Events:
event: nodeStarted
data: {"executionId":"uuid","nodeId":"node_1","nodeType":"telegram_trigger","timestamp":"2025-11-10T12:00:00Z"}
event: nodeCompleted
data: {"executionId":"uuid","nodeId":"node_1","output":{...},"duration":123}
event: nodeFailed
data: {"executionId":"uuid","nodeId":"node_2","error":"Insufficient balance"}
event: executionCompleted
data: {"executionId":"uuid","status":"success","duration":1234,"creditsUsed":15}
List user's workflows.
Headers: Authorization: Bearer {token}
Query: ?page=1&limit=20
Response:
{
"success": true,
"data": {
"workflows": [
{
"id": "uuid",
"name": "Token Swap Bot",
"description": "Automated token swapping",
"isActive": true,
"deploymentType": "telegram",
"createdAt": "2025-11-06T12:00:00Z",
"updatedAt": "2025-11-06T13:00:00Z",
"lastExecutedAt": "2025-11-06T13:30:00Z"
}
],
"total": 5,
"page": 1,
"limit": 20,
"totalPages": 1
}
}Create new workflow.
Headers: Authorization: Bearer {token}
Request:
{
"name": "My Workflow",
"description": "Optional description"
}Response:
{
"success": true,
"data": {
"id": "uuid",
"name": "My Workflow",
"description": "Optional description",
"canvasJson": "{\"nodes\":[],\"edges\":[]}",
"isActive": false,
"createdAt": "2025-11-06T12:00:00Z"
}
}Get workflow details.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"id": "uuid",
"name": "My Workflow",
"description": "Optional description",
"canvasJson": "{\"nodes\":[...],\"edges\":[...]}",
"isActive": true,
"deploymentType": "telegram",
"deploymentConfig": {...},
"createdAt": "2025-11-06T12:00:00Z",
"updatedAt": "2025-11-06T13:00:00Z",
"lastExecutedAt": "2025-11-06T13:30:00Z"
}
}Update workflow.
Headers: Authorization: Bearer {token}
Request:
{
"name": "Updated Name",
"description": "Updated description",
"canvasJson": "{\"nodes\":[...],\"edges\":[...]}",
"isActive": true
}Response: Same as GET /api/workflows/:id
Delete workflow.
Headers: Authorization: Bearer {token}
Response:
{
"success": true,
"data": {
"success": true
}
}Execute workflow.
Headers: Authorization: Bearer {token}
Request:
{
"inputs": {
"someInput": "value"
}
}Response:
{
"success": true,
"data": {
"executionId": "uuid",
"status": "success",
"output": {
"result": "..."
},
"executionTimeMs": 1234,
"creditsUsed": 15
}
}Get workflow execution history.
Headers: Authorization: Bearer {token}
Query: ?page=1&limit=20
Response:
{
"success": true,
"data": {
"executions": [
{
"id": "uuid",
"status": "success",
"inputData": {...},
"outputData": {...},
"executionTimeMs": 1234,
"apiCallsCount": 5,
"creditsUsed": 15,
"createdAt": "2025-11-06T13:30:00Z"
}
],
"total": 20,
"page": 1,
"limit": 20,
"totalPages": 1
}
}List available blocks.
Response:
{
"success": true,
"data": {
"blocks": [
{
"type": "jupiter_quote",
"name": "Jupiter Swap Quote",
"description": "Get a swap quote from Jupiter DEX aggregator",
"category": "data",
"inputs": [
{
"name": "inputMint",
"type": "string",
"required": true,
"description": "Input token mint address"
}
],
"outputs": [
{
"name": "quote",
"type": "object",
"description": "Jupiter quote object"
}
],
"creditsCost": 1
}
],
"count": 10
}
}Check API health.
Response:
{
"success": true,
"data": {
"status": "healthy",
"timestamp": "2025-11-06T12:00:00Z",
"uptime": 12345.67
}
}All errors follow this format:
{
"success": false,
"error": "Error message",
"code": "ERROR_CODE"
}AUTHENTICATION_ERROR(401) - Not authenticatedAUTHORIZATION_ERROR(403) - No permissionNOT_FOUND(404) - Resource not foundVALIDATION_ERROR(400) - Invalid inputINSUFFICIENT_CREDITS(402) - Not enough creditsRATE_LIMIT_EXCEEDED(429) - Too many requestsINTERNAL_ERROR(500) - Server error
{
"success": false,
"error": "Insufficient credits. Required: 100, Available: 50",
"code": "INSUFFICIENT_CREDITS",
"required": 100,
"available": 50,
"topupUrl": "/settings/topup"
}- 100 requests/minute per user
- 1000 requests/minute per IP
Rate limit info in headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1699276800
All list endpoints support pagination:
Query Parameters:
page(default: 1) - Page numberlimit(default: 20, max: 100) - Items per page
Response includes:
total- Total itemspage- Current pagelimit- Items per pagetotalPages- Total pages
- User connects Phantom wallet
- Frontend generates message:
"Sign this message to login to AgentForge.\n\nWallet: {address}\nTimestamp: {timestamp}" - User signs message in Phantom
- Frontend sends
walletAddress,signature,messageto/auth/phantom/login - Backend verifies signature
- Backend returns JWT token
- Frontend stores token in localStorage
- Frontend sends token in
Authorization: Bearer {token}header for all requests
- 1 credit = $0.001 USD
- Credits are prepaid via x402
- Credits never expire
- Credits are deducted per API call:
- Jupiter Quote: 1 credit
- Pump.fun Data: 2 credits
- Helius RPC: 1 credit
- LLM Analysis: 100 credits
- Solana Swap: 5 credits
- Logic blocks (filter, map): 0 credits
For support: support@agentforge.app