> For the complete documentation index, see [llms.txt](https://titan-exchange.gitbook.io/titan/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titan-exchange.gitbook.io/titan/developer-doc/special-order-types/quickstart.md).

# 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.

{% hint style="info" %}
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.
{% endhint %}

{% stepper %}
{% step %}

### Set your credentials

```bash
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:

```typescript
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();
}
```

{% endstep %}

{% step %}

### 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.

```typescript
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](/titan/developer-doc/special-order-types/guides/onboarding.md) for the exact message format and freshness rules.
{% endstep %}

{% step %}

### 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:

```typescript
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.
{% endstep %}

{% step %}

### Confirm with the signed transaction

```typescript
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.
{% endstep %}
{% endstepper %}

## What success looks like

After `confirm` returns, the order is `active`:

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

## Manage it

```typescript
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](/titan/developer-doc/special-order-types/reference/endpoints.md#partner-reporting).

## Related pages

* [Order Types](/titan/developer-doc/special-order-types/order-types.md) — the `config` for DCA, stop-loss, take-profit, and OCO
* [Onboarding (SIWS)](/titan/developer-doc/special-order-types/guides/onboarding.md) — the canonical message, freshness, and error cases
* [Creating Orders](/titan/developer-doc/special-order-types/guides/creating-orders.md) — the full two-step flow and the shared fields
* [Authentication](/titan/developer-doc/special-order-types/reference/authentication.md) — headers, request tiers, auth errors
