Introduction
Understanding what CallApi is all about
What is CallApi?
CallApi is a Fetch API wrapper that adds the convenience features developers actually need when making HTTP requests. Due to its 1-to-1 API similarity with Fetch, it works as a drop-in replacement. This implies that if you know Fetch, you already know the basics of CallApi.
It comes with built-in request deduplication, retries, error handling, hooks, plugins and more. Runs everywhere JavaScript does: browsers, Node.js (18+), workers, Deno, and Bun.
Why CallApi?
Data fetching is at the core of most web applications. While the Fetch API provides a standard way to make HTTP requests, it's too primitive or rather too basic for most real-world use cases. Developers often end up writing boilerplate code or creating incomplete abstractions to fill the gaps.
Many existing HTTP clients I've used in the past to solve this problem had one or more of the following drawbacks:
- They are not based on modern web standards (like the Fetch API in this case)
- Miss crucial features like request deduplication, interceptors, retries, ergonomic error handling, validation schema support, etc.
- Have clunky or verbose APIs for the simplest of things
- Lack proper TypeScript support
- Ship with bloated bundles due to things like legacy/backwards-compat constraints, large external dependencies, little to no tree-shaking support etc.
- Hard to extend or customize to suit specific requirements and so on...
So in the end, I decided to create CallApi in order to address these pain points.
Features
CallApi aims to be the most comprehensive as well as intuitive fetching library out there. It provides a wide range of features out of the box and still allows you to extend it with plugins. Here are some of the features:
Request Deduplication
Eliminates duplicate requests and by effect, race conditions.
Interceptors/Hooks
Callback functions that allow running of side effects at various points within the request/response lifecycle.
Smart Response Parser
Automatically detects and parses response types (JSON, text, binary) based on Content-Type headers.
Content Type Detection
Automatically sets request Content-Type headers based on body type (JSON, form data, etc.).
Dynamic URL Parameters and Query Support
Convenient syntax for adding url parameters as well as query strings to the request url.
Extensible
Plugins and hooks to extend the functionality.
Schema Validation
Allows you to validate the both request details and response data, both on the type level and at runtime.
Retries
Advanced retry mechanisms with linear and exponential backoff strategies or custom retry conditions.
Last updated on 9/20/2025