# AI assistants

- Page: https://bytesms.com/docs/ai (markdown: https://bytesms.com/docs/ai.md)
- API base URL: https://api.bytesms.com/api (public resources under /api/v1)
- Auth: `Authorization: Bearer tp_live_…` — an API key from Dashboard → API Keys; keep it server-side (e.g. `BYTESMS_API_KEY`)
- All docs in one file: https://bytesms.com/llms-full.txt · OpenAPI 3.1: https://bytesms.com/openapi.json

Use Bytesms from ChatGPT, Claude, Cursor or any coding assistant: a copy-paste integration prompt, markdown docs, llms-full.txt and the MCP server.

AI coding assistants often don't know Bytesms yet, and a web search for the name can turn up unrelated SMS providers. Give your assistant the facts directly, either by pasting the prompt below or by connecting the Bytesms [MCP server](https://bytesms.com/docs/mcp), and it can write a correct integration on the first try.

## Copy-paste prompt

Paste this into ChatGPT, Claude, Cursor, Copilot, Gemini or any other assistant, then replace the last line with your task. It covers the base URL, the auth header, a working `POST /v1/emails` body, the test addresses and where the full docs live.

**Prompt for your AI assistant**

```
I want to send email with Bytesms (https://bytesms.com). Bytesms is an email API for developers (transactional + marketing email, plus WhatsApp OTP) — it is NOT an SMS provider.

Facts you need:
- Base URL: https://api.bytesms.com/api (public endpoints are under /api/v1)
- Auth header: Authorization: Bearer <API key>. Keys start with tp_live_. Read the key from the environment variable BYTESMS_API_KEY and only use it server-side (never in browser or mobile code).
- Send an email: POST https://api.bytesms.com/api/v1/emails with a JSON body such as
  {"from": "Acme <hello@yourdomain.com>", "to": ["user@example.com"], "subject": "Hello", "html": "<p>It works!</p>"}
  The response is 200 {"id": "..."}. Optional fields: text, cc, bcc (max 50 recipients in total), reply_to, headers, tags, scheduled_at, template {id, variables}. Send an Idempotency-Key header to make retries safe. Attachments are not supported.
- "from" must be on a domain verified in the Bytesms workspace. Before that, use onboarding@mail.bytesms.com, which can only send to your own account email and test addresses.
- Test recipients (no real mailbox, real events and webhooks): delivered@test.bytesms.com, bounced@test.bytesms.com, complained@test.bytesms.com, suppressed@test.bytesms.com
- Errors are JSON {"statusCode", "message", "name"}; 429 means a rate limit (10 requests/second per workspace by default) or a quota.
- SMTP is also available: smtp.bytesms.com, port 465 (TLS) or 587 (STARTTLS), username "bytesms", password = the API key.

Full documentation as markdown: https://bytesms.com/llms-full.txt (index: https://bytesms.com/llms.txt, OpenAPI 3.1: https://bytesms.com/openapi.json, any single page: https://bytesms.com/docs/<page>.md). Read it before writing code, and use only the fields documented there.

Task: <describe what you want to build>
```

## Docs in markdown

Every docs page has a markdown version, generated from the same source as the HTML page, so the two always match:

- [/llms-full.txt](https://bytesms.com/llms-full.txt): all docs in one markdown file. Give an assistant this URL (or its contents) for a complete reference.
- [/llms.txt](https://bytesms.com/llms.txt): a short index in the [llms.txt](https://llmstxt.org)format, with a link to each page's markdown.
- `/docs/<page>.md`: one page, e.g. [/docs/emails.md](https://bytesms.com/docs/emails.md). Every page also has **Copy for LLM**, **View as Markdown** and **Open in ChatGPT / Claude** buttons under its title.
- [/openapi.json](https://bytesms.com/openapi.json): the OpenAPI 3.1 spec of the public `/v1` API, for tools that generate clients.

## Store the API key

Create a key in **Dashboard → API Keys** and keep it in an environment variable. We suggest the name `BYTESMS_API_KEY`, which is the name the prompt above tells the assistant to read. For an agent that only needs to send, create a [sending-access key](https://bytesms.com/docs/authentication#permissions), optionally limited to one domain.

**.env**

```
BYTESMS_API_KEY=tp_live_xxxxxxxxx
```

## Connect the MCP server

With the MCP server connected, the assistant calls Bytesms itself: it can send email, check delivery and manage domains and API keys, so you don't have to paste anything. The server is `https://api.bytesms.com/api/mcp`. It uses Streamable HTTP and signs you in with OAuth (the client opens a Bytesms consent screen where you pick the workspace and access level). Clients that can send custom headers can use an API key instead. The [MCP server](https://bytesms.com/docs/mcp) page has the tool list, scopes, more clients and the protocol details.

### With OAuth (recommended)

**Claude Code**

```bash
claude mcp add --transport http bytesms https://api.bytesms.com/api/mcp
# then run /mcp inside Claude Code and sign in
```

**Claude Desktop**

```
Settings → Connectors → Add custom connector
  Name: Bytesms
  URL:  https://api.bytesms.com/api/mcp
Then click Connect and approve access on the Bytesms consent screen.
```

**Cursor**

```jsonc
// ~/.cursor/mcp.json (or .cursor/mcp.json in the project)
{
  "mcpServers": {
    "bytesms": {
      "url": "https://api.bytesms.com/api/mcp"
    }
  }
}
```

**VS Code**

```jsonc
// .vscode/mcp.json
{
  "servers": {
    "bytesms": {
      "type": "http",
      "url": "https://api.bytesms.com/api/mcp"
    }
  }
}
```

### With an API key

**Claude Code**

```bash
claude mcp add --transport http bytesms https://api.bytesms.com/api/mcp \
  --header "Authorization: Bearer $BYTESMS_API_KEY"
```

**Cursor**

```jsonc
{
  "mcpServers": {
    "bytesms": {
      "url": "https://api.bytesms.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${env:BYTESMS_API_KEY}"
      }
    }
  }
}
```

**VS Code**

```jsonc
{
  "inputs": [
    {
      "type": "promptString",
      "id": "bytesms-key",
      "description": "Bytesms API key",
      "password": true
    }
  ],
  "servers": {
    "bytesms": {
      "type": "http",
      "url": "https://api.bytesms.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${input:bytesms-key}"
      }
    }
  }
}
```

Claude Desktop custom connectors sign in with OAuth only, so use the OAuth flow there.

> **Warning: Agents act with your permissions**
>
> An agent with a full-access key or the `full` scope can create API keys and delete domains. Give it the `sending` scope or a sending-access key unless it really needs more, and test against `delivered@test.bytesms.com` first.
