> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apitraffic.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Exclusions

> Manage request exclusion rules to filter out unwanted traffic

## List Exclusions

<api-endpoint method="GET" url="https://api.apitraffic.io/v1/accounts/{accountSid}/exclusions" />

Retrieve all exclusion rules configured for an account.

### Path Parameters

<ParamField path="accountSid" type="string" required>
  Account identifier (format: `acc_` followed by 27 alphanumeric characters)
</ParamField>

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

### Response

<ResponseField name="hasMore" type="boolean">
  Indicates if there are more records to paginate through
</ResponseField>

<ResponseField name="records" type="array">
  <Expandable title="Exclusion Objects">
    <ResponseField name="sid" type="string">
      Unique exclusion rule identifier
    </ResponseField>

    <ResponseField name="accountSid" type="string">
      Account identifier this exclusion belongs to
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the exclusion rule
    </ResponseField>

    <ResponseField name="description" type="string">
      Description of what this rule excludes
    </ResponseField>

    <ResponseField name="pathPattern" type="string">
      URL path pattern to match (supports wildcards)
    </ResponseField>

    <ResponseField name="method" type="string">
      HTTP method to match (GET, POST, PUT, DELETE, etc.) or \* for all
    </ResponseField>

    <ResponseField name="statusCode" type="number">
      HTTP status code to match (nullable, null means all status codes)
    </ResponseField>

    <ResponseField name="isActive" type="boolean">
      Whether this exclusion rule is currently active
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of rule creation
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions" \
    -H "Authorization: Bearer your-jwt-token"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions', {
    headers: {
      'Authorization': 'Bearer your-jwt-token'
    }
  });

  const exclusions = await response.json();
  console.log(exclusions);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions',
      headers={'Authorization': 'Bearer your-jwt-token'}
  )

  exclusions = response.json()
  print(exclusions)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "hasMore": false,
    "records": [
      {
        "sid": "exc_abc123def456ghi789jkl012",
        "accountSid": "acc_abc123def456ghi789jkl012",
        "name": "Health Check Exclusion",
        "description": "Excludes health check endpoints from monitoring",
        "pathPattern": "/health*",
        "method": "GET",
        "statusCode": null,
        "isActive": true,
        "createdAt": "2023-12-01T10:30:00.000Z"
      },
      {
        "sid": "exc_xyz789uvw012rst345abc",
        "accountSid": "acc_abc123def456ghi789jkl012",
        "name": "Static Assets",
        "description": "Excludes static asset requests",
        "pathPattern": "/static/*",
        "method": "*",
        "statusCode": null,
        "isActive": true,
        "createdAt": "2023-12-01T11:15:00.000Z"
      }
    ]
  }
  ```
</ResponseExample>

***

## Get Exclusion

<api-endpoint method="GET" url="https://api.apitraffic.io/v1/accounts/{accountSid}/exclusions/{exclusionSid}" />

Retrieve details of a specific exclusion rule.

### Path Parameters

<ParamField path="accountSid" type="string" required>
  Account identifier
</ParamField>

<ParamField path="exclusionSid" type="string" required>
  Exclusion rule identifier
</ParamField>

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

### Response

Returns a single exclusion object with the same structure as described in the List Exclusions response.

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions/exc_abc123def456ghi789jkl012" \
    -H "Authorization: Bearer your-jwt-token"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions/exc_abc123def456ghi789jkl012', {
    headers: {
      'Authorization': 'Bearer your-jwt-token'
    }
  });

  const exclusion = await response.json();
  console.log(exclusion);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "exc_abc123def456ghi789jkl012",
    "accountSid": "acc_abc123def456ghi789jkl012",
    "name": "Health Check Exclusion",
    "description": "Excludes health check endpoints from monitoring",
    "pathPattern": "/health*",
    "method": "GET",
    "statusCode": null,
    "isActive": true,
    "createdAt": "2023-12-01T10:30:00.000Z"
  }
  ```
</ResponseExample>

***

## Create Exclusion

<api-endpoint method="POST" url="https://api.apitraffic.io/v1/accounts/{accountSid}/exclusions" />

Create a new exclusion rule to filter out unwanted requests from monitoring.

### Path Parameters

<ParamField path="accountSid" type="string" required>
  Account identifier
</ParamField>

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

### Request Body

<ParamField body="name" type="string" required>
  Name of the exclusion rule
</ParamField>

<ParamField body="description" type="string">
  Description of what this rule excludes
</ParamField>

<ParamField body="pathPattern" type="string" required>
  URL path pattern to match. Supports wildcards (\*) and exact matches
</ParamField>

<ParamField body="method" type="string" required>
  HTTP method to match (GET, POST, PUT, DELETE, etc.) or \* for all methods
</ParamField>

<ParamField body="statusCode" type="number">
  HTTP status code to match (optional, null means all status codes)
</ParamField>

<ParamField body="isActive" type="boolean">
  Whether this exclusion rule should be active (default: true)
</ParamField>

### Response

