Skip to content

Job Management

GET /agent/job/:jobId

StateDescription
pendingJob is queued, waiting to be processed
processingJob is actively being executed
completedJob finished successfully
failedJob encountered an error
cancelledJob was cancelled by the user
Poll job status
curl https://api.bankr.bot/agent/job/job_abc123 \
-H "X-API-Key: bk_YOUR_KEY"
Completed job
{
"status": "completed",
"response": "Successfully swapped 0.001 ETH for 3.21 USDC on Base.",
"metadata": {
"transactionHash": "0x...",
"chain": "base"
}
}
Failed job
{
"status": "failed",
"error": "Insufficient balance for this transaction."
}

DELETE /agent/job/:jobId

Cancel a job that is still pending or processing. Once a job reaches a terminal state (completed, failed, or cancelled), it can no longer be cancelled.

Cancel a job
curl -X DELETE https://api.bankr.bot/agent/job/job_abc123 \
-H "X-API-Key: bk_YOUR_KEY"
  • Poll every 2 seconds. This provides a good balance between responsiveness and staying within rate limits.
  • Set a timeout (for example, 60 seconds) to avoid infinite loops if a job gets stuck.
  • Handle all terminal states: completed, failed, and cancelled. Your code should have a clear path for each.