# Search Products

Search Products by text.

`GET https://api.drophawk.net/v1/products:search`

q is matched against name, Brand name and model number, tolerating typos, case and punctuation. Results come exact model matches first, then Products that contain q as whole words over ones that only resemble it, then Products with an in-stock price, then, among those that contain q, Products offered by more Retailers, then best text match; no match is an empty list.

To page, send next_page_token back as page_token with the same q; page_size may change between pages. Pages neither overlap nor skip while the catalog is unchanged; a change in stock, price or Listings is a catalog change.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `q` | string | yes | The search text, for example "rtx 4090". Not blank; at most 256 bytes. |
| `page_size` | integer >= 0 | no | Products per page: 20 by default, at most 50 (larger values are served as 50). Negative is an error. |
| `page_token` | string | no | next_page_token from the previous page. Omit for the first page. |
| `client` | string, one of `mcp` (others may appear) | no | Set to "mcp" only by the DropHawk MCP server, to attribute the links it hands out. Leave it unset; any other value is treated as unset. |

## Responses

### 200

One page of matching Products, best match first.

#### 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 |
| --- | --- | --- | --- |
| `products` | array<Product> | yes | Matching Products, best match first. |
| `products[]` | Product | yes | Product is a physical part at manufacturer-SKU level and its prices across Retailers. Only the Retailer offering the BestPrice is named. |
| `products[].model_slug` | string, pattern `^[a-z0-9]+(-[a-z0-9]+)*$` | yes | The Product's stable identifier, derived by DropHawk from its model number, for example "deco-x1500-1-pack". Store and compare it as given; never derive it, since look-alike model numbers can be distinct Products ("U-PoE" and "U-PoE+"). |
| `products[].model_number` | string | yes | The manufacturer's model number, for display. |
| `products[].name` | string | yes | The Product's display name. |
| `products[].brand` | BrandRef | yes | The Product's maker. |
| `products[].brand.slug` | string, pattern `^[a-z0-9]+(-[a-z0-9]+)*$` | yes | Stable URL-safe identifier, for example "asus". |
| `products[].brand.name` | string | yes | The Brand's display name, for example "ASUS". |
| `products[].component_type` | ComponentTypeRef | yes | The Product's ComponentType, which declares the keys in specs. |
| `products[].component_type.slug` | string, pattern `^[a-z0-9]+(-[a-z0-9]+)*$` | yes | Stable URL-safe identifier, for example "gpu". |
| `products[].component_type.name` | string | yes | The ComponentType's display name, for example "Graphics Cards". |
| `products[].specs` | map | yes | Spec values keyed by the ComponentType's spec_schema keys. A missing key means the value is unknown. |
| `products[].specs.{key}` | SpecValue | no | SpecValue is one Spec value. Exactly one value field is set, as the key's SpecField.type declares. |
| `products[].specs.{key}.string_value` | string | no | A text value, for example "RTX 4090". |
| `products[].specs.{key}.number_value` | number | no | A numeric value, for example 24. |
| `products[].specs.{key}.bool_value` | boolean | no | A yes/no value. |
| `products[].specs.{key}.unit` | string | no | The unit, for example "GB". Absent when the Spec has none. |
| `products[].images` | array<ProductImage> | yes | Product images, primary first. Empty when there are none. |
| `products[].images[]` | ProductImage | yes | ProductImage is one image of a Product. |
| `products[].images[].url` | string (uri) | yes | Absolute URL. Its content never changes, so it can be cached indefinitely. |
| `products[].images[].width` | integer >= 1 | yes | Width in pixels. |
| `products[].images[].height` | integer >= 1 | yes | Height in pixels. |
| `products[].images[].alt_text` | string | yes | Alt text for the image. Never empty. |
| `products[].pricing` | ProductPricing | yes | Current and historical prices. |
| `products[].pricing.best_price` | BestPrice | no | The lowest current in-stock price. Absent when withheld. |
| `products[].pricing.best_price.price` | Money | no | The price. |
| `products[].pricing.best_price.price.amount` | string, pattern `^(0\|[1-9][0-9]*)(\.[0-9]+)?$` | no | The amount as a non-negative decimal string with a "." separator and no grouping, for example "1299.00". It usually has as many decimal places as the currency has minor units (2 for AUD, 0 for JPY), but may have fewer, or more when a price was observed more precisely: it is never rounded. Never reject an amount for its decimal places; parse it with a decimal type, not a float. |
| `products[].pricing.best_price.price.currency` | string, pattern `^[A-Z]{3}$` | no | ISO 4217 code, for example "AUD". |
| `products[].pricing.best_price.observed_at` | string (date-time) | no | When the Retailer last confirmed this price. |
| `products[].pricing.best_price.retailer` | RetailerRef | no | The Retailer offering this price as of observed_at. On a tie, the one best_price_url resolved to when this response was produced. The link resolves when followed, so it goes to the current BestPrice, which may since have moved to another Retailer. |
| `products[].pricing.best_price.retailer.slug` | string, pattern `^[a-z0-9]+(-[a-z0-9]+)*$` | no | Stable URL-safe identifier, for example "pccasegear". |
| `products[].pricing.best_price.retailer.name` | string | no | The Retailer's display name, for example "PC Case Gear". |
| `products[].pricing.best_price_withheld_reason` | string, one of `NO_DATA`, `OUT_OF_STOCK`, `MIXED_CURRENCY` (others may appear) | no | Why best_price is absent: OUT_OF_STOCK (priced, but none in stock), NO_DATA (no prices) or MIXED_CURRENCY (in-stock prices span currencies). Treat an unknown reason as no price. |
| `products[].pricing.in_stock_count` | integer >= 0 | yes | Number of Retailers with the Product in stock. |
| `products[].pricing.all_time_low` | DatedPrice | no | The lowest daily low ever recorded, dated to the first day it occurred. Absent when withheld. |
| `products[].pricing.all_time_low.price` | Money | no | The price. |
| `products[].pricing.all_time_low.price.amount` | string, pattern `^(0\|[1-9][0-9]*)(\.[0-9]+)?$` | no | The amount as a non-negative decimal string with a "." separator and no grouping, for example "1299.00". It usually has as many decimal places as the currency has minor units (2 for AUD, 0 for JPY), but may have fewer, or more when a price was observed more precisely: it is never rounded. Never reject an amount for its decimal places; parse it with a decimal type, not a float. |
| `products[].pricing.all_time_low.price.currency` | string, pattern `^[A-Z]{3}$` | no | ISO 4217 code, for example "AUD". |
| `products[].pricing.all_time_low.date` | string (date) | no | The UTC calendar date. |
| `products[].pricing.all_time_low_withheld_reason` | string, one of `NO_DATA`, `MIXED_CURRENCY` (others may appear) | no | Why all_time_low is absent: NO_DATA or MIXED_CURRENCY (the history spans currencies). Treat an unknown reason as no price. |
| `products[].url` | string (uri) | yes | The Product's page on drophawk.net. |
| `products[].best_price_url` | string (uri) | yes | A DropHawk link that sends a buyer to the Retailer with the best price when it is followed, which may differ from pricing.best_price.retailer if the BestPrice has moved since, or to the Product's page when there is none. Use it unmodified. |
| `next_page_token` | string | yes | Token for the next page. Empty on the last page. |

### 400

The request cannot be served as sent. Reason INVALID_IDENTIFIER, INVALID_QUERY, INVALID_PAGE_TOKEN, INVALID_PAGE_SIZE, EMPTY_BATCH, BATCH_TOO_LARGE or INVALID_REQUEST.

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

### 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/products:search?q=rtx%205080'
```
