Durable APIs: pagination, idempotency, versioning, and rate limits
Architecture

Durable APIs: pagination, idempotency, versioning, and rate limits

Nam Nguyen
1 min read
0 views
#api
#architecture
#security
#rate-limit

An API is a long-term contract#

APIs connect systems. Good APIs are predictable, debuggable, safe to retry, and able to evolve without breaking clients unexpectedly.

Pagination#

Listing endpoints should not return everything. Offset pagination is simple but can be slow or unstable for large changing data sets. Cursor pagination is often better for feeds and large lists.

Terminal
GET /api/posts?limit=20&cursor=2026-04-25T08:00:00Z

Idempotency#

Retrying the same sensitive mutation should not create duplicate side effects. Payment, order creation, email sending, and webhook processing often need idempotency keys.

Terminal
POST /api/orders
Idempotency-Key: 7a2f4e7f-7c2f-4e2f-8c2d-72d2a6c9a111

Versioning and errors#

Adding fields is usually safe; removing fields, changing types, or changing status code meanings can break clients. Use versioning and deprecation windows for significant changes.

JavaScript
{
  "error": {
    "code": "validation_failed",
    "message": "Title is required.",
    "fields": {
      "title": "Required"
    }
  }
}

Rate limits#

Login, search, contact, comments, uploads, and AI generation endpoints need abuse protection. Return 429 when appropriate and include retry guidance when useful.

Primary references#

Share this article

Help others discover this article

Comments

Loading comments...

Loading comments...

Leave a Comment

Your email will not be published

Minimum 10 characters

0 / 5000