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

# TTAPI Quick Start | AI API Integration Guide (Image, Video, Audio, LLM APIs)

> This guide helps you quickly get started with TTAPI and integrate image, video, audio, and LLM APIs through a unified API gateway. Complete your first API call in minutes.

## 1. Get your API key

Before you call any API, you need a `TT-API-KEY`.

### Step 1: Create your account

<AccordionGroup>
  <Accordion title="Sign in to TTAPI">
    Go to [TTAPI](https://ttapi.io/) or open the [TTAPI Dashboard](https://dashboard.ttapi.io/login). You can sign in with `GitHub` or `Google`.
  </Accordion>

  <Accordion title="Default API key and trial credit">
    After your account is created, TTAPI generates a default `TT-API-KEY`. This key is used across all TTAPI endpoints.

    New accounts also receive `30 quota` (about `$0.30`) in trial credit.
  </Accordion>
</AccordionGroup>

### Step 2: Basic account setup

<AccordionGroup>
  <Accordion icon="key" title="Reset your TT-API-KEY">
    For security, we recommend rotating the default key before production use. You can reset it directly from the dashboard homepage.
  </Accordion>

  <Accordion icon="circle-user" title="Password login">
    If you do not want to rely on GitHub or Google login later, use `Forgot password?` on the [login page](https://dashboard.ttapi.io/login) and set a password for your TTAPI account.
  </Accordion>
</AccordionGroup>

## 2. Add the request header

All requests must include your API key in the header:

```bash theme={null}
TT-API-KEY: YOUR_API_KEY
```

## 3. Send your first request

### Step 1: Submit a generation request

The example below creates a Midjourney image task.

<CodeGroup>
  ```bash title="cURL" theme={null}
  curl --request POST \
    --url https://api.ttapi.io/midjourney/v1/imagine \
    --header 'Content-Type: application/json' \
    --header 'TT-API-KEY: YOUR_API_KEY' \
    --data '
  {
    "prompt": "A cute kitten",
    "mode": "fast",
    "hookUrl": "<string>"
  }
  '
  ```

  ```python title="Python" theme={null}
  import requests

  url = "https://api.ttapi.io/midjourney/v1/imagine"

  payload = {
      "prompt": "A cute kitten",
      "mode": "fast",
      "hookUrl": "<string>"
  }
  headers = {
      "TT-API-KEY": "YOUR_API_KEY",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.text)
  ```

  ```javascript title="JavaScript" theme={null}
  const options = {
    method: "POST",
    headers: {
      "TT-API-KEY": "YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      prompt: "A cute kitten",
      mode: "fast",
      hookUrl: "<string>"
    })
  };

  fetch("https://api.ttapi.io/midjourney/v1/imagine", options)
    .then((res) => res.json())
    .then((res) => console.log(res))
    .catch((err) => console.error(err));
  ```

  ```java title="Java" theme={null}
  HttpResponse<String> response = Unirest.post("https://api.ttapi.io/midjourney/v1/imagine")
    .header("TT-API-KEY", "YOUR_API_KEY")
    .header("Content-Type", "application/json")
    .body("{\n  \"prompt\": \"A cute kitten\",\n  \"mode\": \"fast\",\n  \"hookUrl\": \"<string>\"\n}")
    .asString();
  ```
</CodeGroup>

#### Sample response

```json theme={null}
{
  "status": "SUCCESS",
  "message": "success",
  "data": {
    "jobId": "b8bd3ff0-4349-4b71-8938-5e13aefa64fe"
  }
}
```

### Step 2: Fetch the task result

Use the returned `jobId` to poll the result:

<CodeGroup>
  ```bash title="cURL" theme={null}
  curl -X GET "https://api.ttapi.io/midjourney/v1/fetch?jobId={jobId}" \
    -H "TT-API-KEY: YOUR_API_KEY"
  ```

  ```python title="Python" theme={null}
  import requests

  url = "https://api.ttapi.io/midjourney/v1/fetch"
  headers = {"TT-API-KEY": "YOUR_API_KEY"}
  params = {"jobId": "jobId"}

  response = requests.get(url, headers=headers, params=params)
  print(response.status_code)
  print(response.json())
  ```

  ```javascript title="JavaScript" theme={null}
  const options = {
    method: "GET",
    headers: {"TT-API-KEY": "YOUR_API_KEY"}
  };

  fetch("https://api.ttapi.io/midjourney/v1/fetch?jobId={jobId}", options)
    .then((res) => res.json())
    .then((res) => console.log(res))
    .catch((err) => console.error(err));
  ```

  ```java title="Java" theme={null}
  OkHttpClient client = new OkHttpClient();

  Request request = new Request.Builder()
    .url("https://api.ttapi.io/midjourney/v1/fetch?jobId={jobId}")
    .get()
    .addHeader("TT-API-KEY", "YOUR_API_KEY")
    .build();

  Response response = client.newCall(request).execute();
  System.out.println(response.body().string());
  ```
</CodeGroup>

#### Sample response

```json theme={null}
{
  "status": "SUCCESS",
  "message": "",
  "jobId": "8ddd973f-b5ff-4192-b418-b37fb65c65f3",
  "data": {
    "action": "imagine",
    "jobId": "8ddd973f-b5ff-4192-b418-b37fb65c65f3",
    "progress": "100",
    "prompt": "A cute kitten",
    "quota": "2",
    "discordImage": "https://cdn.ttapi.io/midjourney/2025-11-14/20260307_024522_19cf9806e1c7438b.png",
    "cdnImage": "https://cdn.ttapi.io/midjourney/2025-11-14/20260307_024522_19cf9806e1c7438b.png",
    "width": 960,
    "height": 1200,
    "hookUrl": "https://webhook-test.com/40bb50795afa242aee8c837617cd72e9",
    "components": [
      "upsample1", "upsample2", "upsample3", "upsample4", "reroll", "variation1", "variation2", "variation3", "variation4"
    ],
    "seed": null,
    "images": [
      "https://cdn.ttapi.io/midjourney/20260307/5c7261ec-7271-495d-a0f7-4dd395652a84tl.png",
      "https://cdn.ttapi.io/midjourney/20260307/5c7261ec-7271-495d-a0f7-4dd395652a84tr.png",
      "https://cdn.ttapi.io/midjourney/20260307/5c7261ec-7271-495d-a0f7-4dd395652a84bl.png",
      "https://cdn.ttapi.io/midjourney/20260307/5c7261ec-7271-495d-a0f7-4dd395652a84br.png"
    ]
  }
}
```

## Task statuses

| Status          | Meaning                |
| :-------------- | :--------------------- |
| `PENDING_QUEUE` | Waiting in queue       |
| `ON_QUEUE`      | Being processed        |
| `SUCCESS`       | Completed successfully |
| `FAILED`        | Failed                 |

## Popular next steps

* Start the [Suno API Quickstart](/grids/en/start/suno-api-quickstart) if you want to generate music instead of images.
* Read the [Suno async workflow guide](/grids/en/start/suno-api-async-workflow) if your integration relies on webhooks or polling.
* Read the [Suno workflow guide](/grids/en/start/suno-api-workflows) when you need the right Suno endpoint for your product.

## Need help?

* For queue and concurrency limits, see [Queue](/grids/en/faq/queue)
* For request signing and headers, see [Gateway & Auth](/grids/en/development/authentication)
* For support, see [Contact](/grids/en/about/connect)