Returns the created exclusion object.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions" \
    -H "Authorization: Bearer your-jwt-token" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Metrics Exclusion",
      "description": "Excludes internal metrics endpoints",
      "pathPattern": "/metrics/*",
      "method": "*",
      "isActive": true
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your-jwt-token',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Metrics Exclusion',
      description: 'Excludes internal metrics endpoints',
      pathPattern: '/metrics/*',
      method: '*',
      isActive: true
    })
  });

  const exclusion = await response.json();
  console.log(exclusion);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions',
      headers={
          'Authorization': 'Bearer your-jwt-token',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'Metrics Exclusion',
          'description': 'Excludes internal metrics endpoints',
          'pathPattern': '/metrics/*',
          'method': '*',
          'isActive': True
      }
  )

  exclusion = response.json()
  print(exclusion)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "exc_new789uvw012rst345def",
    "accountSid": "acc_abc123def456ghi789jkl012",
    "name": "Metrics Exclusion",
    "description": "Excludes internal metrics endpoints",
    "pathPattern": "/metrics/*",
    "method": "*",
    "statusCode": null,
    "isActive": true,
    "createdAt": "2023-12-01T15:45:00.000Z"
  }
  ```
</ResponseExample>

***

## Update Exclusion

<api-endpoint method="PUT" url="https://api.apitraffic.io/v1/accounts/{accountSid}/exclusions/{exclusionSid}" />

Update an existing exclusion rule.

### Path Parameters

<ParamField path="accountSid" type="string" required>
  Account identifier
</ParamField>

<ParamField path="exclusionSid" type="string" required>
  Exclusion rule identifier
</ParamField>

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

### Request Body

<ParamField body="name" type="string" required>
  Name of the exclusion rule
</ParamField>

<ParamField body="description" type="string">
  Description of what this rule excludes
</ParamField>

<ParamField body="pathPattern" type="string" required>
  URL path pattern to match
</ParamField>

<ParamField body="method" type="string" required>
  HTTP method to match or \* for all methods
</ParamField>

<ParamField body="statusCode" type="number">
  HTTP status code to match (optional)
</ParamField>

<ParamField body="isActive" type="boolean" required>
  Whether this exclusion rule should be active
</ParamField>

### Response

Returns the updated exclusion object.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions/exc_abc123def456ghi789jkl012" \
    -H "Authorization: Bearer your-jwt-token" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Updated Health Check Exclusion",
      "description": "Excludes all health check and status endpoints",
      "pathPattern": "/health*",
      "method": "*",
      "statusCode": 200,
      "isActive": true
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions/exc_abc123def456ghi789jkl012', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer your-jwt-token',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Updated Health Check Exclusion',
      description: 'Excludes all health check and status endpoints',
      pathPattern: '/health*',
      method: '*',
      statusCode: 200,
      isActive: true
    })
  });

  const exclusion = await response.json();
  console.log(exclusion);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "exc_abc123def456ghi789jkl012",
    "accountSid": "acc_abc123def456ghi789jkl012",
    "name": "Updated Health Check Exclusion",
    "description": "Excludes all health check and status endpoints",
    "pathPattern": "/health*",
    "method": "*",
    "statusCode": 200,
    "isActive": true,
    "createdAt": "2023-12-01T10:30:00.000Z"
  }
  ```
</ResponseExample>

***

## Delete Exclusion

<api-endpoint method="DELETE" url="https://api.apitraffic.io/v1/accounts/{accountSid}/exclusions/{exclusionSid}" />

Delete an exclusion rule.

<Warning>
  Deleting an exclusion rule will cause previously excluded requests to be monitored again if they match other patterns.
</Warning>

### Path Parameters

<ParamField path="accountSid" type="string" required>
  Account identifier
</ParamField>

<ParamField path="exclusionSid" type="string" required>
  Exclusion rule identifier
</ParamField>

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

### Response

<ResponseField name="sid" type="string">
  ID of the deleted exclusion rule
</ResponseField>

<ResponseField name="deleted" type="boolean">
  Flag indicating the exclusion rule was successfully deleted
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions/exc_abc123def456ghi789jkl012" \
    -H "Authorization: Bearer your-jwt-token"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/exclusions/exc_abc123def456ghi789jkl012', {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer your-jwt-token'
    }
  });

  const result = await response.json();
  console.log(result);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "exc_abc123def456ghi789jkl012",
    "deleted": true
  }
  ```
</ResponseExample>

***

## Path Pattern Examples

Exclusion rules support flexible path matching patterns:

<CodeGroup>
  ```text Exact Match theme={null}
  /health
  // Matches only: /health
  ```

  ```text Wildcard Suffix theme={null}
  /health*
  // Matches: /health, /health-check, /healthz
  ```

  ```text Wildcard Prefix theme={null}
  */admin
  // Matches: /api/admin, /v1/admin, /internal/admin
  ```

  ```text Wildcard Middle theme={null}
  /api/*/status
  // Matches: /api/users/status, /api/orders/status
  ```

  ```text Multiple Wildcards theme={null}
  /api/*/v*/health*
  // Matches: /api/users/v1/health, /api/orders/v2/healthcheck
  ```
</CodeGroup>

## Common Exclusion Patterns

### Health Checks

```json theme={null}
{
  "name": "Health Checks",
  "pathPattern": "/health*",
  "method": "GET"
}
```

### Static Assets

```json theme={null}
{
  "name": "Static Assets", 
  "pathPattern": "/static/*",
  "method": "*"
}
```

### Internal APIs

```json theme={null}
{
  "name": "Internal APIs",
  "pathPattern": "/internal/*",
  "method": "*"
}
```

### Successful Options Requests

```json theme={null}
{
  "name": "CORS Preflight",
  "pathPattern": "*",
  "method": "OPTIONS",
  "statusCode": 200
}
```

### Admin Endpoints

```json theme={null}
{
  "name": "Admin Panel",
  "pathPattern": "/admin/*",
  "method": "*"
}
```
