name: design-a-search-endpoint
description: Defines a searchable collection with query filters, ordering, and bounded results. Use when the user needs an endpoint that finds resources by user-supplied criteria.
domain: api-design
tags: [search, filtering, query-parameters]
triggers: ["api search endpoint", "design a filtered search api", "specify api search pagination"]
Defines a searchable collection with query filters, ordering, and bounded results
Purpose
Defines a searchable collection with query filters, ordering, and bounded results.
When to use
Use when the user needs an endpoint that finds resources by user-supplied criteria.
When NOT to use
Do not use this for internal function signatures; use software-engineering instead.
Inputs required
- The consumers and what they need
- The resources and the operations involved
- The versioning, auth and rate-limit policy
Procedure
- Define the query grammar, accepted filters, sort fields, and search scope.
- Specify returned fields, result ordering, and a stable pagination contract.
- Set maximum limits for query length, filters, page size, and result depth.
- Define empty, invalid, and partially unavailable search results.
- Document the response fields, error codes, and expected latency characteristics.
Output contract
A documented contract with endpoints, payloads, error shapes and versioning rules.
Validation checklist
Safety notes
Never change an existing response shape without a version bump and a migration note.
Related skills
design-a-bulk-endpoint
design-a-graphql-schema
design-a-rest-resource-model
1---2name: design-a-search-endpoint3description: Defines a searchable collection with query filters, ordering, and bounded results. Use when the user needs an endpoint that finds resources by user-supplied cri4---5---6name: design-a-search-endpoint7description: Defines a searchable collection with query filters, ordering, and bounded results. Use when the user needs an endpoint that finds resources by user-supplied criteria.8domain: api-design9tags: [search, filtering, query-parameters]10triggers: ["api search endpoint", "design a filtered search api", "specify api search pagination"]11---1213# Defines a searchable collection with query filters, ordering, and bounded results1415## Purpose1617Defines a searchable collection with query filters, ordering, and bounded results.1819## When to use2021Use when the user needs an endpoint that finds resources by user-supplied criteria.2223## When NOT to use2425Do not use this for internal function signatures; use software-engineering instead.2627## Inputs required2829- The consumers and what they need30- The resources and the operations involved31- The versioning, auth and rate-limit policy3233## Procedure34351. Define the query grammar, accepted filters, sort fields, and search scope.362. Specify returned fields, result ordering, and a stable pagination contract.373. Set maximum limits for query length, filters, page size, and result depth.384. Define empty, invalid, and partially unavailable search results.395. Document the response fields, error codes, and expected latency characteristics.4041## Output contract4243A documented contract with endpoints, payloads, error shapes and versioning rules.4445## Validation checklist4647- [ ] Every error has a stable machine-readable code48- [ ] Pagination, filtering and idempotency are defined49- [ ] The contract is versioned and backward compatible5051## Safety notes5253Never change an existing response shape without a version bump and a migration note.5455## Related skills5657- `design-a-bulk-endpoint`58- `design-a-graphql-schema`59- `design-a-rest-resource-model`