# sindresorhus/ky

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/sindresorhus-ky).**

16,943 stars · 474 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/sindresorhus/ky
- awesome-repositories: https://awesome-repositories.com/repository/sindresorhus-ky.md

## Topics

`fetch` `http-client` `http-request` `javascript` `js` `json` `npm-package` `request` `rest` `tiny` `whatwg-fetch`

## Description

🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API

## Tags

### Networking & Communication

- [Fetch-Based HTTP Clients](https://awesome-repositories.com/f/networking-communication/isomorphic-http-clients/fetch-based-http-clients.md) — An HTTP client built on the Fetch API that simplifies requests with automatic error handling and retry logic.
- [HTTP Client Libraries](https://awesome-repositories.com/f/networking-communication/http-client-libraries.md) — An HTTP client library built on the Fetch API for making requests with retries, timeouts, and error handling.
- [Request Cancellations](https://awesome-repositories.com/f/networking-communication/network-request-clients/request-cancellations.md) — Leverages the standard AbortController API to cancel in-flight HTTP requests.
- [Client Instance Defaults](https://awesome-repositories.com/f/networking-communication/remote-access-control/client-configuration-settings/client-instance-defaults.md) — Builds reusable Ky instances with custom defaults supporting inheritance and option replacement. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Bidirectional Progress Tracking](https://awesome-repositories.com/f/networking-communication/upload-progress-tracking/bidirectional-progress-tracking.md) — Ky reports progress of data transfer with percentage, bytes transferred, and chunk data for both uploads and downloads. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))

### Web Development

- [Fetch API Wrappers](https://awesome-repositories.com/f/web-development/restful-api-clients/node-js-clients/fetch-api-wrappers.md) — Wraps the native Fetch API with a cleaner interface, adding automatic error handling and retry logic.
- [HTTP Client Requests](https://awesome-repositories.com/f/web-development/http-client-requests.md) — Ky makes HTTP requests with a clean API, automatic error handling, retries, and timeouts for web and Node.js applications.
- [HTTP Error Handling](https://awesome-repositories.com/f/web-development/http-error-handling.md) — Ky controls how non-2xx status codes are handled with selective error throwing and retry logic for failed requests.
- [Request Cancellation](https://awesome-repositories.com/f/web-development/http-methods/service-method-mapping/request-cancellation.md) — Ky aborts an in-flight request using the AbortController API, throwing an AbortError. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Request Lifecycle Hooks](https://awesome-repositories.com/f/web-development/request-lifecycle-hooks.md) — Exposes hooks at initialization, before request, before retry, before error, and after response stages.
- [Base URL Mappers](https://awesome-repositories.com/f/web-development/url-generators/base-url-mappers.md) — Resolves relative request URLs against a specified base URL to simplify API endpoint configuration. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Schema-Based Response Validation](https://awesome-repositories.com/f/web-development/client-side-input-validators/schema-based-response-validation.md) — Parses JSON responses and validates them against a schema, throwing an error on mismatch. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Standard Schema Response Validators](https://awesome-repositories.com/f/web-development/client-side-input-validators/schema-based-response-validation/standard-schema-response-validators.md) — Validates JSON response bodies against Standard Schema libraries like Zod, throwing an error on mismatch. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Fetch Overrides](https://awesome-repositories.com/f/web-development/data-fetching-caching/data-fetching/fetch-overrides.md) — Allows replacement of the default fetch implementation with a custom one for mocking or instrumentation.
- [Custom Fetch Implementations](https://awesome-repositories.com/f/web-development/data-fetching-caching/data-fetching/fetch-overrides/custom-fetch-implementations.md) — Provides a mechanism to replace the default fetch function for testing and instrumentation purposes. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Form Data Submission](https://awesome-repositories.com/f/web-development/form-data-support/form-data-submission.md) — Ky submits FormData or URLSearchParams as request bodies, automatically setting the appropriate Content-Type header. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Selective Status Code Filtering](https://awesome-repositories.com/f/web-development/http-error-handling/selective-status-code-filtering.md) — Ky controls whether non-2xx status codes throw an error, with optional per-status-code filtering. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Query Parameter Mergers](https://awesome-repositories.com/f/web-development/routing-systems/routing-utilities/route-parameter-accessors/search-parameters/query-parameter-mergers.md) — Ky merges query parameters into request URLs, combining them with any existing parameters already present in the input URL. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))

### DevOps & Infrastructure

- [Request Retries](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries.md) — Automatically retries failed requests with configurable limits, delays, backoff, and jitter. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Automatic Retry Clients](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries/automatic-retry-clients.md) — Automatically retries failed requests with configurable limits, delays, and jitter.
- [Configurable Retry Engines](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries/configurable-retry-engines.md) — Provides automatic retry of failed HTTP requests with configurable limits, delays, backoff, and jitter.
- [Configurable Retry Engines](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries/configurable-retry-engines/configurable-retry-engines.md) — Ky controls retry behavior with configurable limits, status codes, delays, jitter, and timeout handling to automatically retry failed requests. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Hook-Triggered Retries](https://awesome-repositories.com/f/devops-infrastructure/api-service-management/api-resilience/request-retries/retry-after-retries/hook-triggered-retries.md) — Ky triggers a retry from an afterResponse hook based on response content, even for successful status codes. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))

### Software Engineering & Architecture

- [HTTP Lifecycle Hooks](https://awesome-repositories.com/f/software-engineering-architecture/lifecycle-event-hooks/ajax-request-lifecycle-hooks/http-lifecycle-hooks.md) — Allows request and response interception through lifecycle hooks for customization and authentication.
- [HTTP Retry Engines](https://awesome-repositories.com/f/software-engineering-architecture/retry-policies/http-retry-engines.md) — Implements automatic retries with configurable limits, status codes, delays, jitter, and timeout handling.
- [Response Schema Validators](https://awesome-repositories.com/f/software-engineering-architecture/json-schema-validation/response-schema-validators.md) — Validates JSON response bodies against a schema, throwing an error on mismatch. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))

### System Administration & Monitoring

- [Per-Attempt Timeouts](https://awesome-repositories.com/f/system-administration-monitoring/request-timeouts/per-attempt-timeouts.md) — Applies per-attempt and total timeouts to requests, throwing a timeout error if the limit is exceeded. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))

### Testing & Quality Assurance

- [Lightweight HTTP Clients](https://awesome-repositories.com/f/testing-quality-assurance/http-request-clients/lightweight-http-clients.md) — A minimal HTTP client for making requests with JSON handling, timeouts, and configurable retries.
- [Pre-Configured HTTP Clients](https://awesome-repositories.com/f/testing-quality-assurance/http-request-clients/pre-configured-http-clients.md) — Creates reusable HTTP clients with custom defaults using extend or create. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [Fetch Function Mocking](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/network-api-mocking/api-request-mocking/fetch-function-mocking.md) — Replaces the fetch function with a custom implementation to return predefined responses without network calls. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))
- [AbortController-Based Clients](https://awesome-repositories.com/f/testing-quality-assurance/http-request-clients/abortcontroller-based-clients.md) — Uses the standard AbortController API for consistent request cancellation across environments.

### Data & Databases

- [Standard Schema Validators](https://awesome-repositories.com/f/data-databases/data-collection-schemas/standard-schema-validators.md) — Validates JSON response bodies against Standard Schema libraries like Zod, throwing a validation error on mismatch.
- [JSON Request Serializers](https://awesome-repositories.com/f/data-databases/json-request-serializers.md) — Ky automatically serializes JavaScript objects to JSON and sets the appropriate Content-Type header for request bodies. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))

### Security & Cryptography

- [Automatic Token Refreshes](https://awesome-repositories.com/f/security-cryptography/account-management/account-synchronization/credential-refreshers/oauth-token-refreshes/automatic-token-refreshes.md) — Refreshes expired authentication tokens by intercepting 401 responses and retrying requests with fresh credentials.
- [Hook-Based Token Refreshes](https://awesome-repositories.com/f/security-cryptography/oidc-identity-token-issuance/refresh-token-grants/hook-based-token-refreshes.md) — Retries requests with fresh authentication tokens when a 401 response is received, using before-retry hooks. ([source](https://cdn.jsdelivr.net/gh/sindresorhus/ky@main/README.md))

### Part of an Awesome List

- [General Utilities](https://awesome-repositories.com/f/awesome-lists/more/general-utilities.md) — Lightweight HTTP client based on Fetch API.
