# List Component Types

List every ComponentType, including those with no Products.

`GET https://api.drophawk.net/v1/component-types`

spec_schema declares every key and value type a Product's specs may hold.

## Responses

### 200

Every ComponentType, ordered by name.

#### Headers

| Header | Type | Description |
| --- | --- | --- |
| `Cache-Control` | string | "public, max-age=300" on a successful GET; "no-store" on every other response. |
| `RateLimit-Limit` | integer | The burst a caller may make back-to-back (30). The sustained rate is 60 requests a minute. |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `component_types` | array<ComponentType> | yes | The ComponentTypes, ordered by name. |
| `component_types[]` | ComponentType | yes | ComponentType is a class of product and the Spec schema its Products follow. |
| `component_types[].slug` | string, pattern `^[a-z0-9]+(-[a-z0-9]+)*$` | yes | Stable URL-safe identifier, for example "gpu". |
| `component_types[].name` | string | yes | The ComponentType's display name, for example "Graphics Cards". |
| `component_types[].product_count` | integer >= 0 | yes | Number of Products of this type in the catalog. |
| `component_types[].spec_schema` | array<SpecField> | yes | The Specs this type's Products may have, in display order. |
| `component_types[].spec_schema[]` | SpecField | yes | SpecField declares one Spec a ComponentType's Products can have. |
| `component_types[].spec_schema[].key` | string | yes | The key in Product.specs, for example "vram". |
| `component_types[].spec_schema[].label` | string | yes | A human-readable name for the Spec, for example "VRAM". |
| `component_types[].spec_schema[].type` | string, one of `string`, `number`, `boolean` (others may appear) | yes | "string", "number" or "boolean", naming the SpecValue field that carries the value. Ignore a Spec whose type you do not recognise; its values are never sent. |
| `component_types[].spec_schema[].unit` | string | no | The unit, for example "GB". Absent when the Spec has none. |

### 429

Reason RATE_LIMITED. Wait Retry-After seconds before retrying.

#### Headers

| Header | Type | Description |
| --- | --- | --- |
| `Retry-After` | integer | Seconds to wait before retrying. |
| `Cache-Control` | string | "public, max-age=300" on a successful GET; "no-store" on every other response. |
| `RateLimit-Limit` | integer | The burst a caller may make back-to-back (30). The sustained rate is 60 requests a minute. |
| `RateLimit-Remaining` | integer | Requests left in the caller's burst. Left off cacheable responses. |
| `RateLimit-Reset` | integer | Seconds until the caller's burst is full again. Left off cacheable responses. |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | integer | yes | The google.rpc.Code of the error, for example 5 (NOT_FOUND) or 8 (RESOURCE_EXHAUSTED). The HTTP status carries the same information. |
| `message` | string | yes | The error code's name, such as "not_found", "resource_exhausted" or "internal". Not for display; branch on the ErrorInfo reason. |
| `details` | array<ErrorInfo or ErrorDetail> | yes | Typed error details, each identified by its "@type". An HTTP/JSON error always includes exactly one ErrorInfo naming why the request failed. Other detail types may be added within v1; skip any whose "@type" you do not recognise. |
| `details[]` | ErrorInfo | yes | Always includes one: ErrorInfo. |
| `details[].@type` | string, always `type.googleapis.com/google.rpc.ErrorInfo` | yes |  |
| `details[].reason` | string, one of `PRODUCT_NOT_FOUND`, `INVALID_IDENTIFIER`, `INVALID_QUERY`, `INVALID_PAGE_TOKEN`, `INVALID_PAGE_SIZE`, `EMPTY_BATCH`, `BATCH_TOO_LARGE`, `INVALID_REQUEST`, `NOT_FOUND`, `METHOD_NOT_ALLOWED`, `REQUEST_TOO_LARGE`, `RATE_LIMITED`, `INTERNAL`, `UNAVAILABLE` (others may appear) | yes | The reason, in UPPER_SNAKE_CASE. Treat an unrecognised reason by its HTTP status. |
| `details[].domain` | string, always `drophawk.net` | yes |  |
| `details[].metadata` | map | no | Context for the reason, as string values. |
| `details[].metadata.{key}` | string | no |  |

### Any other status

Any other error, such as 405, 500 or 503. See ErrorInfo for the reason.

#### Headers

| Header | Type | Description |
| --- | --- | --- |
| `Cache-Control` | string | "public, max-age=300" on a successful GET; "no-store" on every other response. |
| `RateLimit-Limit` | integer | The burst a caller may make back-to-back (30). The sustained rate is 60 requests a minute. |
| `RateLimit-Remaining` | integer | Requests left in the caller's burst. Left off cacheable responses. |
| `RateLimit-Reset` | integer | Seconds until the caller's burst is full again. Left off cacheable responses. |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | integer | yes | The google.rpc.Code of the error, for example 5 (NOT_FOUND) or 8 (RESOURCE_EXHAUSTED). The HTTP status carries the same information. |
| `message` | string | yes | The error code's name, such as "not_found", "resource_exhausted" or "internal". Not for display; branch on the ErrorInfo reason. |
| `details` | array<ErrorInfo or ErrorDetail> | yes | Typed error details, each identified by its "@type". An HTTP/JSON error always includes exactly one ErrorInfo naming why the request failed. Other detail types may be added within v1; skip any whose "@type" you do not recognise. |
| `details[]` | ErrorInfo | yes | Always includes one: ErrorInfo. |
| `details[].@type` | string, always `type.googleapis.com/google.rpc.ErrorInfo` | yes |  |
| `details[].reason` | string, one of `PRODUCT_NOT_FOUND`, `INVALID_IDENTIFIER`, `INVALID_QUERY`, `INVALID_PAGE_TOKEN`, `INVALID_PAGE_SIZE`, `EMPTY_BATCH`, `BATCH_TOO_LARGE`, `INVALID_REQUEST`, `NOT_FOUND`, `METHOD_NOT_ALLOWED`, `REQUEST_TOO_LARGE`, `RATE_LIMITED`, `INTERNAL`, `UNAVAILABLE` (others may appear) | yes | The reason, in UPPER_SNAKE_CASE. Treat an unrecognised reason by its HTTP status. |
| `details[].domain` | string, always `drophawk.net` | yes |  |
| `details[].metadata` | map | no | Context for the reason, as string values. |
| `details[].metadata.{key}` | string | no |  |

## Example

```sh
curl https://api.drophawk.net/v1/component-types
```
