For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart

Onboard a user and create your first order in four steps.

The full path: onboard a user once, then create an order with the two-step intent/confirm flow. Everything runs from your backend with your X-Titan-Key. The example creates a dca order — swap orderType and config for a stop-loss, take-profit, or OCO and every other step is unchanged.

You'll need your partner API key and the base URL for your environment — both issued at onboarding. Keep the key in your backend secret store; never expose it to a browser.

1

Set your credentials

export TITAN_DCA_API_KEY="<your-partner-api-key>"
export TITAN_DCA_BASE_URL="https://api.chronos.titan.exchange/api/v1"

A small helper for every user-scoped call — note X-Titan-User, not a bearer token:

async function callTitanDca(path: string, opts: {
  method?: string;
  body?: unknown;
  sub: string;   // your stable user id == X-Titan-User
}) {
  const res = await fetch(`${process.env.TITAN_DCA_BASE_URL}${path}`, {
    method: opts.method ?? 'GET',
    headers: {
      'X-Titan-Key': process.env.TITAN_DCA_API_KEY!,
      'X-Titan-User': opts.sub,
      'Content-Type': 'application/json',
    },
    body: opts.body ? JSON.stringify(opts.body) : undefined,
  });
  return res.json();
}
2

Onboard the user (once)

Have the user sign a canonical SIWS message with their external wallet, then post it. This provisions their Titan-managed manager and records their external wallet as the funding/withdrawal address. It's idempotent — re-calling with the same inputs replays the same result.

const message =
  `Titan DCA wants you to link this Solana wallet.\n\n` +
  `Address: ${userPubkey}\n` +
  `User: ${sub}\n` +
  `Issued At: ${new Date().toISOString()}\n` +
  `Nonce: ${crypto.randomUUID()}\n`;

// The user's own wallet signs `message` in your frontend; you send the signature here.
const res = await fetch(`${process.env.TITAN_DCA_BASE_URL}/partner/onboard`, {
  method: 'POST',
  headers: {
    'X-Titan-Key': process.env.TITAN_DCA_API_KEY!,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    sub,
    userPubkey,
    siws: { message, signature: signatureBase58 },
  }),
});

const { data } = await res.json();
// Store data.userId — you'll pass it to /partners/me/* reporting filters.

User: must equal the sub you'll send on every later call; Address: must equal the wallet pubkey. See Onboarding for the exact message format and freshness rules.

3

Create an order — get an unsigned deposit tx

The order's input is funded by the user's external wallet, so creation is two steps. First, intent returns an unsigned deposit transaction:

const intent = await callTitanDca('/orders/intent', {
  method: 'POST',
  sub,
  body: {
    orderType: 'dca',
    userPubkey,
    config: {
      inputMint:  'So11111111111111111111111111111111111111112', // SOL
      outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
      totalAmount:    '1000000000', // 1 SOL total, in lamports
      amountPerCycle: '100000000',  // 0.1 SOL per cycle
      cycleFrequencySeconds: 86400, // daily
    },
  },
});

const { pendingOrderId, transaction } = intent.data; // transaction is base64, unsigned

The user signs transaction with their external wallet within the 5-minute window. Network fees on the recurring cycle executions are sponsored by Titan — the manager never needs SOL to keep running.

4

Confirm with the signed transaction

const confirmed = await callTitanDca('/orders/confirm', {
  method: 'POST',
  sub,
  body: {
    pendingOrderId,
    signedTransaction, // base64, signed by the user's external wallet
  },
});

const { order, txSignature } = confirmed.data;

Titan co-signs, submits to Solana, and activates the order. From here, Titan runs each cycle at the configured cadence — no further action from you. A trigger order would instead be active immediately and start watching the pair's price.

What success looks like

After confirm returns, the order is active:

{
  "success": true,
  "data": {
    "order": { "id": "9b3f1ad0-…", "status": "active", "orderType": "dca", "...": "" },
    "txSignature": "5Uq…",
    "pendingOrderId": "9b3f1ad0-…"
  }
}

Manage it

await callTitanDca('/me/orders/active', { sub });               // list running orders
await callTitanDca(`/dca/${orderId}`, { sub });                 // one DCA order with progress
await callTitanDca(`/orders/${orderId}/pause`, { method: 'POST', sub });
await callTitanDca(`/orders/${orderId}/resume`, { method: 'POST', sub });

For back-office reconciliation across your whole tenant, use the partner reporting routes with X-Titan-Key only — see Endpoints → Partner reporting.

Last updated