SOLFIND
Web Lens
Portal home

Fetch API - Web APIs | MDN

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API • 150 KB fetched
Open original page


Fetch API - Web APIs | MDN

*
Skip to main content

*
Skip to search

HTML

HTML: Markup language

HTML reference

*
Elements

*
Global attributes

*
Attributes

*
See all…

HTML guides

*
Responsive images

*
HTML cheatsheet

*
Date & time formats

*
See all…

Markup languages

*
SVG

*
MathML

*
XML

CSS

CSS: Styling language

CSS reference

*
Properties

*
Selectors

*
At-rules

*
Values

*
See all…

CSS guides

*
Box model

*
Animations

*
Flexbox

*
Colors

*
See all…

Layout cookbook

*
Column layouts

*
Centering an element

*
Card component

*
See all…

JavaScript JS

JavaScript: Scripting language

JS reference

*
Standard built-in objects

*
Expressions & operators

*
Statements & declarations

*
Functions

*
See all…

JS guides

*
Control flow & error handing

*
Loops and iteration

*
Working with objects

*
Using classes

*
See all…

Web APIs

Web APIs: Programming interfaces

Web API reference

*
File system API

*
Fetch API

*
Geolocation API

*
HTML DOM API

*
Push API

*
Service worker API

*
See all…

Web API guides

*
Using the Web animation API

*
Using the Fetch API

*
Working with the History API

*
Using the Web speech API

*
Using web workers

All

All web technology

Technologies

*
Accessibility

*
HTTP

*
URI

*
Web extensions

*
WebAssembly

*
WebDriver

*
See all…

Topics

*
Media

*
Performance

*
Privacy

*
Security

*
Progressive web apps

Learn

Learn web development

Frontend developer course

*
Getting started modules

*
Core modules

*
MDN Curriculum

*
Check out the video course from Scrimba, our partner

Learn HTML

*
Structuring content with HTML module

Learn CSS

*
CSS styling basics module

*
CSS layout module

Learn JavaScript

*
Dynamic scripting with JavaScript module

Tools

Discover our tools

*
Playground

*
HTTP Observatory

*
Border-image generator

*
Border-radius generator

*
Box-shadow generator

*
Color format converter

*
Color mixer

*
Shape generator

About

Get to know MDN better

*
About MDN

*
Advertise with us

*
Community

*
MDN on GitHub

Blog

Toggle sidebar

*
Web

*
Web APIs

*
Fetch API

Theme

*

OS default

*

Light

*

Dark

English (US)

Remember language
Learn more

*
Deutsch

*
English (US)

*
Español

*
Français

*
日本語

*
한국어

*
Português (do Brasil)

*
Русский

*
中文 (简体)

*
正體中文 (繁體)

Fetch API

The Fetch API provides an interface for fetching resources (including across the network). It is a more powerful and flexible replacement for XMLHttpRequest .

In this article

*
Concepts and usage

*
Interfaces

*
HTTP headers

*
Specifications

*
Browser compatibility

*
See also

Concepts and usage

The Fetch API uses Request and Response objects (and other things involved with network requests), as well as related concepts such as CORS and the HTTP Origin header semantics.

For making a request and fetching a resource, use the fetch() method. It is a global method in both Window and Worker contexts. This makes it available in pretty much any context you might want to fetch resources in.

The fetch() method takes one mandatory argument, the path to the resource you want to fetch. It returns a Promise that resolves to the Response to that request — as soon as the server responds with headers — even if the server response is an HTTP error status . You can also optionally pass in an init options object as the second argument (see Request ).

Once a Response is retrieved, there are a number of methods available to define what the body content is and how it should be handled.

You can create a request and response directly using the Request() and Response() constructors, but it's uncommon to do this directly. Instead, these are more likely to be created as results of other API actions (for example, FetchEvent.respondWith() from service workers).

Find out more about using the Fetch API features in Using Fetch .

Deferred Fetch

The fetchLater() API enables a developer to request a deferred fetch , that can be sent after a specified period of time, or when the page is closed or navigated away from. See Using Deferred Fetch .

Interfaces

Window.fetch() and WorkerGlobalScope.fetch()

The fetch() method used to fetch a resource.

Window.fetchLater()

Used to make a deferred fetch request.

DeferredRequestInit

Represents the set of options that can be used to configure a deferred fetch request.

FetchLaterResult

Represents the result of requesting a deferred fetch.

