Programmatic data access with integrated payments
Base URL
https://api.redpine.aiAuthentication
X-API-Key: YOUR_KEYCredit System
1,000 credits = $1.00Get up and running in minutes
/api/v1/dashboard/credits/balanceGet your current credit balance and last update time.
1import requests
2
3response = requests.get(
4 "https://api.redpine.ai/api/v1/dashboard/credits/balance",
5 headers={"X-API-Key": "YOUR_API_KEY"}
6)
7balance = response.json()
8print(f"Balance: {balance['current_balance']} credits")1{
2 "current_balance": 5000.0,
3 "last_updated": "2025-01-24T10:00:00Z"
4}/api/v1/acp/queriesQuery RAG data with cost estimation and caching. Supports filtering by category, publisher, and date range.
queryType: string
Search query for context retrieval
kType: integer
Number of chunks to retrieve (default: 5)
alphaType: float
RRF ranking weight 0.0-1.0 (default: 0.7)
categoryType: string
Category filter (legal, medical, educational)
publisherType: string
Publisher name to filter results by
date_rangeType: array[string]
Date range filter as [start_date, end_date]. Formats: YYYY-MM-DD, YYYY/MM/DD, YYYYMMDD
1import requests
2
3response = requests.post(
4 "https://api.redpine.ai/api/v1/acp/queries",
5 json={
6 "query": "migration policies in Sweden",
7 "k": 5,
8 "alpha": 0.7,
9 "publisher": "EU Commission",
10 "date_range": ["2020-01-01", "2024-12-31"]
11 },
12 headers={"X-API-Key": "YOUR_API_KEY"}
13)
14print(response.json())1{
2 "query_id": "qry_abc123def456",
3 "query": "migration policies in Sweden",
4 "sources_found": 5,
5 "total_tokens": 3500,
6 "estimated_cost_cents": 400,
7 "preview": "Found 5 relevant sources:\n- Publisher A: Content preview...\n...",
8 "metadata": {
9 "publishers": ["Publisher A", "Publisher B"],
10 "max_relevance_score": 0.95,
11 "publisher_filter": "EU Commission",
12 "date_range": ["2020-01-01", "2024-12-31"],
13 "expires_at": "2025-01-25T10:00:00Z"
14 },
15 "next_step": {
16 "action": "create_checkout",
17 "endpoint": "/api/v1/acp/checkouts",
18 "method": "POST"
19 }
20}/api/v1/acp/checkoutsCreate an ACP checkout session for data access.
query_idType: string
Query ID from previous query request
payment_providerType: string
Preferred payment provider: 'stripe' or 'x402' (default: 'stripe')
1response = requests.post(
2 "https://api.redpine.ai/api/v1/acp/checkouts",
3 json={"query_id": query_id},
4 headers={"X-API-Key": "YOUR_API_KEY"}
5)
6checkout = response.json()
7checkout_id = checkout["id"]1{
2 "id": "chk_abc123xyz",
3 "status": "ready_for_payment",
4 "query_id": "qry_abc123def456",
5 "amount": 400,
6 "currency": "usd",
7 "payment_provider": {
8 "provider": "stripe",
9 "supported_payment_methods": ["card"]
10 },
11 "created_at": "2025-01-01T12:00:00Z"
12}/api/v1/acp/checkouts/{checkout_id}/completeComplete payment using one of two payment methods: credits or Stripe.
checkout_idType: string
Checkout session ID (in URL path)
payment_dataType: object
Omit entirely or pass null for credit payment
1response = requests.post(
2 f"https://api.redpine.ai/api/v1/acp/checkouts/{checkout_id}/complete",
3 json={"payment_data": None}, # None or omit for credits
4 headers={"X-API-Key": "YOUR_API_KEY"}
5)
6result = response.json()
7access_token = result["links"][0]["url"].split("token=")[1]1{
2 "id": "chk_abc123xyz",
3 "status": "completed",
4 "query_id": "qry_abc123def456",
5 "amount": 400,
6 "currency": "usd",
7 "links": [
8 {
9 "type": "data_access",
10 "url": "https://api.redpine.ai/api/v1/acp/data/access?token=dat_xyz789abc",
11 "expires_at": "2025-01-08T12:00:00Z"
12 }
13 ],
14 "created_at": "2025-01-01T12:00:00Z",
15 "updated_at": "2025-01-01T12:05:00Z"
16}/api/v1/acp/data/accessRetrieve full data using an access token. The access token itself serves as authentication.
tokenType: string
Access token from completed checkout (query parameter)
1# Note: No X-API-Key needed - access token serves as authentication
2response = requests.get(
3 f"https://api.redpine.ai/api/v1/acp/data/access?token={access_token}"
4)
5data = response.json()1{
2 "query_id": "qry_abc123def456",
3 "query": "migration policies in Sweden",
4 "data": [
5 {
6 "chunk_id": "chunk_001",
7 "text": "Content of the research data...",
8 "metadata": {
9 "publisher": "Publisher A",
10 "relevance_score": 0.95
11 }
12 }
13 ],
14 "total_tokens": 3500,
15 "sources_count": 5,
16 "access_expires_at": "2025-01-08T12:00:00Z"
17}60 req/min30 req/min100 req/min