bitcain docs
API Reference

A I Batch

Batch AI operations for non-urgent processing with 50% cost savings via Anthropic Message Batches API

Enqueue Batch Job

POST
/api/v1/batch/enqueue

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

job_type*string

Type of batch job

Value in"portfolio_summary" | "risk_report" | "strategy_backtest" | "sentiment_analysis" | "model_evaluation" | "trading_analytics"
payload*

Job payload/parameters

priority?integer

Job priority (0-100, higher = more urgent)

Default50
Range0 <= value <= 100
run_after?|

Don't run until this time (optional delay)

idempotency_key?|

Unique key for idempotent job creation

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/batch/enqueue" \  -H "Content-Type: application/json" \  -d '{    "job_type": "portfolio_summary",    "payload": {}  }'
{
  "success": true,
  "job": {
    "id": "string",
    "job_type": "portfolio_summary",
    "status": "pending",
    "priority": 0,
    "custom_id": "string",
    "batch_id": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "run_after": "2019-08-24T14:15:22Z",
    "completed_at": "2019-08-24T14:15:22Z",
    "tokens_used": 0,
    "error_message": "string"
  },
  "message": "string",
  "estimated_completion": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

List Batch Jobs

GET
/api/v1/batch/jobs

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Query Parameters

status_filter?|
limit?integer
Default50

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/batch/jobs"
{
  "jobs": [
    {
      "id": "string",
      "job_type": "portfolio_summary",
      "status": "pending",
      "priority": 0,
      "custom_id": "string",
      "batch_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "run_after": "2019-08-24T14:15:22Z",
      "completed_at": "2019-08-24T14:15:22Z",
      "tokens_used": 0,
      "error_message": "string"
    }
  ],
  "total_count": 0,
  "pending_count": 0,
  "processing_count": 0
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Batch Job

GET
/api/v1/batch/jobs/{job_id}

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

job_id*string

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/batch/jobs/string"
{
  "id": "string",
  "job_type": "portfolio_summary",
  "status": "pending",
  "priority": 0,
  "custom_id": "string",
  "batch_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "run_after": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "tokens_used": 0,
  "error_message": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Cancel Batch Job

POST
/api/v1/batch/jobs/{job_id}/cancel

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

job_id*string

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/batch/jobs/string/cancel"
{
  "property1": true,
  "property2": true
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Batch Stats

GET
/api/v1/batch/stats

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Response Body

application/json

curl -X GET "https://loading/api/v1/batch/stats"
{
  "total_jobs_queued": 0,
  "pending_jobs": 0,
  "processing_jobs": 0,
  "completed_jobs": 0,
  "failed_jobs": 0,
  "total_tokens_used": 0,
  "total_cost_usd": 0,
  "total_savings_usd": 0,
  "avg_processing_time_hours": 0
}

Get Job Result

GET
/api/v1/batch/jobs/{job_id}/result

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

job_id*string

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/batch/jobs/string/result"
{}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Flush Batch Jobs

POST
/api/v1/batch/internal/flush

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

max_jobs?integer

Maximum jobs to include in batch

Default100
Range1 <= value <= 10000
job_types?array<>|

Only include specific job types (optional)

min_priority?integer

Minimum priority to include

Default0
Range0 <= value <= 100

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/batch/internal/flush" \  -H "Content-Type: application/json" \  -d '{}'
{
  "success": true,
  "batch_id": "string",
  "jobs_count": 0,
  "estimated_tokens": 0,
  "message": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Poll Batch Results

POST
/api/v1/batch/internal/poll

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

batch_id*string

Anthropic batch ID to poll

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/batch/internal/poll" \  -H "Content-Type: application/json" \  -d '{    "batch_id": "string"  }'
{
  "success": true,
  "batch_id": "string",
  "status": "string",
  "results": [
    {
      "job_id": "string",
      "job_type": "portfolio_summary",
      "status": "succeeded",
      "result": {},
      "error": "string",
      "tokens_used": 0,
      "processing_time_ms": 0
    }
  ],
  "jobs_processed": 0,
  "jobs_remaining": 0,
  "message": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}