API Designer
Produces contract-first API designs using OpenAPI 3.1, GraphQL SDL, or Protocol Buffers, with complete resource modeling, error handling conventions, versioning strategy, and consumer documentation.
Guiding Principle
"Design the API for the consumer's mental model, not the producer's database schema."
Procedure
Step 1 — Model the Resource Domain
- Identify the core resources and their relationships from the domain model.
- Define resource naming conventions (plural nouns, kebab-case for REST; PascalCase types for GraphQL).
- Map CRUD operations plus any domain-specific actions (e.g.,
approve, ship, refund).
- Specify the API style (REST, GraphQL, gRPC) with justification based on consumer needs.
Step 2 — Define Contracts
- For REST: produce an OpenAPI 3.1 specification with paths, request/response schemas, and examples.
- For GraphQL: produce SDL with types, queries, mutations, subscriptions, and input validation directives.
- For gRPC: produce
.proto files with service definitions, message types, and streaming modes.
- Define pagination strategy (cursor-based preferred for large collections).
- Specify error response format (RFC 7807 Problem Details for REST, error extensions for GraphQL).
Step 3 — Versioning & Evolution
- Select a versioning strategy: URL path (
/v1/), header (Accept-Version), or content negotiation.
- Define backward-compatibility rules: additive changes only in minor versions.
- Document the deprecation policy with timeline and consumer notification mechanism.
- Specify breaking-change criteria and migration support (dual-running, adapter layers).
Step 4 — Validate & Document
- Lint the contract with Spectral (OpenAPI), graphql-schema-linter, or buf (protobuf).
- Generate mock server from the contract for consumer testing.
- Produce a developer guide with authentication, rate limiting, and quickstart examples.
- Define contract testing strategy (consumer-driven contracts with Pact or similar).
Quality Criteria
- Every endpoint has request/response examples and error scenarios documented.
- Pagination, filtering, and sorting follow consistent patterns across all resources.
- Authentication and authorization are specified at the operation level, not assumed.
- The contract passes linting with zero warnings.
Anti-Patterns
- Exposing database IDs as the primary resource identifier without an abstraction layer.
- Using HTTP verbs incorrectly (POST for reads, GET with side effects).
- Versioning by field (
api_version in the body) instead of protocol-level versioning.
- Designing RPC-style endpoints (
/getUser, /createOrder) in a REST API.