# Limits

Configure and monitor rate limits for your LinkedIn accounts programmatically: view defaults, get current usage, set custom limits, and reset.

Rate limits control how many actions each LinkedIn account can perform per time period. For general Admin API information, see the [Admin overview](/docs/admin-overview).

## Limit categories

| Category | Description |
|----------|-------------|
| `stPersonProfileViews` | Standard LinkedIn profile views |
| `stCompanyPageViews` | Standard LinkedIn company page views |
| `stConnectionRequests` | Connection requests sent |
| `stMessages` | Messages sent |
| `stSearchQueries` | LinkedIn search queries |
| `stReactions` | Post reactions |
| `stComments` | Post comments |
| `stPosts` | Posts created |
| `nvPersonProfileViews` | Sales Navigator profile views |
| `nvCompanyPageViews` | Sales Navigator company page views |
| `nvMessages` | Sales Navigator messages |

**Periods:** `daily`, `weekly`, `monthly`

## limits.getDefaults

Get the system default limits. These are applied when an account has no custom limits or after resetting to defaults.

```bash
curl -X POST https://api.linkedapi.io/admin/limits.getDefaults \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here"
```

**Response:**

```json
{
  "success": true,
  "result": {
    "limits": [
      {
        "category": "stMessages",
        "period": "daily",
        "maxValue": 50,
        "isEnabled": true
      },
      {
        "category": "stConnectionRequests",
        "period": "daily",
        "maxValue": 10,
        "isEnabled": true
      }
    ]
  }
}
```

## limits.get

Get the current limits for a specific account.

```bash
curl -X POST https://api.linkedapi.io/admin/limits.get \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{"accountId": "f9b4346a-..."}'
```

**Body:**

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `accountId` | `string` | Yes | Account UUID |

**Response:**

```json
{
  "success": true,
  "result": {
    "limits": [
      {
        "category": "stMessages",
        "period": "daily",
        "maxValue": 25,
        "isEnabled": true
      }
    ]
  }
}
```

## limits.getUsage

Get the current usage against limits for a specific account.

```bash
curl -X POST https://api.linkedapi.io/admin/limits.getUsage \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{"accountId": "f9b4346a-..."}'
```

**Body:**

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `accountId` | `string` | Yes | Account UUID |

**Response:**

```json
{
  "success": true,
  "result": {
    "usage": [
      {
        "category": "stMessages",
        "period": "daily",
        "maxValue": 50,
        "currentValue": 12,
        "isEnabled": true
      }
    ]
  }
}
```

| Field | Type | Description |
|-------|------|-------------|
| `maxValue` | `number` | Maximum allowed actions |
| `currentValue` | `number` | Actions performed in the current period |
| `isEnabled` | `boolean` | Whether this limit is enforced |

## limits.set

Set or update limits for an account. Only the specified limits are created or updated; other limits remain unchanged.

```bash
curl -X POST https://api.linkedapi.io/admin/limits.set \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{
    "accountId": "f9b4346a-...",
    "limits": [
      {
        "category": "stMessages",
        "period": "daily",
        "maxValue": 25,
        "isEnabled": true
      },
      {
        "category": "stConnectionRequests",
        "period": "weekly",
        "maxValue": 30
      }
    ]
  }'
```

**Body:**

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `accountId` | `string` | Yes | Account UUID |
| `limits` | `array` | Yes | Array of limit configurations |
| `limits[].category` | `string` | Yes | Limit category (see table above) |
| `limits[].period` | `string` | Yes | `daily`, `weekly`, or `monthly` |
| `limits[].maxValue` | `number` | Yes | Maximum allowed actions (>= 0) |
| `limits[].isEnabled` | `boolean` | No | Whether this limit is enforced (default: `true`) |

**Response:**

```json
{
  "success": true,
  "result": {}
}
```

## limits.delete

Remove specific limits from an account. The account will fall back to default behavior for removed limits.

```bash
curl -X POST https://api.linkedapi.io/admin/limits.delete \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{
    "accountId": "f9b4346a-...",
    "limits": [
      {"category": "stMessages", "period": "daily"},
      {"category": "stConnectionRequests", "period": "weekly"}
    ]
  }'
```

**Body:**

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `accountId` | `string` | Yes | Account UUID |
| `limits` | `array` | Yes | Array of limits to remove |
| `limits[].category` | `string` | Yes | Limit category |
| `limits[].period` | `string` | Yes | Limit period |

**Response:**

```json
{
  "success": true,
  "result": {}
}
```

## limits.resetToDefaults

Reset all limits for an account to the system defaults.

```bash
curl -X POST https://api.linkedapi.io/admin/limits.resetToDefaults \
  -H "Content-Type: application/json" \
  -H "linked-api-token: linked_your_token_here" \
  -d '{"accountId": "f9b4346a-..."}'
```

**Body:**

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `accountId` | `string` | Yes | Account UUID |

**Response:**

```json
{
  "success": true,
  "result": {}
}
```
