ective of the resources it's retrieving.

**Note:** The ` fetch() ` method's parameters are identical to those of the [
` Request() ` ](/en-US/docs/Web/API/Request/Request "Request\(\)")
constructor.

##  Syntax

js

    
    
    fetch(resource)
    fetch(resource, options)
    

###  Parameters

` resource `

    

This defines the resource that you wish to fetch. This can either be:

  * A string or any other object with a [ stringifier ](/en-US/docs/Glossary/Stringifier) â including a [ ` URL ` ](/en-US/docs/Web/API/URL) object â that provides the URL of the resource you want to fetch. 
  * A [ ` Request ` ](/en-US/docs/Web/API/Request) object. 

` options ` Optional

    

An object containing any custom settings you want to apply to the request. The
possible options are:

` body `

    

Any body that you want to add to your request: this can be a [ ` Blob ` ](/en-
US/docs/Web/API/Blob) , an [ ` ArrayBuffer ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) , a [ `
TypedArray ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
, a [ ` DataView ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/DataView) , a [ ` FormData `
](/en-US/docs/Web/API/FormData) , a [ ` URLSearchParams ` ](/en-
US/docs/Web/API/URLSearchParams) , string object or literal, or a [ `
ReadableStream ` ](/en-US/docs/Web/API/ReadableStream) object. This latest
possibility is still experimental; check the [ compatibility information
](/en-US/docs/Web/API/Request#browser_compatibility) to verify you can use it.
Note that a request using the ` GET ` or ` HEAD ` method cannot have a body.

` browsingTopics ` Experimental

    

A boolean specifying that the selected topics for the current user should be
sent in a [ ` Sec-Browsing-Topics ` ](/en-US/docs/Web/HTTP/Headers/Sec-
Browsing-Topics) header with the associated request. See [ Using the Topics
API ](/en-US/docs/Web/API/Topics_API/Using) for more details.

` cache `

    

A string indicating how the request will interact with the browser's [ HTTP
cache ](/en-US/docs/Web/HTTP/Caching) . The possible values, ` default ` , `
no-store ` , ` reload ` , ` no-cache ` , ` force-cache ` , and ` only-if-
cached ` , are documented in the article for the [ ` cache ` ](/en-
US/docs/Web/API/Request/cache "cache") property of the [ ` Request ` ](/en-
US/docs/Web/API/Request) object.

` credentials `

    

Controls what browsers do with credentials ( [ cookies ](/en-
US/docs/Web/HTTP/Cookies) , [ HTTP authentication ](/en-
US/docs/Web/HTTP/Authentication) entries, and TLS client certificates). Must
be one of the following strings:

  * ` omit ` : Tells browsers to exclude credentials from the request, and ignore any credentials sent back in the response (e.g., any [ ` Set-Cookie ` ](/en-US/docs/Web/HTTP/Headers/Set-Cookie) header). 
  * ` same-origin ` : Tells browsers to include credentials with requests to same-origin URLs, and use any credentials sent back in responses from same-origin URLs. **This is the default value.**
  * ` include ` : Tells browsers to include credentials in both same- and cross-origin requests, and always use any credentials sent back in responses. 

**Note:** Credentials may be included in simple and "final" cross-origin
requests, but should not be included in [ CORS preflight requests ](/en-
US/docs/Web/HTTP/CORS#preflight_requests_and_credentials) .

` headers `

    

Any headers you want to add to your request, contained within a [ ` Headers `
](/en-US/docs/Web/API/Headers) object or an object literal with [ ` String `
](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) values. Note
that [ some names are forbidden ](/en-US/docs/Glossary/Forbidden_header_name)
.

**Note:** The [ ` Authorization ` ](/en-
US/docs/Web/HTTP/Headers/Authorization) HTTP header may be added to a request,
but will be removed if the request is redirected cross-origin.

` integrity `

    

Contains the [ subresource integrity ](/en-
US/docs/Web/Security/Subre