# at.happyproto.fleet.getCapacity

> Store capacity: the latest totals, a daily trend, per-collection counts and what each tenant holds. Proxied from the provisioner. Admin only.

- Kind: query
- Authority: fleet.happyproto.at
- Lexicon: 1
- Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.fleet.getCapacity)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.fleet.getCapacity/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.fleet.getCapacity/analytics)

## Query (`at.happyproto.fleet.getCapacity`)

Type: query · GET

### Parameters (query string)

- `from` (string · datetime): Start of the range. Defaults to 30 days before `to`.
- `to` (string · datetime): End of the range. Defaults to now.

### Output (application/json)

- `collections` (array, required)
  - `items` (ref)
    - Reference: `#collection`
- `latest` (ref)
  - Reference: `#totals`
- `tenants` (array, required)
  - `items` (ref)
    - Reference: `#tenant`
- `trend` (array, required)
  - `items` (ref)
    - Reference: `#trendPoint`

### Errors

- `AuthRequired`: This endpoint requires an authenticated caller.
- `Forbidden`: The caller is not HappyProto staff, or the provisioner does not treat them as staff.
- `InvalidRequest`: The provisioner refused the range or grain, for example a range that runs backwards or is too long.
- `NotFound`: Passed through from the provisioner.
- `InvalidSlug`: Passed through from the provisioner.
- `SlugTaken`: Passed through from the provisioner.
- `NotEntitled`: Passed through from the provisioner.
- `InstanceLimit`: Passed through from the provisioner.
- `NoCapacity`: Passed through from the provisioner.
- `OperationInProgress`: Passed through from the provisioner.
- `Upstream`: The provisioner could not complete the request.

## #collection (`at.happyproto.fleet.getCapacity#collection`)

Type: object

### Properties

- `configured` (boolean)
- `crawl` (string)
- `nsid` (string, required)
- `records` (integer)
- `subscribers` (integer)

## #tenant (`at.happyproto.fleet.getCapacity#tenant`)

Type: object

### Properties

- `apiClients` (integer)
- `collectionCount` (integer)
- `diskBytes` (integer)
- `gaps7d` (integer): Hours with no usage report in the last 7 days.
- `id` (string, required)
- `lastHour` (ref)
  - Reference: `#tenantLastHour`
- `plan` (string)
- `recordsVisible` (integer)
- `seats` (integer)
- `slug` (string, required)

## #tenantLastHour (`at.happyproto.fleet.getCapacity#tenantLastHour`)

Type: object

### Properties

- `cpuUsec` (integer): CPU time used in the hour, in microseconds.
- `egressBytes` (integer)
- `hour` (string · datetime, required)
- `memAvgBytes` (integer)

## #totals (`at.happyproto.fleet.getCapacity#totals`)

Type: object

The newest hourly snapshot of the shared store. Absent before the first one.

### Properties

- `databaseBytes` (integer)
- `diskCapacityBytes` (integer)
- `diskFreeBytes` (integer)
- `feedBytes` (integer)
- `hour` (string · datetime, required)
- `overlayBytes` (integer)
- `records` (integer)
- `recordsBytes` (integer)
- `recordsIndexBytes` (integer)

## #trendPoint (`at.happyproto.fleet.getCapacity#trendPoint`)

Type: object

### Properties

- `databaseBytes` (integer)
- `day` (string, required): UTC date, YYYY-MM-DD.
- `records` (integer)

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "collection": {
      "properties": {
        "configured": {
          "type": "boolean"
        },
        "crawl": {
          "type": "string"
        },
        "nsid": {
          "type": "string"
        },
        "records": {
          "type": "integer"
        },
        "subscribers": {
          "type": "integer"
        }
      },
      "required": [
        "nsid"
      ],
      "type": "object"
    },
    "main": {
      "description": "Store capacity: the latest totals, a daily trend, per-collection counts and what each tenant holds. Proxied from the provisioner. Admin only.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is not HappyProto staff, or the provisioner does not treat them as staff.",
          "name": "Forbidden"
        },
        {
          "description": "The provisioner refused the range or grain, for example a range that runs backwards or is too long.",
          "name": "InvalidRequest"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotFound"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InvalidSlug"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "SlugTaken"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotEntitled"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InstanceLimit"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NoCapacity"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "OperationInProgress"
        },
        {
          "description": "The provisioner could not complete the request.",
          "name": "Upstream"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "collections": {
              "items": {
                "ref": "#collection",
                "type": "ref"
              },
              "type": "array"
            },
            "latest": {
              "ref": "#totals",
              "type": "ref"
            },
            "tenants": {
              "items": {
                "ref": "#tenant",
                "type": "ref"
              },
              "type": "array"
            },
            "trend": {
              "items": {
                "ref": "#trendPoint",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "trend",
            "collections",
            "tenants"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "from": {
            "description": "Start of the range. Defaults to 30 days before `to`.",
            "format": "datetime",
            "type": "string"
          },
          "to": {
            "description": "End of the range. Defaults to now.",
            "format": "datetime",
            "type": "string"
          }
        },
        "type": "params"
      },
      "type": "query"
    },
    "tenant": {
      "properties": {
        "apiClients": {
          "type": "integer"
        },
        "collectionCount": {
          "type": "integer"
        },
        "diskBytes": {
          "type": "integer"
        },
        "gaps7d": {
          "description": "Hours with no usage report in the last 7 days.",
          "type": "integer"
        },
        "id": {
          "type": "string"
        },
        "lastHour": {
          "ref": "#tenantLastHour",
          "type": "ref"
        },
        "plan": {
          "type": "string"
        },
        "recordsVisible": {
          "type": "integer"
        },
        "seats": {
          "type": "integer"
        },
        "slug": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "slug"
      ],
      "type": "object"
    },
    "tenantLastHour": {
      "properties": {
        "cpuUsec": {
          "description": "CPU time used in the hour, in microseconds.",
          "type": "integer"
        },
        "egressBytes": {
          "type": "integer"
        },
        "hour": {
          "format": "datetime",
          "type": "string"
        },
        "memAvgBytes": {
          "type": "integer"
        }
      },
      "required": [
        "hour"
      ],
      "type": "object"
    },
    "totals": {
      "description": "The newest hourly snapshot of the shared store. Absent before the first one.",
      "properties": {
        "databaseBytes": {
          "type": "integer"
        },
        "diskCapacityBytes": {
          "type": "integer"
        },
        "diskFreeBytes": {
          "type": "integer"
        },
        "feedBytes": {
          "type": "integer"
        },
        "hour": {
          "format": "datetime",
          "type": "string"
        },
        "overlayBytes": {
          "type": "integer"
        },
        "records": {
          "type": "integer"
        },
        "recordsBytes": {
          "type": "integer"
        },
        "recordsIndexBytes": {
          "type": "integer"
        }
      },
      "required": [
        "hour"
      ],
      "type": "object"
    },
    "trendPoint": {
      "properties": {
        "databaseBytes": {
          "type": "integer"
        },
        "day": {
          "description": "UTC date, YYYY-MM-DD.",
          "type": "string"
        },
        "records": {
          "type": "integer"
        }
      },
      "required": [
        "day"
      ],
      "type": "object"
    }
  },
  "id": "at.happyproto.fleet.getCapacity",
  "lexicon": 1
}
```