Headers

Represents response/request headers, allowing you to query them and take different actions depending on the results.

Request

Represents a resource request.

Response

Represents the response to a request.

HTTP headers

deferred-fetch

Controls the top-level quota for the fetchLater() API.

deferred-fetch-minimal

Controls the shared cross-origin subframe quota for the fetchLater() API.

Specifications

Specification

Fetch
# fetch-method

Fetch
# deferred-fetch

Browser compatibility

api.fetch

api.Window.fetchLater

See also

* Using Fetch

* Service Worker API

* HTTP access control (CORS)

* HTTP

* Local network access

Help improve MDN

Yes

No

Learn how to contribute
This page was last modified on Jun 8, 2026 by MDN contributors .

View this page on GitHub • Report a problem with this content

Clear filter input

* Fetch API

* Guides
* Using the Fetch API

* Using Deferred Fetch

* Interfaces
* DeferredRequestInit

* FetchLaterResult

* Headers

* Request

* RequestInit

* Response

* Methods
* Window .fetch()

* WorkerGlobalScope .fetch()

* Window .fetchLater()

Your blueprint for a better internet.

*

*

*

*

*

MDN

*

About

*

Blog

*

Mozilla careers

*

Advertise with us

*

MDN Plus

*

Product help

Contribute

*

MDN Community

*

Community resources

*

Writing guidelines

*

MDN Discord

*

MDN on GitHub

Developers

*

Web technologies

*

Learn web development

*

Guides

*

Tutorials

*

Glossary

*

Hacks blog

*
Website Privacy Notice

*
Telemetry Settings

*
Legal

*
Community Participation Guidelines

Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license .

Links found on this page

  1. Skip to main content [direct]
  2. HTML: Markup language [direct]
  3. Elements [direct]
  4. Global attributes [direct]
  5. Attributes [direct]
  6. See all… [direct]
  7. Responsive images [direct]
  8. HTML cheatsheet [direct]
  9. Date & time formats [direct]
  10. See all… [direct]
  11. SVG [direct]
  12. MathML [direct]
  13. XML [direct]
  14. CSS: Styling language [direct]
  15. Properties [direct]
  16. Selectors [direct]
  17. At-rules [direct]
  18. Values [direct]
  19. See all… [direct]
  20. Box model [direct]
  21. Animations [direct]
  22. Flexbox [direct]
  23. Colors [direct]
  24. See all… [direct]
  25. Column layouts [direct]
  26. Centering an element [direct]
  27. Card component [direct]
  28. See all… [direct]
  29. JavaScript: Scripting language [direct]
  30. Standard built-in objects [direct]
  31. Expressions & operators [direct]
  32. Statements & declarations [direct]
  33. Functions [direct]
  34. See all… [direct]
  35. Control flow & error handing [direct]
  36. Loops and iteration [direct]
  37. Working with objects [direct]
  38. Using classes [direct]
  39. See all… [direct]
  40. Web APIs: Programming interfaces [direct]
  41. File system API [direct]
  42. Geolocation API [direct]
  43. HTML DOM API [direct]
  44. Push API [direct]
  45. Service worker API [direct]
  46. Using the Web animation API [direct]
  47. Using the Fetch API [direct]
  48. Working with the History API [direct]
  49. Using the Web speech API [direct]
  50. Using web workers [direct]
  51. All web technology [direct]
  52. Accessibility [direct]
  53. HTTP [direct]
  54. URI [direct]
  55. Web extensions [direct]
  56. WebAssembly [direct]
  57. WebDriver [direct]
  58. Media [direct]
  59. Performance [direct]
  60. Privacy [direct]
  61. Security [direct]
  62. Progressive web apps [direct]
  63. Learn web development [direct]
  64. Getting started modules [direct]
  65. Core modules [direct]
  66. MDN Curriculum [direct]
  67. Check out the video course from Scrimba, our partner [direct]
  68. Structuring content with HTML module [direct]
  69. CSS styling basics module [direct]
  70. CSS layout module [direct]
  71. Dynamic scripting with JavaScript module [direct]
  72. Playground [direct]
  73. HTTP Observatory [direct]
  74. Border-image generator [direct]
  75. Border-radius generator [direct]
  76. Box-shadow generator [direct]
  77. Color format converter [direct]
  78. Color mixer [direct]
  79. Shape generator [direct]
  80. About MDN [direct]