# link.jetbridge.getTraffic

> Get the traffic a Provider carried, in buckets of time, for every Client or one.

- Kind: query
- Authority: jetbridge.link
- Lexicon: 1
- Published by [jetbridge.link](https://lexicon.garden/identity/did:web:jetbridge.link), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:web:jetbridge.link/link.jetbridge.getTraffic)
- [Schema JSON](https://lexicon.garden/lexicon/did:web:jetbridge.link/link.jetbridge.getTraffic/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:web:jetbridge.link/link.jetbridge.getTraffic/analytics)

## Query (`link.jetbridge.getTraffic`)

Type: query · GET

### Parameters (query string)

- `client` (string · did): Only this Client's traffic.
- `window` (string, required): How far back to look.
  - Constraints: maxLength: 16, knownValues: 1h | 6h | 1d | 7d | 30d | 365d

### Output (application/json)

- `bucketSeconds` (integer, required): The length of each bucket.
  - Constraints: minimum: 1
- `buckets` (array, required): One per Client and hostname with traffic in that bucket.
  - `items` (ref)
    - Reference: `#bucket`
- `from` (string · datetime, required)
- `to` (string · datetime, required)

### Errors

- `OperatorNotSet`: The Provider has no operator.
- `NotOperator`: The caller is not the Provider's operator.

## #bucket (`link.jetbridge.getTraffic#bucket`)

Type: object

### Properties

- `client` (string · did, required)
- `connections` (integer, required): Visitor connections that reached the Client.
  - Constraints: minimum: 0
- `egress` (integer, required): Bytes from the Client to visitors.
  - Constraints: minimum: 0
- `hostname` (string, required)
  - Constraints: maxLength: 253
- `ingress` (integer, required): Bytes from visitors to the Client.
  - Constraints: minimum: 0
- `start` (string · datetime, required)

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "bucket": {
      "properties": {
        "client": {
          "format": "did",
          "type": "string"
        },
        "connections": {
          "description": "Visitor connections that reached the Client.",
          "minimum": 0,
          "type": "integer"
        },
        "egress": {
          "description": "Bytes from the Client to visitors.",
          "minimum": 0,
          "type": "integer"
        },
        "hostname": {
          "maxLength": 253,
          "type": "string"
        },
        "ingress": {
          "description": "Bytes from visitors to the Client.",
          "minimum": 0,
          "type": "integer"
        },
        "start": {
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "start",
        "client",
        "hostname",
        "ingress",
        "egress",
        "connections"
      ],
      "type": "object"
    },
    "main": {
      "description": "Get the traffic a Provider carried, in buckets of time, for every Client or one.",
      "errors": [
        {
          "description": "The Provider has no operator.",
          "name": "OperatorNotSet"
        },
        {
          "description": "The caller is not the Provider's operator.",
          "name": "NotOperator"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "bucketSeconds": {
              "description": "The length of each bucket.",
              "minimum": 1,
              "type": "integer"
            },
            "buckets": {
              "description": "One per Client and hostname with traffic in that bucket.",
              "items": {
                "ref": "#bucket",
                "type": "ref"
              },
              "type": "array"
            },
            "from": {
              "format": "datetime",
              "type": "string"
            },
            "to": {
              "format": "datetime",
              "type": "string"
            }
          },
          "required": [
            "bucketSeconds",
            "from",
            "to",
            "buckets"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "client": {
            "description": "Only this Client's traffic.",
            "format": "did",
            "type": "string"
          },
          "window": {
            "description": "How far back to look.",
            "knownValues": [
              "1h",
              "6h",
              "1d",
              "7d",
              "30d",
              "365d"
            ],
            "maxLength": 16,
            "type": "string"
          }
        },
        "required": [
          "window"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "id": "link.jetbridge.getTraffic",
  "lexicon": 1
}
```
