# Guides

> Long-form guides to API design, including agents, webhooks and errors.

Source: https://apiguide.dev/guides
Full text: https://apiguide.dev/llms/guides.txt

- [Making API Documentation Readable by Agents](https://apiguide.dev/guides/agent-readable-documentation.md): Getting a reference site read correctly by agents: an entry point that fits in one fetch, summaries that separate similar pages, Markdown siblings, Accept negotiation that leaves browsers alone, problem responses for misses, and what to test on the real platform.
- [Agent-Ready API Checklist](https://apiguide.dev/guides/agent-ready-checklist.md): A review checklist for an existing API and its webhooks, covering the contract, errors, idempotency, deprecation, delivery and enforcement. Written for consumers that cannot ask you a question.
- [API Security Best Practices](https://apiguide.dev/guides/api-security.md): A practical checklist for securing HTTP APIs: TLS, authentication versus authorization, the OWASP API Security Top 10, input validation, rate limiting, and least privilege.
- [Testing APIs](https://apiguide.dev/guides/api-testing.md): Where each kind of API test earns its place: consumer-driven and schema-based contract testing, generating inputs from OpenAPI, mocks that do not drift, and testing the error, retry and concurrency behavior that clients depend on.
- [Asynchronous & Long-Running Operations](https://apiguide.dev/guides/async-operations.md): Handle long-running work in HTTP APIs with 202 Accepted, status polling endpoints, job resources, Retry-After, and the trade-off between polling and webhooks.
- [API Authentication Schemes](https://apiguide.dev/guides/authentication.md): A guide to HTTP-level authentication standards including Basic Auth, Bearer Tokens, and Message Signatures.
- [Authorization Models: RBAC & ABAC](https://apiguide.dev/guides/authorization-models.md): How to choose and combine RBAC, ABAC, and ReBAC, apply least privilege, and prevent object-level authorization failures like BOLA.
- [What Counts as a Breaking Change](https://apiguide.dev/guides/breaking-changes.md): Why the contract is what consumers observe rather than what you documented, which additive changes still break clients, and why fixing a bug can be a breaking change.
- [Bulk & Batch Operations](https://apiguide.dev/guides/bulk-operations.md): How to design batch endpoints, handle partial success, and process bulk writes idempotently and asynchronously.
- [Cache Invalidation Strategies](https://apiguide.dev/guides/cache-invalidation.md): A practical comparison of TTL, event-based, tag-based, and versioned invalidation, plus stale-while-revalidate and stale-if-error.
- [HTTP Caching & Conditional Requests](https://apiguide.dev/guides/caching.md): A developer guide on HTTP caching headers (Cache-Control, ETag) and conditional requests (If-Match, If-None-Match).
- [CDN & Edge Caching for APIs](https://apiguide.dev/guides/cdn-edge-caching.md): How to control shared caches with s-maxage, Vary, surrogate keys, and stale-while-revalidate to serve API responses from the edge.
- [Choosing an API Style: REST, GraphQL, gRPC, Events, JSON-RPC](https://apiguide.dev/guides/choosing-api-style.md): When resource-oriented HTTP, GraphQL, gRPC, event-driven delivery or JSON-RPC is the right call, what each one costs you, and why most real systems use more than one.
- [HTTP Compression](https://apiguide.dev/guides/compression.md): How APIs negotiate and apply gzip, Brotli, and Zstandard compression, and the caching and security considerations involved.
- [Conditional Requests & Validation](https://apiguide.dev/guides/conditional-requests.md): How to use ETag, Last-Modified, and precondition headers to enable 304 responses and prevent lost updates in HTTP APIs.
- [Content Negotiation & Media Types](https://apiguide.dev/guides/content-negotiation.md): Learn how content negotiation works in REST APIs, media types, and standard vendor extensions.
- [Cross-Origin Resource Sharing (CORS)](https://apiguide.dev/guides/cors.md): Understand CORS, preflight OPTIONS requests, and access control headers in web APIs.
- [API Deprecation & Sunsetting](https://apiguide.dev/guides/deprecation-sunsetting.md): Signaling API retirement with the Deprecation (RFC 9745) and Sunset (RFC 8594) headers, Link relations, and migration timelines.
- [Design-First Development and API Governance](https://apiguide.dev/guides/design-first-governance.md): Treating the OpenAPI document as the source of truth: design-first against code-first, overlays instead of forks, a style guide enforced by a linter, breaking-change detection in CI, and a review process that looks at the contract rather than the code.
- [Standardized Error Handling](https://apiguide.dev/guides/error-handling.md): Designing centralized error dictionaries, parsing field-level validation errors, and structure guidelines.
- [File Uploads & Downloads](https://apiguide.dev/guides/file-uploads-downloads.md): Multipart uploads, presigned and resumable uploads, Range requests, Content-Disposition, and streaming.
- [Filtering, Sorting & Searching](https://apiguide.dev/guides/filtering-sorting-searching.md): Query parameter conventions for filtering, sorting, and full-text search, including operators, pagination interplay, and when to move complex queries to a request body.
- [Forward-Compatible Enums](https://apiguide.dev/guides/forward-compatible-enums.md): How to add enum values without breaking clients: open versus closed enums, the tolerant reader, documented unknown handling, OpenAPI and JSON Schema patterns, protobuf's UNSPECIFIED zero value and GraphQL's enum caveats.
- [HATEOAS & Hypermedia APIs](https://apiguide.dev/guides/hateoas.md): How hypermedia controls make REST APIs self-describing through links in responses, the HAL and JSON:API formats, and an honest look at why adoption is limited.
- [Health Checks & Status Endpoints](https://apiguide.dev/guides/health-checks.md): Design liveness, readiness, and startup checks with the health+json format, dependency probes, and status pages.
- [Idempotency & Request Retries](https://apiguide.dev/guides/idempotency.md): How to implement idempotency keys, Redis-based locking, and safe client retry logic.
- [Resource Identifiers: Integers, UUIDs, ULIDs and Prefixed IDs](https://apiguide.dev/guides/identifiers.md): Choosing public identifiers for an API: sequential integers versus UUIDv4, UUIDv7, ULID and prefixed opaque IDs, enumeration risk, why IDs are strings in JSON, case sensitivity, and why clients must never parse them.
- [Input Validation & Injection Prevention](https://apiguide.dev/guides/input-validation.md): Server-side schema validation, allowlisting, and canonicalization, plus defenses against SQL/NoSQL/command injection and mass assignment.
- [Internationalization & Localization](https://apiguide.dev/guides/internationalization.md): How REST APIs negotiate language, separate message localization from data formatting, and standardize timestamps for a global audience.
- [Logging Without Leaking: Secrets and Personal Data](https://apiguide.dev/guides/logging-pii.md): What an API must never write to its logs, why redaction belongs at the source, how to correlate requests without identifying people, and how retention and erasure apply to log data.
- [Exposing an HTTP API as an MCP Server](https://apiguide.dev/guides/mcp-servers.md): Building a Model Context Protocol server in front of an existing API: curating tools rather than mirroring endpoints, choosing a transport, OAuth without token passthrough, returning errors the model can act on, paginating for a context window, and marking destructive operations.
- [Media Types & Vendor Content Types](https://apiguide.dev/guides/media-types.md): How media types structure content, how the vendor tree and +json suffix work, and how to version APIs through the Accept header.
- [Money, Decimals and Nulls in JSON](https://apiguide.dev/guides/money-decimals-nulls.md): Representing money as integer minor units or decimal strings, ISO 4217 currency codes and exponents, why floats and large JSON numbers lose data, and the difference between null, absent and empty, including under JSON Merge Patch.
- [Multi-Tenancy Patterns](https://apiguide.dev/guides/multi-tenancy.md): Design multi-tenant APIs with silo, pool, and bridge isolation, tenant routing, noisy-neighbor mitigation, and verified tenant claims.
- [mTLS & Client Certificates](https://apiguide.dev/guides/mutual-tls.md): How mutual TLS authenticates both sides of an API connection, when to use it over bearer tokens, and how to manage certificate rotation and validation.
- [OAuth 2.0 & API Keys](https://apiguide.dev/guides/oauth-api-keys.md): How API key authentication compares to OAuth 2.0, and when to use client credentials versus authorization code with PKCE.
- [Observability & Distributed Tracing](https://apiguide.dev/guides/observability-tracing.md): Make your API debuggable in production with structured logging, RED and USE metrics, W3C Trace Context, correlation IDs, and OpenTelemetry.
- [Outbound Request Safety and SSRF](https://apiguide.dev/guides/outbound-request-safety.md): How to fetch user-supplied URLs (webhooks, image imports, link previews, OAuth discovery) without letting a caller reach your internal network or cloud metadata service.
- [Pagination Patterns (Offset vs. Cursor)](https://apiguide.dev/guides/pagination.md): Detailed guide comparing offset and cursor pagination, detailing how to implement cursors and hypermedia headers.
- [PATCH Strategies: JSON Patch vs Merge Patch](https://apiguide.dev/guides/patch-strategies.md): Comparing JSON Patch and JSON Merge Patch for partial resource updates, including null semantics and media types.
- [Quotas & Usage Metering](https://apiguide.dev/guides/quotas-metering.md): How a quota differs from a rate limit, how to meter usage without double-counting retries, how to tell clients where they stand, and what to return when the allowance runs out.
- [API Rate Limiting](https://apiguide.dev/guides/rate-limiting.md): How token bucket, sliding window, and fixed window algorithms work, and how to communicate limits with headers.
- [Request Signing](https://apiguide.dev/guides/request-signing.md): Signing outbound API requests with HMAC, AWS SigV4-style canonical requests, signed headers, body digests, and clock-skew handling.
- [Resource Naming & URI Design](https://apiguide.dev/guides/resource-naming.md): Conventions for naming resources and designing clean URIs: nouns over verbs, plural collections, sensible nesting, kebab-case, and path versus query parameters.
- [Response Envelope Design](https://apiguide.dev/guides/response-envelopes.md): Weigh wrapping responses in data/meta/errors envelopes against bare bodies, and place pagination and error metadata consistently.
- [REST API Design Principles](https://apiguide.dev/guides/rest-principles.md): The core constraints of REST: resources, statelessness, the uniform interface, correct verbs and status codes, and the Richardson Maturity Model.
- [Retries, Backoff & Resilience](https://apiguide.dev/guides/retries-backoff.md): Idempotent retries, exponential backoff with jitter, honoring Retry-After, circuit breakers, and timeouts.
- [Generating SDKs from OpenAPI](https://apiguide.dev/guides/sdk-generation.md): Generated against handwritten client libraries, what an OpenAPI document needs before a generator can produce a good SDK, versioning the SDK separately from the API, and the retry, idempotency, pagination and User-Agent behavior an SDK should own.
- [Sparse Fieldsets & Partial Responses](https://apiguide.dev/guides/sparse-fieldsets.md): Let clients request only the fields they need with sparse fieldsets, and expand related resources on demand to reduce payload size and round trips.
- [Streaming APIs: SSE, WebSocket & Long-Polling](https://apiguide.dev/guides/streaming-apis.md): Compare Server-Sent Events, WebSocket, and long-polling, with guidance on reconnection, scaling, and when to use each.
- [Timestamps & Data Formats](https://apiguide.dev/guides/timestamps-and-formats.md): Conventions for representing time, money, enums, and nullability in JSON APIs: RFC 3339, always UTC, integer money, and consistent, unambiguous formats.
- [Token Lifecycle: Rotation, Refresh & Revocation](https://apiguide.dev/guides/token-lifecycle.md): Managing the full life of API tokens: short-lived access tokens, single-use refresh token rotation, revocation, introspection, and JWKS key rotation.
- [How an API Becomes Tool Definitions](https://apiguide.dev/guides/tool-definitions.md): What an agent actually receives when your OpenAPI document is converted into tool definitions, which parts of the contract survive the conversion, and which are silently dropped.
- [API Versioning Strategies](https://apiguide.dev/guides/versioning.md): Compare URI, Header, and Date-based versioning methods, and how to safely deprecate endpoints.
- [Webhook Delivery History](https://apiguide.dev/guides/webhook-delivery-history.md): Why recording the current state of a webhook delivery is not the same as recording its history, what each attempt should store, and how to make the record useful to the customer rather than only to you.
- [Webhook Signature Verification](https://apiguide.dev/guides/webhook-signatures.md): How to verify incoming webhooks with HMAC-SHA256 signatures, signing secrets, timestamp-based replay protection, and constant-time comparison.
- [Webhooks & Event-Driven API Design](https://apiguide.dev/guides/webhooks.md): Best practices for webhooks, covering secure payload signing, retry scheduling, receiver idempotency, and typed payloads whose changes are new event types rather than quiet mutations.
