# ofetch

[BASE product page](<https://base.akulich.dev/en/library/ofetch/>) · [Resource](<https://github.com/unjs/ofetch>)

ID: ofetch · Language: en
Schema version: 1 · Data version: cbbe7123b47a5ae80983

This is editorial data. An unknown field neither confirms nor rules out a capability.
dataVersion is a dataset fingerprint, not evidence of a recent fact check.

A fetch client with parsing, errors, retries, and hooks: it helps align HTTP requests in browser and server applications\.

## Type

Backend / API library

## Entry type

library

## Separate catalog

No

## [Access conditions](<https://base.akulich.dev/en/library/ofetch/#resource-access>)

free

## [What you can use for free](<https://base.akulich.dev/en/library/ofetch/#resource-access>)

Code and local use under MIT\.

## [Paid features and costs](<https://base.akulich.dev/en/library/ofetch/#resource-access>)

Computing resources, self\-hosting, and external services are paid for separately if used\.

## [Access and limitations](<https://base.akulich.dev/en/library/ofetch/#resource-access>)

Code and local use under MIT\. Computing resources, self\-hosting, and external services are paid for separately if used\.

## [Use cases](<https://base.akulich.dev/en/library/ofetch/#resource-tasks>)

- Align HTTP requests in browser and server code
- Connect parsing, error handling, and required hooks or a retry policy

## Category IDs

- backend

## Subcategory IDs

- backend\.api

## Tags

- ofetch
- API
- Development

## Also known as

- unjs/ofetch
- ofetch
- unjs\-ofetch

## [Selection purpose](<https://base.akulich.dev/en/library/ofetch/#resource-selection>)

Align HTTP requests in browser and server code

## [Choose this when](<https://base.akulich.dev/en/library/ofetch/#resource-selection>)

- Align HTTP requests in browser and server code
- Connect parsing, error handling, and required hooks or a retry policy

## [Requirements](<https://base.akulich.dev/en/library/ofetch/#resource-selection>)

- Choose documentation for the installed version: HEAD is labeled v2 alpha; v1 has its own branch\.

## [Limitations](<https://base.akulich.dev/en/library/ofetch/#resource-selection>)

- Costs and limits of free use: Computing resources, self\-hosting, and external services are paid for separately if used\.
- Terms of use: MIT for the code; dependencies have separate licenses\.
- Retrying a modifying request may repeat the operation; align retry with server idempotency\. ofetch\.create defaults are copied only one level deep, so nested headers need attention\.

## [Questions before use](<https://base.akulich.dev/en/library/ofetch/#resource-faq>)

### What can you use for free in ofetch?

Code and local use under MIT\.

### What additional costs might arise with ofetch?

Computing resources, self\-hosting, and external services are paid for separately if used\.

### What terms of use matter for ofetch?

MIT for the code; dependencies have separate licenses\.

### How do you get started with ofetch?

Define the endpoint and expected external API response format\. Connect parsing, error handling, and required hooks or a retry policy\. Add error handling and an integration check of the result\.

### Which HTTP requests does ofetch retry automatically?

ofetch parses responses, throws on response\.ok=false, and provides error\.data, timeout, and lifecycle hooks\. By default it retries once for listed temporary HTTP errors but disables retries for POST/PUT/PATCH/DELETE\. Explicit retry enables repeats for those methods too; timeout is disabled unless configured\.

## Sources for the selection guide

- [https://github\.com/unjs/ofetch](<https://github.com/unjs/ofetch>)
- [https://raw\.githubusercontent\.com/unjs/ofetch/HEAD/README\.md](<https://raw.githubusercontent.com/unjs/ofetch/HEAD/README.md>)
- [https://raw\.githubusercontent\.com/unjs/ofetch/HEAD/LICENSE](<https://raw.githubusercontent.com/unjs/ofetch/HEAD/LICENSE>)
- [https://www\.open\-source\-tools\.com/](<https://www.open-source-tools.com/>)
- [https://raw\.githubusercontent\.com/unjs/ofetch/v1/README\.md](<https://raw.githubusercontent.com/unjs/ofetch/v1/README.md>)

## [Possible workflow](<https://base.akulich.dev/en/library/ofetch/#resource-scenario>)

Align HTTP requests in browser and server code\.

A possible workflow; this is not a report of hands-on testing.

## Before you start

- A data contract or HTTP workflow\.
- A project with a supported runtime\.

## Steps

1. Define the endpoint and expected external API response format\.
2. Connect parsing, error handling, and required hooks or a retry policy\.
3. Add error handling and an integration check of the result\.

## Check your result

- Invalid and missing data are handled predictably\.
- Types and the actual response agree; errors are not hidden\.

## [License](<https://base.akulich.dev/en/library/ofetch/#resource-license>)

MIT for the code; dependencies have separate licenses\.

## License explanations for the specified scope

### MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed\-source commercial product\. When sharing copies or substantial portions of the code, retain the license text and copyright notice\. You do not need to open\-source your entire project; the author provides no warranties\.

[License terms](<https://opensource.org/license/mit>)

## [Sources](<https://base.akulich.dev/en/library/ofetch/#resource-sources>)

- [Official source](<https://github.com/unjs/ofetch>)
- [Official source](<https://raw.githubusercontent.com/unjs/ofetch/HEAD/README.md>)
- [License](<https://raw.githubusercontent.com/unjs/ofetch/HEAD/LICENSE>)
- [Catalog / discovery source](<https://www.open-source-tools.com/>)
- [Official source](<https://raw.githubusercontent.com/unjs/ofetch/v1/README.md>)

## Editorial review date

2026\-10\-06

## Editorial review scope

The purpose, current repository license, and separate terms for code, services, and models have been reviewed\. The product was not run, and no security audit was performed\.

Dates refer to the stated editorial review, not hands-on testing, a product update, or a recent review of all sources.
