On this page
Overview
Ky is a small HTTP client built on the standard Fetch API. It adds method shortcuts, non-2xx errors, JSON helpers, retries, timeouts, base URLs, hooks, progress handling, and Standard Schema response validation across browsers, Node.js, Bun, and Deno.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Add method shortcuts and response helpers to fetch-compatible requests
Shortcuts such as ky.get and ky.post combine with .json(), .text(), and other body helpers. The json option sends JSON request bodies, while non-2xx responses become HTTPError instances.
Sources: [1]
Centralize retry, timeout, baseUrl, and hook behavior
Retry policies, per-attempt and total timeouts, base URLs, and lifecycle hooks can be configured as options. extend creates clients with shared defaults for authentication, errors, and other cross-cutting behavior.
Sources: [1]
Type and validate JSON responses with TypeScript and Standard Schema
.json<T>() accepts TypeScript generics and defaults to unknown when no type is supplied. Standard Schema-compatible validators can also perform runtime validation and report SchemaValidationError on invalid data.
Sources: [1]
Best fit
Fits frontends that want to standardize HTTP behavior without abandoning fetch semantics
It is useful when applications want the native fetch request/response model while centralizing repeated JSON, error, retry, and authentication behavior.
Sources: [1]
Before adoption
Version 2.1.0 requires Node.js 22 or newer
Package metadata declares engines.node as >=22. Browser, Bun, and Deno usage remains supported, but Node.js backends and SSR environments should verify their runtime first.
Sources: [2]
Tune retry methods and delays to match API semantics
Ky includes retries by default and version 2.1.0 further hardens retry handling. The default method set includes PUT and DELETE in addition to GET, so endpoints with side effects should define retry limits and status handling explicitly.
Official sources
- [1]Ky v2.1.0 README(2026-10-05)
- [2]Ky v2.1.0 package metadata(2026-10-05)
- [3]Ky v2.1.0 release(2026-10-05)
- [4]Ky MIT license(2026-10-05)
Supplemental curator note
Ky 2.1.0 requires Node.js 22 or newer. Retries are convenient, but default retry methods include operations such as PUT and DELETE, so confirm API idempotency and disable retries explicitly when a request must not be repeated.
Try it in 3 steps
- 1
Verify Node.js 22+ and install Ky 2.1.0
Check the package engine requirement before installing the reviewed Ky release in an isolated project.
node -e "if (Number(process.versions.node.split('.')[0]) < 22) { console.error('Ky 2.1.0 requires Node.js >=22'); process.exit(1); }" && demo=$(mktemp -d "${TMPDIR:-/tmp}/ky.XXXXXX") && cd "$demo" && npm init -y >/dev/null && npm install --save-exact ky@2.1.0 - 2
Create a local HTTP server and request it with Ky
Use a local server to exercise the fetch-based request and JSON body shortcut without relying on an external endpoint. Retries are disabled for a deterministic check.
printf "%s\n" "import {createServer} from 'node:http';" "import ky from 'ky';" "const server = createServer((request, response) => { response.setHeader('content-type', 'application/json'); response.end(JSON.stringify({ok: true})); });" "server.listen(0, '127.0.0.1', async () => {" " const address = server.address();" " try {" " const data = await ky.get('http://127.0.0.1:' + address.port + '/', {retry: {limit: 0}}).json();" " if (data.ok !== true) process.exitCode = 1;" " console.log(data);" " } finally { server.close(); }" "});" > demo.mjs - 3
Run the request with Node.js
Confirm that Ky retrieves the response and returns the parsed JSON body.
node demo.mjs
Growth
Growth trends · Last 30 days
17,104 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 48
- Open PRs
- 0
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- fetch
- whatwg-fetch
- http-client
- http-request
- request
- npm-package
- tiny
- json
- rest
- js
- javascript
- Stars
- 17,104
- Forks
- 499
- Watchers
- 64
- Open issues
- 2
- Contributors
- 120
- Owner type
- User
- Primary language
- TypeScript
- License
- MIT
- Repository last updated
- Sep 16, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- ofetch5,360 Stars
6 shared tag(s) · 1 shared category(s) · Same language
add JSON parsing, retries, timeouts, and interceptors to fetch across Node, browsers, and workers
TypeScript - Superstruct7,127 Stars
5 shared tag(s) · 1 shared category(s) · Same language
compose small structs to validate JavaScript and TypeScript data at runtime
TypeScript - io-ts6,814 Stars
5 shared tag(s) · 1 shared category(s) · Same language
decode and encode unknown values with codecs while inferring TypeScript types from the same definitions
TypeScript - Runtypes2,699 Stars
5 shared tag(s) · 1 shared category(s) · Same language
validate unknown values with composable runtime types and infer TypeScript types from the same definitions
TypeScript - Ajv14,850 Stars
4 shared tag(s) · 1 shared category(s) · Same language
compile JSON Schema or JTD contracts into fast runtime validators for API and configuration data
TypeScript - openapi-typescript8,391 Stars
4 shared tag(s) · 1 shared category(s) · Same language
generate runtime-free TypeScript types from OpenAPI 3.0 and 3.1 contracts
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.