---
title: "Verify an email code"
canonical_url: "https://tweetstream.io/docs/api/verify-agent-email-code"
last_updated: 2026-11-05
---

# Verify an email code

Verify the code. Send acceptTerms true only after the person has read and agreed to https://tweetstream.io/terms. Returns the account's API key, shown once, and a setup proof that lasts 30 minutes.

Canonical URL: https://tweetstream.io/docs/api/verify-agent-email-code

## `POST /api/agent/email-code/verify`

`https://tweetstream.io/api/agent/email-code/verify`

## Body

| Name | Type | Description |
| --- | --- | --- |
| `acceptTerms` | `boolean` |  |
| `challengeId` | `string`, required | a string matching the pattern ^[0-9a-f]{64}$ |
| `code` | `string`, required | a string matching the pattern ^\d{6}$ |
| `family` | `enum<string>` |  |

### Body example

```json
{
  "acceptTerms": true,
  "challengeId": "4f1c9e2a7b3d8065c1e4a9f27d3b5c8e0a6f1d2b9c4e7a3f5d8b0c6e2a9f1d47",
  "code": "482913",
  "family": "BASE"
}
```

## Response fields

| Name | Type | Description |
| --- | --- | --- |
| `checkoutId` | `string` | a string matching the pattern ^pl_[a-z0-9]{1,64}$ |
| `family` | `enum<string>`, required |  |
| `next` | `object`, required |  |
| `next.message` | `string` | a string at most 500 character(s) long |
| `next.action` | `enum<string>`, required |  |
| `next.method` | `enum<string>`, required |  |
| `next.url` | `string`, required | a string matching the pattern ^(https\|wss):\/\/[^\s]+$ |
| `next.who` | `enum<string>`, required |  |
| `offer` | `object` |  |
| `offer.amountDueNow` | `object`, required |  |
| `offer.amountDueNow.currency` | `enum<string>`, required |  |
| `offer.amountDueNow.minor` | `string`, required | a string matching the pattern ^(0\|[1-9][0-9]*)$ |
| `offer.mode` | `enum<string>`, required |  |
| `offer.planName` | `string`, required |  |
| `offer.renewal` | `object`, required |  |
| `offer.renewal.amount` | `object`, required |  |
| `offer.renewal.amount.currency` | `enum<string>`, required |  |
| `offer.renewal.amount.minor` | `string`, required | a string matching the pattern ^(0\|[1-9][0-9]*)$ |
| `offer.renewal.at` | `string`, required | a string to be decoded into a Date |
| `offer.renewal.billingCycle` | `enum<string>`, required |  |
| `offer.renewal.thenAmount` | `object`, required |  |
| `offer.renewal.thenAmount.currency` | `enum<string>`, required |  |
| `offer.renewal.thenAmount.minor` | `string`, required | a string matching the pattern ^(0\|[1-9][0-9]*)$ |
| `paymentUrl` | `string` | a string matching the pattern ^(https\|wss):\/\/[^\s]+$ |
| `reason` | `enum<string>`, required |  |
| `status` | `enum<string>`, required |  |
| `apiKey` | `string`, required |  |
| `setupProof` | `string`, required |  |

## Responses

| Status | Description | Headers |
| --- | --- | --- |
| `200` | Success |  |
| `400` | Invalid request, wrong code, or the Terms were not accepted |  |
| `403` | The account is restricted, or the request carried a foreign Origin |  |
| `429` | Rate limit or activation budget reached; retry after retryAfterSeconds |  |
| `503` | Temporarily unavailable; retry later |  |

### 200

```json
{
  "status": "payment_required",
  "family": "BASE",
  "reason": "new",
  "apiKey": "<the account's API key, shown once>",
  "setupProof": "<setup proof, valid for 30 minutes>",
  "next": {
    "action": "create_checkout",
    "who": "agent",
    "method": "POST",
    "url": "https://tweetstream.io/api/agent/checkout"
  }
}
```

### 400

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 403

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 429

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 503

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://tweetstream.io/api/agent/email-code/verify \
  --header 'Content-Type: application/json' \
  --data '{
  "challengeId": "4f1c9e2a7b3d8065c1e4a9f27d3b5c8e0a6f1d2b9c4e7a3f5d8b0c6e2a9f1d47",
  "code": "482913"
}'
```

### JavaScript

```javascript
const response = await fetch("https://tweetstream.io/api/agent/email-code/verify", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "challengeId": "4f1c9e2a7b3d8065c1e4a9f27d3b5c8e0a6f1d2b9c4e7a3f5d8b0c6e2a9f1d47",
    "code": "482913"
  }),
});

console.log(response.status, await response.json());
```

### Python

```python
import requests

response = requests.post(
    "https://tweetstream.io/api/agent/email-code/verify",
    json={
        "challengeId": "4f1c9e2a7b3d8065c1e4a9f27d3b5c8e0a6f1d2b9c4e7a3f5d8b0c6e2a9f1d47",
        "code": "482913",
    },
)

print(response.status_code, response.json())
```
