Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trepa.io/llms.txt

Use this file to discover all available pages before exploring further.

This page is for integrations that do not use @trepa/sdk: another language, curl, or a hand-built HTTP stack. You still need the same API key and wallet private key you created in API keys and Wallet private key. Two mechanics to keep in mind:
  1. Session cookies after you trade the API key for a session.
  2. Create → sign → submit for every on-chain action (predictions, claims, withdrawals).
Everything else (paths, bodies, status codes) lives in the API Reference tab.

Session cookies

POST /auth/session with header trepa-api-key returns Set-Cookie headers (no JSON body):
CookieRole
trepa-tokenShort-lived access token. Send on normal requests.
trepa-refreshRefresh token. Send only to POST /auth/refresh.
curl -X POST "https://api.trepa.app/auth/session" \
  -H "trepa-api-key: trp_your_key" \
  -c cookies.txt

curl "https://api.trepa.app/streak/bitcoin" -b cookies.txt

curl -X POST "https://api.trepa.app/auth/refresh" \
  -b cookies.txt -c cookies.txt
Expired access tokens usually surface as 403 (or 401 on /auth/*). Call /auth/refresh, update your cookie jar, and retry. Use the same host your product environment targets (production above; staging hosts appear in your own deployment notes).

Create, sign, submit

Every state-changing flow follows the same three steps:
  1. Create. POST the matching /transactions/... route. The JSON body includes { transaction, proof } where transaction is a base64 unsigned Solana VersionedTransaction.
  2. Sign. Deserialize, sign with the wallet private key, serialize, base64-encode again.
  3. Submit. POST the paired /transactions/.../submit route with signed_transaction and the original proof unchanged.
ActionCreateSubmit
Place a predictionPOST /transactions/prediction/transactions/prediction/submit
Update prediction valuePOST /transactions/prediction/update/transactions/prediction/update/submit
Update stakePOST /transactions/stake/update/transactions/stake/update/submit
Claim pool rewardPOST /transactions/claim-reward/transactions/claim-reward/submit
Claim streak rewardPOST /transactions/claim-streak-reward/transactions/claim-streak-reward/submit
Withdraw USDCPOST /transactions/withdraw/transactions/withdraw/submit

Node example (prediction)

import { Keypair, VersionedTransaction } from '@solana/web3.js'
import bs58 from 'bs58'

const { transaction, proof } = await fetch(
  `${BASE_URL}/transactions/prediction`,
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', Cookie: cookieHeader },
    body: JSON.stringify({ pool_id: POOL_UUID, stake: 1.0, value: 65_000 }),
  },
).then((r) => r.json())

const tx = VersionedTransaction.deserialize(Buffer.from(transaction, 'base64'))
tx.sign([Keypair.fromSecretKey(bs58.decode(PRIVATE_KEY))])
const signedTransaction = Buffer.from(tx.serialize()).toString('base64')

await fetch(`${BASE_URL}/transactions/prediction/submit`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', Cookie: cookieHeader },
  body: JSON.stringify({ pool_id: POOL_UUID, signed_transaction, proof }),
})
The same pattern ports to Python (solders), Rust (solana-sdk), and other ecosystems your team already uses. Next: Rate limits.
Last modified on May 4, 2026