Sindre's open source work is supported by the community.
Special thanks to:
Human-friendly and powerful HTTP request library for Node.js
See how Got compares to other HTTP libraries
You probably want Ky instead, by the same people. It's smaller, works in the browser too, and is more stable since it's built on Fetch. Or fetch-extras for simple needs.
Support questions should be asked here.
Install
npm install gotWarning: This package is native ESM and no longer provides a CommonJS export. If your project uses CommonJS, you will have to convert to ESM. Please don't open issues for questions regarding CommonJS / ESM.
Got v11 is no longer maintained and we will not accept any backport requests.
Take a peek
A quick start guide is available.
JSON mode
Got has a dedicated option for handling JSON payload.
Furthermore, the promise exposes a .json<T>() function that returns Promise<T>.
import got from 'got';
const {data} = await got.post('https://httpbin.org/anything', {
json: {
hello: 'world'
}
}).json();
console.log(data);
//=> {"hello": "world"}For advanced JSON usage, check out the parseJson and stringifyJson options.
For more useful tips like this, visit the Tips page.
Highlights
Documentation
By default, Got will retry on failure. To disable this option, set options.retry.limit to 0.
Main API
Timeouts and retries
Advanced creation
Cache, Proxy and UNIX sockets
Integration
Migration guides
Got plugins
got4aws- Got convenience wrapper to interact with AWS v4 signed APIsgh-got- Got convenience wrapper to interact with the GitHub APIgl-got- Got convenience wrapper to interact with the GitLab APIgotql- Got convenience wrapper to interact with GraphQL using JSON-parsed queries instead of stringsgot-fetch- Got with afetchinterfacegot-scraping- Got wrapper specifically designed for web scraping purposesgot-ssrf- Got wrapper to protect server-side requests against SSRF attacks
Comparison
got |
node-fetch |
ky |
axios |
superagent |
|
|---|---|---|---|---|---|
| HTTP/2 support | ✔️ | ❌ | ✔️ | ❌ | ✔️** |
| Browser support | ❌ | ✔️* | ✔️ | ✔️ | ✔️ |
| Promise API | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Stream API | ✔️ | Node.js only | ❌ | ❌ | ✔️ |
| Pagination API | ✔️ | ❌ | ❌ | ❌ | ❌ |
| Request aborting | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| RFC 7234 caching | ✔️ | ❌ | ❌ | ❌ | ❌ |
| Cookies (out-of-the-box) | ✔️ | ❌ | ❌ | ❌ | ❌ |
| Follows redirects | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Retries on failure | ✔️ | ❌ | ✔️ | ❌ | ✔️ |
| Progress events | ✔️ | ❌ | ✔️ | Browser only | ✔️ |
| Handles gzip/deflate | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Advanced timeouts | ✔️ | ❌ | ❌ | ❌ | ❌ |
| Timings | ✔️ | ❌ | ❌ | ❌ | ❌ |
| Errors with metadata | ✔️ | ❌ | ✔️ | ✔️ | ❌ |
| JSON mode | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Custom defaults | ✔️ | ❌ | ✔️ | ✔️ | ❌ |
| Composable | ✔️ | ❌ | ❌ | ❌ | ✔️ |
| Hooks | ✔️ | ❌ | ✔️ | ✔️ | ❌ |
| Issues open | |||||
| Issues closed | |||||
| Downloads | |||||
| Coverage | TBD | ||||
| Build | |||||
| Bugs | |||||
| Dependents | |||||
| Install size | |||||
| GitHub stars | |||||
| TypeScript support | |||||
| Last commit |
* It's almost API compatible with the browser fetch API.
** Need to switch the protocol manually. Doesn't accept PUSH streams and doesn't reuse HTTP/2 sessions.
❇️ Almost-stable feature, but the API may change. Don't hesitate to try it out!
❔ Feature in early stage of development. Very experimental.
Click here to see the install size of the Got dependencies.
Maintainers
![]() |
![]() |
|---|---|
| Sindre Sorhus | Szymon Marczak |

