bitcain docs
API Reference

Rag

RAG (Retrieval-Augmented Generation) - semantic search across trading knowledge base

Search Knowledge Base

POST
/api/v1/rag/search

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

query*string

Search query

Length2 <= length <= 1000
mode?string

Retrieval strategy

Default"hybrid_reranked"
Value in"vector" | "bm25" | "hybrid" | "hybrid_reranked"
doc_types?array<>|

Filter by document types

top_k?integer

Number of results to return

Default10
Range1 <= value <= 50

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/rag/search" \  -H "Content-Type: application/json" \  -d '{    "query": "string"  }'
{
  "success": true,
  "query": "string",
  "mode": "string",
  "documents": [
    {
      "id": "string",
      "content": "string",
      "doc_type": "string",
      "score": 0,
      "source": "string",
      "title": "string",
      "url": "string",
      "snippet": "string",
      "timestamp": "string"
    }
  ],
  "total_results": 0,
  "latency_ms": 0,
  "reranked": false
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Document Sources

GET
/api/v1/rag/sources

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Response Body

application/json

curl -X GET "https://loading/api/v1/rag/sources"
{
  "success": true,
  "doc_types": [
    {
      "property1": "string",
      "property2": "string"
    }
  ]
}

Ingest Document

POST
/api/v1/rag/ingest

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

content*string

Document content

Length10 <= length <= 50000
doc_type?string

Type of document

Default"news"
Value in"market_analysis" | "trading_signal" | "news" | "social_sentiment"
title?|

Document title

url?|

Source URL

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/rag/ingest" \  -H "Content-Type: application/json" \  -d '{    "content": "stringstri"  }'
{
  "success": true,
  "document_id": "string",
  "doc_type": "string",
  "message": "Document ingested successfully"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Search Social Posts

POST
/api/v1/rag/social/search

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

query*string

Search query

Length2 <= length <= 1000
top_k?integer

Number of results

Default10
Range1 <= value <= 50
min_score?number

Minimum similarity score

Default0
Range0 <= value <= 1
platforms?array<>|

Filter by platform

Response Body

application/json

application/json

curl -X POST "https://loading/api/v1/rag/social/search" \  -H "Content-Type: application/json" \  -d '{    "query": "string"  }'
{
  "success": true,
  "query": "string",
  "source": "string",
  "results": [
    {
      "id": "string",
      "score": 0,
      "content": "string",
      "platform": "string",
      "author": "string",
      "posted_at": "string",
      "coins": [
        "string"
      ],
      "trading_pairs": [
        "string"
      ],
      "conviction": "string",
      "action_type": "string",
      "sentiment": "string",
      "summary": "string"
    }
  ],
  "total_indexed": 0,
  "latency_ms": 0
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Social Rag Stats

GET
/api/v1/rag/social/stats

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Response Body

application/json

curl -X GET "https://loading/api/v1/rag/social/stats"
{}

Get Rag Settings

GET
/api/v1/admin/rag-settings

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Response Body

application/json

curl -X GET "https://loading/api/v1/admin/rag-settings"
{
  "id": "string",
  "enabled_sources": {
    "property1": true,
    "property2": true
  },
  "collection_limits": {
    "property1": 0,
    "property2": 0
  },
  "collection_interval_minutes": 5,
  "auto_expiration_days": 1,
  "max_posts_per_run": 100,
  "version": 0,
  "created_at": "string",
  "updated_at": "string",
  "updated_by": "string"
}

Update Rag Settings

PUT
/api/v1/admin/rag-settings

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Request Body

application/json

enabled_sources?|

Map of source names to enabled status

collection_limits?|

Map of source names to max post limits

collection_interval_minutes?|

Collection interval in minutes (5-180)

auto_expiration_days?|

Auto-expiration in days (1-365)

max_posts_per_run?|

Max posts per collection run (100-10000)

version?|

Current version for optimistic locking (prevents conflicts)

Response Body

application/json

application/json

curl -X PUT "https://loading/api/v1/admin/rag-settings" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "string",
  "enabled_sources": {
    "property1": true,
    "property2": true
  },
  "collection_limits": {
    "property1": 0,
    "property2": 0
  },
  "collection_interval_minutes": 5,
  "auto_expiration_days": 1,
  "max_posts_per_run": 100,
  "version": 0,
  "created_at": "string",
  "updated_at": "string",
  "updated_by": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}