---
title: "Issue a Discord link"
canonical_url: "https://tweetstream.io/docs/api/issue-agent-discord-link"
last_updated: 2026-11-05
---

# Issue a Discord link

Issue the Discord link the person opens to link Discord and join the TweetStream community. Some checkouts need it before payment; status says when.

Canonical URL: https://tweetstream.io/docs/api/issue-agent-discord-link

## `POST /api/agent/discord-link`

`https://tweetstream.io/api/agent/discord-link`

## Authorization

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

## Headers

| Name | Type | Description |
| --- | --- | --- |
| `X-TweetStream-Setup-Proof` | `string`, required | The setupProof returned by email verification. It lasts 30 minutes; after that, verify a new email code. |

## Body

| Name | Type | Description |
| --- | --- | --- |
| `family` | `enum<string>`, required |  |

### Body example

```json
{
  "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 |  |
| `discord` | `object`, required |  |
| `discord.expiresAt` | `string`, required | a string to be decoded into a Date |
| `discord.required` | `boolean`, required | Whether the open checkout waits for the person to join before it can be paid. |
| `discord.url` | `string`, required | a string matching the pattern ^(https\|wss):\/\/[^\s]+$ |

## 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 |  |
| `404` | No such checkout or link, or the account has no entitlement for this product |  |
| `429` | Rate limit or activation budget reached; retry after retryAfterSeconds |  |
| `503` | Temporarily unavailable; retry later |  |

### 200

```json
{
  "status": "community_required",
  "family": "BASE",
  "reason": "COMMUNITY_REQUIRED",
  "checkoutId": "pl_8k2m4q7x",
  "discord": {
    "url": "https://tweetstream.io/connect/discord/EXAMPLE_DISCORD_LINK",
    "expiresAt": "2026-10-29T13:00:00.000Z",
    "required": true
  },
  "next": {
    "action": "join_discord",
    "who": "human",
    "url": "https://tweetstream.io/connect/discord/EXAMPLE_DISCORD_LINK",
    "pollUrl": "https://tweetstream.io/api/agent/status?checkoutId=pl_8k2m4q7x",
    "afterSeconds": 5
  }
}
```

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

### 404

```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/discord-link \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header "X-TweetStream-Setup-Proof: $TWEETSTREAM_SETUP_PROOF" \
  --header 'Content-Type: application/json' \
  --data '{
  "family": "BASE"
}'
```

### JavaScript

```javascript
const response = await fetch("https://tweetstream.io/api/agent/discord-link", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "X-TweetStream-Setup-Proof": process.env.TWEETSTREAM_SETUP_PROOF,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "family": "BASE"
  }),
});

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

### Python

```python
import os
import requests

response = requests.post(
    "https://tweetstream.io/api/agent/discord-link",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}", "X-TweetStream-Setup-Proof": os.environ["TWEETSTREAM_SETUP_PROOF"]},
    json={
        "family": "BASE",
    },
)

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