> 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/developers-portal/introduction.md).

# Introduction

Set up your Titan API key and start building.

The Developers Portal provides self-serve access to Titan's swap routing over REST. Create an API key, pass it as a header, and receive quoted routes with the on-chain instructions to execute them.

Routes are served by the same routing engine as Titan Direct and every distributor integration. Access method and response encoding differ; routing quality does not.

## Quickstart

{% stepper %}
{% step %}

### Sign in

Go to [developer.titan.exchange](https://developer.titan.exchange/).
{% endstep %}

{% step %}

### Create an API key

Keys are scoped to your organization.
{% endstep %}

{% step %}

### Pass the key

Send it in the `x-api-key` header on every request to `portal.api.titan.exchange`.
{% endstep %}

{% step %}

### Set the `Accept` header

Use `application/json` unless you need MessagePack.
{% endstep %}
{% endstepper %}

## Choose a plan

All plans use the same base URL and the same routing engine. Higher tiers raise the rate limit and included credits.

| Plan       | Price   | Requests/sec | For                                                               |
| ---------- | ------- | ------------ | ----------------------------------------------------------------- |
| Sandbox    | $0      | 1            | Testing and prototyping                                           |
| Build      | $25/mo  | 10           | Your first integration                                            |
| Scale      | $100/mo | 50           | Production workloads                                              |
| Growth     | $500/mo | 150          | High-volume production                                            |
| Enterprise | Custom  | Custom       | Custom limits, Titan Direct streaming, SLAs and dedicated support |

See [Plans, Rate Limits & Credits](/titan/developer-doc/developers-portal/plans-rate-limits-credits.md) for credit allowances, key counts and upgrade behavior.

## Base URL

```
https://portal.api.titan.exchange
```

One hostname serves every plan. Requests are routed to the nearest region automatically, with no regional configuration required. See [Latency and Server Locations](/titan/developer-doc/developers-portal/latency.md).

Four endpoints are available, all `GET`.

| Endpoint             | Returns                                    |
| -------------------- | ------------------------------------------ |
| `/api/v1/quote/swap` | Quoted routes with executable instructions |
| `/api/v1/info`       | Protocol version and parameter bounds      |
| `/api/v1/venues`     | Venue labels available for routing filters |
| `/api/v1/providers`  | Providers currently quoting                |

## Using your API key

{% tabs %}
{% tab title="curl" %}

```bash
curl "https://portal.api.titan.exchange/api/v1/info" \
  -H "x-api-key: $TITAN_API_KEY" \
  -H "Accept: application/json"
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
const res = await fetch('https://portal.api.titan.exchange/api/v1/info', {
  headers: {
    'x-api-key': process.env.TITAN_API_KEY!,
    Accept: 'application/json',
  },
});
const info = await res.json();
```

{% endtab %}

{% tab title="Python" %}

```python
import os, requests

res = requests.get(
    'https://portal.api.titan.exchange/api/v1/info',
    headers={
        'x-api-key': os.environ['TITAN_API_KEY'],
        'Accept': 'application/json',
    },
)
info = res.json()
```

{% endtab %}
{% endtabs %}

## Response format

| `Accept` header           | Encoding                                                  | Best for                                  |
| ------------------------- | --------------------------------------------------------- | ----------------------------------------- |
| `application/json`        | Public keys as base58 strings, instruction data as base64 | Development, debugging, any language      |
| `application/vnd.msgpack` | Public keys as 32-byte arrays, data as raw bytes          | Latency-sensitive production integrations |

{% hint style="warning" %}
The default is MessagePack. Set `Accept` explicitly on every request.
{% endhint %}

## Reading a quote response

| Field                     | Description                                                                                                                                       |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `quotes`                  | Object keyed by provider ID, not an array. Iterate with `Object.entries(quotes)`. One entry is returned unless `numQuotes` is set (maximum `10`). |
| `metadata.ExpectedWinner` | The route Titan recommends. Select this rather than sorting by `outAmount`.                                                                       |

## Portal or distributor access

Titan is also available through [Triton](https://docs.triton.one/trading-apis/titan-swap-api) and [QuickNode](https://marketplace.quicknode.com/add-on/titan-swap), which issue a JWT and their own endpoint.

|            | Developers Portal           | Distributor                                            |
| ---------- | --------------------------- | ------------------------------------------------------ |
| Access     | Self-serve key              | Token issued by your provider                          |
| Host       | `portal.api.titan.exchange` | Provider-supplied endpoint                             |
| Credential | `x-api-key`                 | `Authorization: Bearer <jwt>`                          |
| Encoding   | JSON or MessagePack         | MessagePack                                            |
| Interfaces | REST                        | REST, and WebSocket streaming for enterprise customers |

{% hint style="warning" %}
Credentials are not interchangeable. A distributor JWT sent to `portal.api.titan.exchange` returns `401 invalid_api_key`, as does a Portal key sent to a distributor endpoint.
{% endhint %}

## Next steps

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Quickstart</strong></td><td>Assemble and sign a swap transaction.</td><td><a href="/titan/developer-doc/developers-portal/quickstart.md">Quickstart</a></td></tr><tr><td><strong>Authentication</strong></td><td>Key handling, scope and rotation.</td><td><a href="/titan/developer-doc/developers-portal/authentication.md">Authentication</a></td></tr><tr><td><strong>API Reference</strong></td><td>Query parameters and response fields for all four endpoints.</td><td><a href="/titan/developer-doc/developers-portal/reference.md">API Reference</a></td></tr><tr><td><strong>Plans, Rate Limits &#x26; Credits</strong></td><td>Tier limits, credit accrual and upgrades.</td><td><a href="/titan/developer-doc/developers-portal/plans-rate-limits-credits.md">Plans, Rate Limits &amp; Credits</a></td></tr><tr><td><strong>Titan Genesis 50</strong></td><td>Launch offer: 25% off paid plans for 12 months.</td><td><a href="/titan/developer-doc/developers-portal/titan-genesis-50.md">Titan Genesis 50</a></td></tr><tr><td><strong>Latency and Server Locations</strong></td><td>Regions and colocation guidance.</td><td><a href="/titan/developer-doc/developers-portal/latency.md">Latency and Server Locations</a></td></tr><tr><td><strong>Errors</strong></td><td>Every error response and how to handle it.</td><td><a href="/titan/developer-doc/developers-portal/errors.md">Errors</a></td></tr><tr><td><strong>FAQ</strong></td><td>Common questions on access, requests, plans and Genesis 50.</td><td><a href="/titan/developer-doc/developers-portal/faq.md">FAQ</a></td></tr></tbody></table>
