# Activate Subscription Bot Access Tokens

> Activate 1–100 Telegram or Discord subscription bot access codes in one request using the batch activation ticket returned by preparation.

Source: https://docs.botsubscription.com/api/access-tokens/activate/

Activate every access code in a prepared batch for your <strong>Telegram subscription bot</strong> or <strong>Discord subscription bot</strong>. **One request activates the entire batch**, whether it contains 1 code or 100.

<ApiEndpoint method="POST" endpoint="/v2/projects/{project_id}/access-tokens/activate" />

<ApiAuthorization type="Bearer API Key" />

**API key scope:** `access-tokens:create` (required for restricted keys).

<ApiSection title="Path Parameters">
  <ApiParameter name="project_id" type="string" required description="The UUID of the project." />
</ApiSection>

<ApiSection title="Request Body">
  <ApiParameter name="activation_token" type="string" required description="The batch activation ticket from data.activation_token in the preparation response. This one string activates all codes in that batch; it is not an individual access code." />
</ApiSection>

## How batch activation works

The `activation_token` is **one ticket for the whole batch**. For example, preparing with `count: 100` returns 100 access codes and one `activation_token`. Submit that ticket once to activate all 100 codes together.

1. [Prepare the codes](https://docs.botsubscription.com/api/access-tokens/prepare/) and save each `code` and `access_token_id`, plus the batch's `activation_token`.
2. Send the saved `activation_token` to this endpoint using the **same project and API key**, within 30 minutes of preparation.
3. [Redeem each activated code](https://docs.botsubscription.com/api/access-tokens/redeem/) separately for its intended member, or distribute the codes privately.

Activation makes the codes redeemable. It does not grant membership or start the membership duration; that happens when a code is redeemed.

Preparation and activation are separate REST requests so you can save the secret codes before making them usable. Preparation has no immediate-activation option.

## Retries and recovery

Activation rechecks the key's access, plan availability, and issuance policy. It returns metadata only, so keep the codes saved from preparation.

Retry a lost activation response with the **same ticket** before it expires. This does not create another batch or reactivate revoked or redeemed codes. After expiry, list tokens and match the saved IDs to determine whether activation committed. Discard an unactivated draft to cancel it; its IDs cannot be revoked before activation.

Use [List Tokens](https://docs.botsubscription.com/api/access-tokens/list/) to inspect activated IDs after an uncertain result.

<Note>
Response examples use the [UTC ISO date format](https://docs.botsubscription.com/api/overview/#utc-iso-response-dates).
</Note>

<ApiSamplePane>

<ApiRequestSample title="Request">

```bash
curl -X POST "https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/access-tokens/activate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "activation_token": "YOUR_SAVED_ACTIVATION_TICKET"
}'
```

```javascript
const response = await fetch("https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/access-tokens/activate", {
  method: 'POST',
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "activation_token": "YOUR_SAVED_ACTIVATION_TICKET"
  })
});
const result = await response.json();
```

```python
import requests

response = requests.post(
    "https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/access-tokens/activate",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={
        "activation_token": "YOUR_SAVED_ACTIVATION_TICKET"
    }
)
result = response.json()
```

```php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/access-tokens/activate');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'activation_token' => 'YOUR_SAVED_ACTIVATION_TICKET'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
```

</ApiRequestSample>

<ApiResponseTabs>
  <ApiResponse status={201} description="Batch activated">

```json
{
  "ok": true,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/access-tokens/activate",
  "code": 201,
  "data": [
    {
      "access_token_id": "11111111-1111-4111-8111-111111111111",
      "plan_id": "22222222-2222-4222-8222-222222222222",
      "duration_seconds": null,
      "duration_months": 1,
      "created_at": "2026-10-19T17:20:00.000Z",
      "revoked_at": null,
      "claimed_at": null,
      "claimed_by": null,
      "claimed_membership_id": null,
      "grant_end_date": null,
      "billing_pending": false,
      "billing_amount": null,
      "billing_currency": null
    }
  ]
}
```

  </ApiResponse>
  <ApiResponse status={200} description="Batch already activated">

```json
{
  "ok": true,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/access-tokens/activate",
  "code": 200,
  "data": [
    {
      "access_token_id": "11111111-1111-4111-8111-111111111111",
      "plan_id": "22222222-2222-4222-8222-222222222222",
      "duration_seconds": null,
      "duration_months": 1,
      "created_at": "2026-10-19T17:20:00.000Z",
      "revoked_at": null,
      "claimed_at": null,
      "claimed_by": null,
      "claimed_membership_id": null,
      "grant_end_date": null,
      "billing_pending": false,
      "billing_amount": null,
      "billing_currency": null
    }
  ]
}
```

  </ApiResponse>
  <ApiResponse status={422} description="Invalid activation ticket">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/access-tokens/activate",
  "code": 422,
  "error": {
    "message": "Invalid activation ticket",
    "error_code": "VALIDATION_ERROR"
  }
}
```

  </ApiResponse>
  <ApiResponse status={409} description="Activation ticket expired">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/access-tokens/activate",
  "code": 409,
  "error": {
    "error_code": "CONFLICT",
    "message": "Activation ticket expired"
  }
}
```

  </ApiResponse>
  <ApiResponse status={401} description="Invalid or expired API key">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/access-tokens/activate",
  "code": 401,
  "error": {
    "message": "Invalid or expired authentication token.",
    "error_code": "UNAUTHORIZED"
  }
}
```

  </ApiResponse>
  <ApiResponse status={422} description="Malformed activation ticket">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/access-tokens/activate",
  "code": 422,
  "errors": [
    {
      "message": "body.activation_token: Invalid activation ticket format",
      "error_code": "VALIDATION_ERROR"
    }
  ]
}
```

  </ApiResponse>
</ApiResponseTabs>

</ApiSamplePane>
