# at.happyproto.fleet.getCapacity

> Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.fleet.getCapacity)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.fleet.getCapacity/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.fleet.getCapacity/examples)

## Definitions

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

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `configured` | `boolean` | No |  |
| `crawl` | `string` | No |  |
| `nsid` | `string` | Yes |  |
| `records` | `integer` | No |  |
| `subscribers` | `integer` | No |  |

### `at.happyproto.fleet.getCapacity`

**Type**: `query`

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

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `from` | `string` (datetime) | No | Start of the range. Defaults to 30 days before `to`. |
| `to` | `string` (datetime) | No | End of the range. Defaults to now. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `collections` | `array` | Yes |  |
| `latest` | `ref` → `#totals` | No |  |
| `tenants` | `array` | Yes |  |
| `trend` | `array` | Yes |  |

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

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

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `apiClients` | `integer` | No |  |
| `collectionCount` | `integer` | No |  |
| `diskBytes` | `integer` | No |  |
| `gaps7d` | `integer` | No | Hours with no usage report in the last 7 days. |
| `id` | `string` | Yes |  |
| `lastHour` | `ref` → `#tenantLastHour` | No |  |
| `plan` | `string` | No |  |
| `recordsVisible` | `integer` | No |  |
| `seats` | `integer` | No |  |
| `slug` | `string` | Yes |  |

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

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cpuUsec` | `integer` | No | CPU time used in the hour, in microseconds. |
| `egressBytes` | `integer` | No |  |
| `hour` | `string` (datetime) | Yes |  |
| `memAvgBytes` | `integer` | No |  |

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

**Type**: `object`

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

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `databaseBytes` | `integer` | No |  |
| `diskCapacityBytes` | `integer` | No |  |
| `diskFreeBytes` | `integer` | No |  |
| `feedBytes` | `integer` | No |  |
| `hour` | `string` (datetime) | Yes |  |
| `overlayBytes` | `integer` | No |  |
| `records` | `integer` | No |  |
| `recordsBytes` | `integer` | No |  |
| `recordsIndexBytes` | `integer` | No |  |

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

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `databaseBytes` | `integer` | No |  |
| `day` | `string` | Yes | UTC date, YYYY-MM-DD. |
| `records` | `integer` | No |  |

## Raw 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
}
```
