---
title: "Start a Scale trial"
canonical_url: "https://tweetstream.io/docs/api/start-agent-scale-trial"
last_updated: 2026-11-05
---

# Start a Scale trial

Start a Scale trial with a code from the TweetStream team.

Canonical URL: https://tweetstream.io/docs/api/start-agent-scale-trial

## `POST /api/agent/scale-trial`

`https://tweetstream.io/api/agent/scale-trial`

## Authorization

| Name | Type | Description |
| --- | --- | --- |
| `Authorization` | `string`, required | Bearer authentication with your TweetStream API key: `Bearer <key>`. |

## Headers

| Name | Type | Description |
| --- | --- | --- |
| `Idempotency-Key` | `string`, required | Required. Generate one key per intended purchase or change and reuse it on retries; the same key returns the same result. |

## Body

| Name | Type | Description |
| --- | --- | --- |
| `code` | `string`, required | a string at most 128 character(s) long |

### Body example

```json
{
  "code": "SCALE-TRIAL-CODE"
}
```

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

## Responses

| Status | Description | Headers |
| --- | --- | --- |
| `200` | Success |  |
| `400` | Invalid request, wrong code, or the Terms were not accepted |  |
| `401` | Missing or invalid API key, or the setup proof is missing or expired |  |
| `403` | The account is restricted, or the request carried a foreign Origin |  |
| `409` | Idempotency, checkout, offer or trial conflict |  |
| `429` | Rate limit or activation budget reached; retry after retryAfterSeconds |  |
| `503` | Temporarily unavailable; retry later |  |

### 200

```json
{
  "status": "ready",
  "family": "BASE",
  "access": {
    "kind": "trial",
    "through": "2026-11-01T12:00:00.000Z"
  },
  "stream": {
    "url": "wss://ws-global.tweetstream.io/ws",
    "subprotocol": "tweetstream.v1",
    "credentialScope": "STANDARD"
  },
  "next": {
    "action": "select_accounts",
    "who": "agent",
    "method": "POST",
    "url": "https://tweetstream.io/api/add-account"
  },
  "optionalSteps": [
    {
      "action": "issue_discord_link",
      "who": "agent",
      "method": "POST",
      "url": "https://tweetstream.io/api/agent/discord-link"
    }
  ]
}
```

### 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"
  }
}
```

### 401

```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"
  }
}
```

### 409

```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/scale-trial \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header 'Idempotency-Key: 7c9e6679-7425-40de-944b-e07fc1f90ae7' \
  --header 'Content-Type: application/json' \
  --data '{
  "code": "SCALE-TRIAL-CODE"
}'
```

### JavaScript

```javascript
const response = await fetch("https://tweetstream.io/api/agent/scale-trial", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "Idempotency-Key": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "code": "SCALE-TRIAL-CODE"
  }),
});

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

### Python

```python
import os
import requests

response = requests.post(
    "https://tweetstream.io/api/agent/scale-trial",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}", "Idempotency-Key": "7c9e6679-7425-40de-944b-e07fc1f90ae7"},
    json={
        "code": "SCALE-TRIAL-CODE",
    },
)

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