> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ttapi.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Gateway & Auth

> Gateway domains, request rules, and how to authenticate with TTAPI

## Overview

The TTAPI gateway is the entry point for all API requests. It handles routing, authentication, and traffic control. Every request must pass gateway authentication, otherwise the API returns `401`.

<Callout type="info" title="Gateway domains">
  ### General API domains

  * **Primary**: `https://api.ttapi.io`
    * Recommended for most requests
  * **Accelerated**: `https://api.ttapi.org`
    * Recommended for longer-running synchronous requests

  ### Midjourney hosting domains

  * **Primary**: `https://hold.ttapi.io`
  * **Accelerated**: `https://hold.ttapi.org`

  ### Claude Code domains

  * **Primary**: `https://cc.ttapi.io`
    * Recommended for most requests
  * **Accelerated**: `https://cc.ttapi.org`
    * Recommended for longer-running synchronous requests
</Callout>

## Authentication

All TTAPI endpoints use `TT-API-KEY` in the request header.

* Header name: `TT-API-KEY`
* Location: HTTP request header
* Case sensitivity: case-sensitive
* Key source: [TTAPI Dashboard](https://dashboard.ttapi.io/)

## Request rules

| Item         | Requirement               |
| :----------- | :------------------------ |
| Protocol     | HTTPS only                |
| Method       | Follow the API definition |
| Encoding     | UTF-8                     |
| Content type | `application/json`        |

## Auth errors

| HTTP code | Meaning               | What to check                               |
| :-------- | :-------------------- | :------------------------------------------ |
| `401`     | Authentication failed | Missing key, wrong key, or inactive account |

#### Sample error response

```json theme={null}
{
  "status": "FAILED",
  "message": "Wrong TT-API-KEY or email is not activated."
}
```
