> ## 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.

# Buckets

> Manage buckets for organizing your API traffic data

## List Buckets

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

Retrieve all buckets associated with 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="Bucket Objects">
    <ResponseField name="sid" type="string">
      Unique bucket identifier
    </ResponseField>

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

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

    <ResponseField name="verifySslCerts" type="boolean">
      Whether SSL certificates should be verified as valid and trusted
    </ResponseField>

    <ResponseField name="appIsConnected" type="boolean">
      Whether the bucket is connected to an application via the SDK
    </ResponseField>

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

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

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

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

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

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

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

<ResponseExample>
  ```json Response theme={null}
  {
    "hasMore": false,
    "records": [
      {
        "sid": "bkt_xyz789uvw012rst345abc",
        "accountSid": "acc_abc123def456ghi789jkl012",
        "name": "Production API",
        "verifySslCerts": true,
        "appIsConnected": true,
        "createdAt": "2023-12-01T10:30:00.000Z"
      }
    ]
  }
  ```
</ResponseExample>

***

## Get Bucket

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

Retrieve details of a specific bucket.

### Path Parameters

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

<ParamField path="bucketSid" type="string" required>
  Bucket identifier
</ParamField>

### Headers

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

### Response

<ResponseField name="sid" type="string">
  Unique bucket identifier
</ResponseField>

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

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

<ResponseField name="verifySslCerts" type="boolean">
  Whether SSL certificates should be verified as valid and trusted
</ResponseField>

<ResponseField name="appIsConnected" type="boolean">
  Whether the bucket is connected to an application via the SDK
</ResponseField>

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

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

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

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

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "bkt_xyz789uvw012rst345abc",
    "accountSid": "acc_abc123def456ghi789jkl012",
    "name": "Production API",
    "verifySslCerts": true,
    "appIsConnected": true,
    "createdAt": "2023-12-01T10:30:00.000Z"
  }
  ```
</ResponseExample>

***

## Create Bucket

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

Create a new bucket for organizing API traffic data.

### 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>
  The name of the bucket
</ParamField>

### Response

Returns the created bucket object with the same structure as the Get Bucket response.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/buckets" \
    -H "Authorization: Bearer your-jwt-token" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Staging API"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/buckets', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your-jwt-token',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Staging API'
    })
  });

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

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

  response = requests.post(
      'https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/buckets',
      headers={
          'Authorization': 'Bearer your-jwt-token',
          'Content-Type': 'application/json'
      },
      json={'name': 'Staging API'}
  )

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

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "bkt_new789uvw012rst345def",
    "accountSid": "acc_abc123def456ghi789jkl012",
    "name": "Staging API",
    "verifySslCerts": true,
    "appIsConnected": false,
    "createdAt": "2023-12-01T15:45:00.000Z"
  }
  ```
</ResponseExample>

***

## Update Bucket

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

Update the details of an existing bucket.

### Path Parameters

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

<ParamField path="bucketSid" type="string" required>
  Bucket identifier
</ParamField>

### Headers

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

### Request Body

<ParamField body="name" type="string" required>
  The name of the bucket
</ParamField>

<ParamField body="verifySslCerts" type="boolean" required>
  Whether SSL certificates should be verified as valid and trusted
</ParamField>

### Response

Returns the updated bucket object.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/buckets/bkt_xyz789uvw012rst345abc" \
    -H "Authorization: Bearer your-jwt-token" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Updated Production API",
      "verifySslCerts": false
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/accounts/acc_abc123def456ghi789jkl012/buckets/bkt_xyz789uvw012rst345abc', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer your-jwt-token',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Updated Production API',
      verifySslCerts: false
    })
  });

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

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "bkt_xyz789uvw012rst345abc",
    "accountSid": "acc_abc123def456ghi789jkl012",
    "name": "Updated Production API",
    "verifySslCerts": false,
    "appIsConnected": true,
    "createdAt": "2023-12-01T10:30:00.000Z"
  }
  ```
</ResponseExample>

***

## Delete Bucket

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

Delete a bucket and all associated requests.

<Warning>
  This action is irreversible. All data associated with the bucket will be permanently deleted.
</Warning>

### Path Parameters

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

<ParamField path="bucketSid" type="string" required>
  Bucket identifier
</ParamField>

### Headers

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

### Response

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

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

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

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

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

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

***

## Get SDK Settings

<api-endpoint method="GET" url="https://api.apitraffic.io/v1/buckets/{bucketSid}/sdk" />

Retrieve SDK settings for a bucket based on the ingestion key.

### Path Parameters

<ParamField path="bucketSid" type="string" required>
  Bucket identifier
</ParamField>

### Query Parameters

<ParamField query="redactAt" type="string" required>
  Where data should be redacted. Must be either `client` or `server`
</ParamField>

<ParamField query="clientId" type="string" required>
  ID of the client attempting to get the SDK settings
</ParamField>

### Headers

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

### Response

Returns SDK configuration settings including redaction rules and exclusion patterns.

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.apitraffic.io/v1/buckets/bkt_xyz789uvw012rst345abc/sdk?redactAt=client&clientId=client_123" \
    -H "Authorization: Bearer your-jwt-token"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/buckets/bkt_xyz789uvw012rst345abc/sdk?redactAt=client&clientId=client_123', {
    headers: {
      'Authorization': 'Bearer your-jwt-token'
    }
  });

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

<ResponseExample>
  ```json Response theme={null}
  {
    "redactionRules": [
      {
        "field": "password",
        "action": "redact"
      }
    ],
    "exclusionRules": [
      {
        "path": "/health",
        "method": "GET"
      }
    ],
    "settings": {
      "interceptOutbound": true,
      "debug": false
    }
  }
  ```
</ResponseExample>
