# Subscription

Manage your Linked API subscription with the SDK: check status and adjust seats.

Manage your Linked API subscription: check status and adjust seats. See the [Admin overview](/sdks/admin-overview) for initialization.

## Get status

```typescript
try {
  const status = await admin.subscription.getStatus();

  console.log(status.status);            // 'active' | 'trialing' | 'past_due' | 'canceled' | undefined
  console.log(status.eligibleForTrial);  // boolean
  console.log(status.cancelAtPeriodEnd); // boolean
} catch (e) {
  if (e instanceof LinkedApiError) {
    console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
  } else {
    console.error('An unexpected, non-API error occurred:', e);
  }
}
```

```python
from linkedapi import LinkedApiError

try:
    status = admin.subscription.get_status()

    print(status.status)                # 'active' | 'trialing' | 'past_due' | 'canceled' | None
    print(status.eligible_for_trial)    # bool
    print(status.cancel_at_period_end)  # bool
except LinkedApiError as e:
    print(f"Critical Error - Type: {e.type}, Message: {e.message}")
except Exception as error:
    print("An unexpected, non-API error occurred:", error)
```

### Data

- `status` – `active`, `trialing`, `past_due`, `canceled`, or `undefined` if no subscription.
- `eligibleForTrial` – whether a 7-day free trial is available.
- `cancelAtPeriodEnd` – whether the subscription is scheduled to cancel at the end of the current billing period.

## Get seats

```typescript
const { seats } = await admin.subscription.getSeats();

for (const seat of seats) {
  console.log(`${seat.seatType} × ${seat.quantity} (${seat.billingPeriod})`);
}
```

```python
seats = admin.subscription.get_seats().seats

for seat in seats:
    print(f"{seat.seat_type} × {seat.quantity} ({seat.billing_period})")
```

### Data

Array of seat objects:

- `seatType` – `core` or `plus`. The `plus` tier unlocks Sales Navigator actions (`nv.*`).
- `quantity` – number of seats. Each seat allows one connected LinkedIn account.
- `billingPeriod` – `month` or `year`.

## Set seats

New users can start with a 7-day free trial.

```typescript
const result = await admin.subscription.setSeats({
  quantity: 5,
  seatType: 'plus',
  billingPeriod: 'year',
});

if (result.status === 'processing') {
  // No active subscription – redirect user to checkout
  console.log('Complete payment:', result.paymentLink);
} else {
  console.log('Seats updated');
}
```

```python
from linkedapi import SetSeatsParams

result = admin.subscription.set_seats(
    SetSeatsParams(
        quantity=5,
        seat_type="plus",
        billing_period="year",
    )
)

if result.status == "processing":
    # No active subscription – redirect user to checkout
    print("Complete payment:", result.payment_link)
else:
    print("Seats updated")
```

### Params

- `quantity` – number of seats (1–1000).
- `seatType` – `core` or `plus`.
- `billingPeriod` – `month` or `year`.

### Data

- `status` – `complete` (subscription updated) or `processing` (checkout required).
- `paymentLink` – Stripe checkout URL (only when `status` is `processing`).

> **Note:** When reducing seats below the number of connected accounts, excess accounts will be automatically frozen.

## Errors

All subscription methods may throw:

- `linkedApiTokenRequired` – missing token.
- `invalidLinkedApiToken` – invalid or expired token.
- `tooManyRequests` – rate limit exceeded.

For the complete HTTP API reference, see [Admin API: Subscription](/docs/admin-subscription).
