Docs

# Connect your agent

Use Agentline from ChatGPT or Claude with MCP, or from your own code with the REST API.

[Quickstart](#quickstart)[Claude connector](#claude)[ChatGPT](#chatgpt)[MCP tools](#mcp)[REST API](#rest)[One-time codes](#codes)[Texting (coming soon)](#sms-rules)[Errors & limits](#errors)

## Quickstart

- [Create an account](https://agentline.nz/signup) on the Free plan (inbox only, no card), or start a 7-day free trial of Starter or Pro (card required). Your email inbox is live from day one.
- Connect ChatGPT, Claude or another MCP client using the URL below ([one-click installs for 13 clients](https://agentline.nz/install)), or create an API key under **Dashboard → API keys**.
- Ask your agent: "What's your Agentline email address?" and then "Sign up for … and wait for the code."

MCP server URL (Streamable HTTP):

```
https://agentline.nz/mcp
```

## Claude connector

- In Claude (web or desktop) open **Customize → Connectors → + Add → Custom → Web** (or use the [Add to Claude](https://agentline.nz/install#claude) link, which pre-fills it).
- Name it _Agentline_ and paste `https://agentline.nz/mcp` as the URL. Leave the OAuth client fields empty.
- Click **Connect**. Sign in to Agentline with your email link and approve access.
- In a chat, enable the Agentline tools from the tools menu. On Team and Enterprise plans an owner adds the connector for the organisation first.

Claude Code: `claude mcp add --transport http agentline https://agentline.nz/mcp`, then run `/mcp` to sign in.

## ChatGPT

- In ChatGPT go to **Plugins**, select the **+** button, then **Add custom MCP server**.
- Name it _Agentline_. Under **Connection**, enter `https://agentline.nz/mcp` and choose **OAuth** for authentication.
- Review the risk warning, select **I understand and want to continue**, then **Create as a plugin**.
- Sign in to Agentline (or create an account) and approve access. In a chat, type **@** and pick Agentline.

ChatGPT asks you to confirm before Agentline sends anything, because the send tools are marked as write actions. Emails appear as compact cards in the conversation. One-time codes are always hidden in ChatGPT (a message that looks like it contains one shows only its sender and time), so read them in your Agentline dashboard; Claude, Cursor and API-key agents get them through `wait_for_code`.

## MCP tools

| Tool | What it does | Scope |
| --- | --- | --- |
| get_my_inbox | Your inbox(es), plan, allowances and any sending restriction. Call first. | read |
| get_my_number | Legacy name for get_my_inbox; returns the same. | read |
| wait_for_code | Wait up to 55s for a one-time code to arrive in your inbox; each code returned once. | read |
| send_email | Email from your @agentline.nz address (up to 5 recipients). | send |
| list_emails | Recent emails, newest first (filter by direction, unread_only, since). | read |
| read_email | Full email text by id. Reading never changes read state. | read |
| mark_read | Mark emails read (or unread with read=false), up to 100 ids. | read |
| list_api_keys | API keys (prefix, name, last used). | read |
| create_api_key | New API key; secret shown once. | send |
| revoke_api_key | Revoke a key (destructive). | send |
| list_audit_log | Recent account events. | read |
| get_billing | Plan, status, trial end, allowances. | read |
| get_checkout_link | Stripe Checkout link to start a plan, emailed to the owner and returned. | send |
| get_billing_portal_link | Stripe Customer Portal link (card, plan, cancel), also emailed to the owner. | send |
| get_profile | Which account is connected. | read |
| send_sms | Send a text. Coming soon: texting isn't available yet. | send |
| list_messages | List texts. Coming soon: texting isn't available yet. | read |
| read_message | Read one text. Coming soon: texting isn't available yet. | read |
| list_calls | List calls. Coming soon: calls aren't available yet. | read |
| get_voice_settings | Call settings. Coming soon: calls aren't available yet. | read |
| update_voice_settings | Change call settings. Coming soon: calls aren't available yet. | send |
| start_owner_phone_verification | Verify the owner's mobile. Coming soon: texting isn't available yet. | send |
| verify_owner | Confirm the owner's mobile with a code. Coming soon: texting isn't available yet. | send |

Your own agents can use the same MCP endpoint with an API key: send `Authorization: Bearer al_live_…`.

## REST API

Base URL `https://agentline.nz/api/v1`. Authenticate with `Authorization: Bearer al_live_…`. Requests and responses are JSON. An OpenAPI description is at [/api/v1/openapi.json](https://agentline.nz/api/v1/openapi.json).

| Method | Path | Description |
| --- | --- | --- |
| GET | /api/v1/me | Your plan, inboxes and monthly usage |
| GET | /api/v1/emails | List emails (query: direction, unread_only, since_seconds, limit) |
| POST | /api/v1/emails | Send an email: { to, subject, text, html?, from?, reply_to_id? } |
| GET | /api/v1/emails/{id} | Read one email (doesn't change read state) |
| POST | /api/v1/mark-read | Mark emails read, or unread: { ids, read? } |
| GET | /api/v1/emails/{id}/raw | Download the original .eml |
| POST | /api/v1/wait-for-code | Wait for a one-time code: { channel?, timeout_seconds?, from_contains?, since_seconds? } |
| POST | /api/v1/signup | Agent self-signup, no auth: { owner_email, agent_name? } → api_key, inbox, mcp config |
| GET | /api/v1/keys | List API keys |
| POST | /api/v1/keys | Create an API key (shown once): { name } |
| DELETE | /api/v1/keys/{id} | Revoke an API key |
| GET | /api/v1/audit | Recent account events |
| GET | /api/v1/billing | Plan, status, trial and allowances |
| POST | /api/v1/billing/checkout | Email the owner a Stripe Checkout link (also returned): { plan } |
| POST | /api/v1/billing/portal | Stripe Customer Portal link, also emailed to the owner |

Texting, calls and owner mobile checks are coming soon. Their endpoints (`/sms`, `/calls`, `/voice`, `/owner/phone`, `/owner/verify`) appear in the OpenAPI description but aren't available yet.

```
curl https://agentline.nz/api/v1/emails \
  -H "Authorization: Bearer $AGENTLINE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"you@example.nz","subject":"Booking confirmed","text":"Kia ora! Your table for 2 at 7pm is confirmed."}'
```

## One-time codes

Every inbound email is scanned for a one-time code. `wait_for_code` returns the newest code that hasn't already been handed out, waiting if needed. Use `from_contains` to match a sender (for example "Google" or "noreply@github.com") when several codes may arrive at once.

```
curl -X POST https://agentline.nz/api/v1/wait-for-code \
  -H "Authorization: Bearer $AGENTLINE_KEY" -H "Content-Type: application/json" \
  -d '{"channel":"any","timeout_seconds":45}'
# → {"found":true,"code":"482913","channel":"email","from":"noreply@github.com","receivedAt":"…"}
```

## Texting (coming soon)

Texting and phone numbers are coming soon and aren't available yet. When texting launches, it will be for transactional and assistant messages only (replies, bookings, reminders people asked for, codes), never marketing or bulk. [Join the waitlist](https://agentline.nz/pricing#texting) and we'll tell you when it's ready.

## Errors and limits

Errors return `{"error":{"code":"…","message":"…"}}` with an HTTP status:

- `401` missing or invalid API key · `402` subscription or allowance needed · `403` opted-out recipient or suspended account
- `422` content blocked by a safety check, including `content_marketing` for promotional messages (the message explains why) · `429` rate limited (see `Retry-After`)

Limits per account: 120 API requests a minute per key; 10 emails a minute and 200 a day. Monthly plan allowances apply on top.

API-key responses carry `RateLimit-Limit` (requests allowed in the window), `RateLimit-Remaining` (requests left in it) and `RateLimit-Reset` (seconds until it resets). Every 429 sends `Retry-After`. A 429 from one of Agentline's own limits also sends the RateLimit headers for the limit you reached.
