# Get the link that connects a Discord server

`GET https://api.tryscouty.com/v1/campaigns/{campaignId}/activation/discord/install-link`

Returns the link that adds Scouty's bot to a Discord server and connects it to this campaign, the same one the campaign page offers. A person opens it in a browser signed in to the dashboard and picks the server in Discord. It works for 30 minutes. Also the way to grant permissions the bot is missing.

- Scope: `campaigns:read`
- Kind: read
- MCP tool: `scouty_get_discord_install_link`

## Authorization

Send `Authorization: Bearer $SCOUTY_TOKEN`. The token needs the `campaigns:read` scope.

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `campaignId` | `integer` | Required | The campaign whose activation flow this is about. |

## Request

### cURL

```bash
curl -s https://api.tryscouty.com/v1/campaigns/42/activation/discord/install-link \
  -H "Authorization: Bearer $SCOUTY_TOKEN"
```

### JavaScript

```js
const response = await fetch("https://api.tryscouty.com/v1/campaigns/42/activation/discord/install-link", {
  headers: {
    Authorization: `Bearer ${process.env.SCOUTY_TOKEN}`,
  },
});
console.log(await response.json());
```

### Python

```python
import os

import requests

token = os.environ["SCOUTY_TOKEN"]
response = requests.get(
    "https://api.tryscouty.com/v1/campaigns/42/activation/discord/install-link",
    headers={"Authorization": f"Bearer {token}"},
)
print(response.json())
```

## Responses

### 200 OK

```json
{
  "campaignId": 42,
  "installUrl": "https://discord.com/oauth2/authorize?client_id=000000000000000000&state=example",
  "expiresInMinutes": 30,
  "connected": false,
  "serverName": null,
  "note": "Open it in a browser signed in to the Scouty dashboard. Discord asks which server to add Scouty to, then sends you back to the campaign."
}
```

### 401 Unauthorized

```json
{
  "error": {
    "code": "missing_token",
    "message": "This API needs an Authorization header carrying a bearer token."
  }
}
```

### 403 Forbidden

```json
{
  "error": {
    "code": "insufficient_scope",
    "message": "This token does not carry the campaigns:read scope. Ask the team for one that does."
  }
}
```

### 404 Not Found

```json
{
  "error": {
    "code": "not_found",
    "message": "No such campaign."
  }
}
```

### 429 Too Many Requests

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests. Please wait for the current minute to end."
  }
}
```

## Errors

| Status | `error.code` | Meaning |
|---|---|---|
| 401 Unauthorized | `missing_token`, `invalid_token`, `token_revoked`, `token_expired`, `token_orphaned` | No token, or one that is not recognized, revoked or expired. |
| 403 Forbidden | `insufficient_scope`, `wrong_principal` | The token does not carry the scope this capability needs. |
| 404 Not Found | `not_found` | No such route, or no such campaign for this client. |
| 429 Too Many Requests | `rate_limited` | Too many requests this minute. Retry-After says how long is left. |

Full reference: https://docs.tryscouty.com/reference
