# Build with AI: use the TTF API with an AI assistant

- Section: Start here (TTF API reference)
- Source: https://ttf.bot/developers/docs/#build-with-ai
- The whole reference as one text: https://ttf.bot/developers/docs/llms-full.txt

Give these docs to ChatGPT, Claude or the coding assistant in your editor, and let it write the code. Everything it needs is public text: no sign-in, no scraping.

## What an assistant can read

| What | Where | Use it for |
| --- | --- | --- |
| **One page as Markdown** | **Copy page** at the top of every page, or **View as Markdown** in the **Build with AI** menu beside it. Each page also has its own address: `https://ttf.bot/developers/docs/md/<page>.md` | A question about one endpoint, one alert type or one error. |
| **The whole reference** | [https://ttf.bot/developers/docs/llms-full.txt](https://ttf.bot/developers/docs/llms-full.txt) (the **Build with AI** menu copies it for you too) | Building a whole app: every endpoint, field, error and webhook in one text. |
| **The site in short** | [https://ttf.bot/llms.txt](https://ttf.bot/llms.txt) and [https://ttf.bot/llms-full.txt](https://ttf.bot/llms-full.txt) | What TTF is, which pages exist and the plain-language guides. |
| **The OpenAPI contract** | [https://api.ttf.bot/openapi.json](https://api.ttf.bot/openapi.json) (OpenAPI 3.1, JSON; the menu can download it too) | Tools that import a contract, typed clients, exact field names and limits. |
| **Open in ChatGPT or Claude** | In the **Build with AI** menu of every page | Starts a new chat in a new tab that already asks about that page (it sends the page's public address, nothing else). |

## Three steps

1. **Get a key**

   Sign in to the [dashboard](https://ttf.bot/developers/app/) (free), tab **Overview**, panel **API keys**, **Create key**. Keep it out of the chat with the assistant: let the code read it from an environment variable such as `TTF_API_KEY`.

2. **Give the assistant the docs**

   Paste the address of the whole reference (`https://ttf.bot/developers/docs/llms-full.txt`) or of the page you need, or press **Copy page** and paste the text. An assistant that cannot open links needs the pasted text.

3. **Ask for what you want**

   Say the language, what the program does and what it must not do. Start from a prompt below.

## Prompts to paste

Each one tells the assistant where the facts are, so it does not guess endpoint names.

### Check a token from a script

```
Read https://ttf.bot/developers/docs/md/token-security.md and https://ttf.bot/developers/docs/md/authentication.md.
Write a Python 3 script that takes a chain and a token address on the command line, calls the TTF API security check
with the key from the TTF_API_KEY environment variable, and prints the verdict, the score, the buy and sell tax and
every flag. Handle the error format from https://ttf.bot/developers/docs/md/errors.md and wait the Retry-After
seconds on 429. Use only the endpoints in those pages.
```

### Receive webhooks and check the signature

```
Read https://ttf.bot/developers/docs/md/webhooks.md, https://ttf.bot/developers/docs/md/webhook-signatures.md and
https://ttf.bot/developers/docs/md/webhook-retries.md.
Write a small Node.js (Express) server with one POST route for TTF webhooks. Verify X-TTF-Signature on the raw body
with the secret from the TTF_WEBHOOK_SECRET environment variable, refuse timestamps older than 5 minutes, answer 200
at once, drop duplicates by X-TTF-Delivery and log the event type. Test it with the signature vectors on that page.
```

### A typed client from the contract

```
Use the OpenAPI 3.1 contract at https://api.ttf.bot/openapi.json. Write a small typed TypeScript client for the
token endpoints I use (security, market, holders), with the key in the Authorization: Bearer header, retries only on
429 and 503 honouring Retry-After, and no other dependencies.
```

### Explain an error

```
The TTF API answered this error (pasted below). Read https://ttf.bot/developers/docs/md/errors.md and tell me in
plain words what it means, whether it cost credits, and what to change.
```

## End to end: a trending alert in your Telegram group and on your server

This example uses the API for data, a webhook for your own code, and a Telegram group for people. Only the first two need code.

1. **Data from the API**

   Ask the assistant for the script of the first prompt. The call it makes looks like this:

   ```bash
   curl -sS 'https://api.ttf.bot/v1/token/eth/0x6982508145454ce325ddbe47a25d4ec3d2311933/security' \
     -H 'Authorization: Bearer YOUR_KEY'
   ```

2. **A webhook to your server**

   Run the receiver of the second prompt on a public https address. In the [dashboard](https://ttf.bot/developers/app/), tab **Destinations**, add that address and copy the signing secret (`whsec_...`, shown once) into `TTF_WEBHOOK_SECRET`. Code can do the same with a key that has webhook access: [Manage webhooks from code](https://ttf.bot/developers/docs/md/webhook-api.md).

3. **An alert**

   Tab **Alerts**: **Trending tokens**, pick the chains and filters ([Trending alerts and filters](https://ttf.bot/developers/docs/md/alerts-trending.md)), send it to your server, and press **Send test alert**. The test arrives as a `ping`. Trending alerts need a paid plan or the trial ([Plans](https://ttf.bot/developers/docs/md/plans.md)).

4. **The same alert in a Telegram group, no code**

   Tab **Destinations**, **Telegram**, **A group**. The page gives you a one-time code; with the TTF bot already in the group, send the command it shows in the group, for example `/hooklink@TTFBotBot YOUR-ONE-TIME-CODE` with your own code at the end. Then **Make an alert for it** ([Alerts in Telegram](https://ttf.bot/developers/docs/md/telegram-alerts.md)). You never create a bot and never give TTF a bot token: the TTF bot posts the messages.

## Good to know

- **Never paste your API key or a webhook secret into a chat with an assistant.** Use `YOUR_KEY` in the prompt and an environment variable in the code.
- Telegram and Discord destinations are connected in the dashboard only: the API cannot create them, because only you can prove that a chat is yours.
- There is no official SDK package yet: an assistant writes plain HTTPS calls, or makes a client from the OpenAPI contract.
- Data calls cost credits ([Credits and limits](https://ttf.bot/developers/docs/md/credits.md)); webhook management calls and alerts do not.
- An assistant can be wrong. When its code and these pages disagree, these pages are right; the [error page](https://ttf.bot/developers/docs/errors/) says what each error code means.
