ker ` ](/en-
US/docs/Web/API/WorkerGlobalScope "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 ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves to the
[ ` Response ` ](/en-US/docs/Web/API/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 ` ](/en-US/docs/Web/API/Request) ).

Once a [ ` Response ` ](/en-US/docs/Web/API/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() `
](/en-US/docs/Web/API/Request/Request "Request\(\)") and [ ` Response() `
](/en-US/docs/Web/API/Response/Response "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() `
](/en-US/docs/Web/API/FetchEvent/respondWith) from service workers).

Find out more about using the Fetch API features in [ Using Fetch ](/en-
US/docs/Web/API/Fetch_API/Using_Fetch) , and study concepts in [ Fetch basic
concepts ](/en-US/docs/Web/API/Fetch_API/Basic_concepts) .

##  Fetch Interfaces

[ ` fetch() ` ](/en-US/docs/Web/API/fetch)

    

The ` fetch() ` method used to fetch a resource.

[ ` Headers ` ](/en-US/docs/Web/API/Headers)

    

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

[ ` Request ` ](/en-US/docs/Web/API/Request)

    

Represents a resource request.

[ ` Response ` ](/en-US/docs/Web/API/Response)

    

Represents the response to a request.

##  Specifications

Specification  
---  
[ Fetch Standard  
#  fetch-method  ](https://fetch.spec.whatwg.org/#fetch-method)  
  
##  Browser compatibility

BCD tables only load in the browser  with JavaScript enabled. Enable
JavaScript to view data.

##  See also

  * [ Using Fetch ](/en-US/docs/Web/API/Fetch_API/Using_Fetch)
  * [ Service Worker API ](/en-US/docs/Web/API/Service_Worker_API)
  * [ HTTP access control (CORS) ](/en-US/docs/Web/HTTP/CORS)
  * [ HTTP ](/en-US/docs/Web/HTTP)
  * [ Fetch polyfill ](https://github.com/github/fetch)
  * [ Fetch basic concepts ](/en-US/docs/Web/API/Fetch_API/Basic_concepts)

##  Help improve MDN

Was this page helpful to you?

Yes  No

[ Learn how to contribute
](https://github.com/mdn/content/blob/main/CONTRIBUTING.md "This will take you
to our contribution guidelines on GitHub.") .

This page was last modified on  Mar 6, 2024  by  [ MDN contributors ](/en-
US/docs/Web/API/Fetch_API/contributors.txt) .

[ View this page on GitHub
](https://github.com/mdn/content/blob/main/files/en-
us/web/api/fetch_api/index.md?plain=1 "Folder: en-us/web/api/fetch_api \(Opens
in a new tab\)") â¢  [ Report a problem with this content
](https://github.com/mdn/content/issues/new?template=page-report.yml&mdn-
url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FAPI%2FFetch_API&metadata=%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EPage+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-
us%2Fweb%2Fapi%2Ffetch_api%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FAPI%2FFetch_API%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-
us%2Fweb%2Fapi%2Ffetch_api%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F2c641e08878722bf29fb784d58c61873ce4a133a%0A*+Document+last+modified%3A+2024-03-06T05%3A58%3A29.000Z%0A%0A%3C%2Fdetails%3E
"This will take you to GitHub to file a new issue.")

[ MDN logo  ](/)

Your blueprint for a better i