network.responseStarted event

The network.responseStarted event of the network module fires when the browser has received the headers of a response, before it has received the whole response body.

Event data

The params field in the event notification is an object with the following fields:

context

A string that contains the ID of the context in which the request was made, or null if the request wasn't made by a document in a context, for example a request made by a worker.

intercepts Optional

An array of one or more strings, each containing the ID of an intercept that blocks the response. This field is included only when isBlocked is true. Intercept IDs are returned by the network.addIntercept command.

isBlocked

A boolean that indicates whether the response is blocked by an intercept.

  • true: The response matches one or more intercepts listed in the intercepts field and is blocked. The browser doesn't process the response further until the client resumes it, for example with the network.continueResponse command.
  • false: The response doesn't match any of the session's intercepts, so the client doesn't need to resume it.

A string that contains the UUID that uniquely identifies the navigation that the request is part of, or null if the request isn't a navigation request. For example, the value is null when requesting a document's subresources, such as stylesheets and scripts, or when making a request with fetch(). If the navigation was started using the browsingContext.navigate or browsingContext.reload command, this ID matches the navigation value in the command's response. Other events related to this navigation share the same navigation ID, including events in the browsingContext and network modules.

redirectCount

A non-negative integer that contains the number of redirects the browser has followed for this request. It is 0 for the original request and increases by one with each redirect.

request

An object that describes the request. It contains the following fields:

bodySize

A non-negative integer that contains the size of the request body in bytes, or null if the request has no body.

cookies

An array of objects, each representing a cookie sent with the request. The array is empty if the request has no Cookie header. Each object contains the following fields and may additionally include browser-specific fields:

domain

A string that contains the domain of the cookie.

expiry Optional

A non-negative integer that contains the expiry time of the cookie, as seconds elapsed since the epoch. This field is omitted for a cookie that has no expiry time, such as a session cookie.

httpOnly

A boolean that indicates whether the cookie is hidden from page scripts by its HttpOnly attribute (true) or is accessible to them (false).

name

A string that contains the name of the cookie.

path

A string that contains the path of the cookie.

sameSite

A string that indicates the cookie's SameSite setting. It has one of the following values:

  • default: The cookie has no SameSite attribute or has an unrecognized value, so the browser's default behavior applies.
  • lax: The cookie has SameSite=Lax.
  • none: The cookie has SameSite=None.
  • strict: The cookie has SameSite=Strict.
secure

A boolean that indicates whether the cookie is restricted to secure connections by its Secure attribute (true) or can be sent over insecure connections (false).

size

A non-negative integer that contains the combined size of the cookie's name and value, in bytes.

value

An object that contains the value of the cookie. It contains the following fields:

type

A string that indicates how the cookie value is encoded. It has one of the following values:

  • base64: The value is Base64-encoded bytes because the bytes are not valid UTF-8.
  • string: The value is text decoded from UTF-8 bytes.
value

A string that contains the cookie value in the encoding specified by the type field.

destination

A string that contains the destination of the request, such as document, script, or style. The string is empty for requests made with fetch() or XMLHttpRequest.

headers

An array of objects, each representing a header of the request, including headers added with the network.setExtraHeaders command. Each object contains the following fields:

name

A string that contains the header name, such as Accept.

value

An object that contains the header value. It contains the following fields:

type

A string that indicates how the header value is encoded. It has one of the following values:

  • base64: The value is Base64-encoded bytes because the bytes are not valid UTF-8.
  • string: The value is text decoded from UTF-8 bytes.
value

A string that contains the header value in the encoding specified by the type field.

headersSize

A non-negative integer that contains the size of the request headers in bytes. For protocols that compress headers, such as HTTP/2, it represents the compressed size.

initiatorType

A string that indicates what started the request, such as fetch, link, or script. For a request with no initiator type, such as the request for a page loaded into a tab, the value is null instead of a string. See PerformanceResourceTiming.initiatorType for descriptions of common values.

method

A string that contains the HTTP request method, such as GET or POST.

request

A string that contains the ID of the request. The ID stays the same even when the request is redirected.

timings

An object that contains the times at which the stages of the request happened. The timeOrigin field contains a time in milliseconds since the epoch. The other fields in this object contain times in milliseconds relative to timeOrigin. A field is 0 if its stage hasn't happened, for example the redirect fields for a request that wasn't redirected. All the fields are 0 if the request wasn't made by a document or a worker. It contains the following fields:

connectEnd

A number that represents the time when the browser finished establishing the connection to the server, similar to PerformanceResourceTiming.connectEnd.

connectStart

A number that represents the time when the browser started establishing the connection to the server, similar to PerformanceResourceTiming.connectStart.

dnsEnd

A number that represents the time when the browser finished the domain name lookup, similar to PerformanceResourceTiming.domainLookupEnd.

dnsStart

A number that represents the time when the browser started the domain name lookup, similar to PerformanceResourceTiming.domainLookupStart.

fetchStart

A number that represents the time when the browser started fetching the resource after any redirects, similar to PerformanceResourceTiming.fetchStart.

redirectEnd

A number that represents the time when the browser received the last byte of the response to the last redirect, similar to PerformanceResourceTiming.redirectEnd.

redirectStart

A number that represents the time when the request that was redirected first started, similar to PerformanceResourceTiming.redirectStart.

requestStart

A number that represents the time when the browser started sending the request, similar to PerformanceResourceTiming.requestStart.

requestTime

A number that represents the time when the request started, similar to PerformanceEntry.startTime.

responseEnd

A number that represents the time when the browser received the last byte of the response, similar to PerformanceResourceTiming.responseEnd.

responseStart

A number that represents the time when the browser received the first byte of the response, similar to PerformanceResourceTiming.responseStart.

timeOrigin

A number that represents the time origin of the document or worker that made the request.

tlsStart

A number that represents the time when the browser started the TLS handshake to secure the connection, similar to PerformanceResourceTiming.secureConnectionStart.

url

A string that contains the URL of the request.

response

An object that describes the response. It contains the following fields:

authChallenges Optional

An array of objects, each representing an authentication challenge from the server. This field is included only when the response status is 401 or 407. The challenges come from the WWW-Authenticate header for 401 responses or the Proxy-Authenticate header for 407 responses. The array is empty if the response doesn't include the corresponding header. Each object contains the following fields:

realm

A string that contains the realm of the challenge, or an empty string if the challenge has no realm.

scheme

A string that contains the authentication scheme, such as Basic.

bodySize

A non-negative integer that contains the size of the response body, in bytes, before the browser decodes it (for example, before decompression), or null if the browser doesn't report it. The body might not have arrived yet when this event fires, so the final size is available in the network.responseCompleted event.

bytesReceived

A non-negative integer that contains the total number of bytes received for the response, including its headers. It is 0 for a response served from the browser's cache.

content

An object that describes the decoded response body. It contains the following field:

size

A non-negative integer that contains the size of the response body in bytes after the browser decodes it (for example, after decompression).

fromCache

A boolean that indicates whether the browser served the response from its cache.

  • true: The browser served the response from its cache without contacting the server.
  • false: The browser didn't serve the response from its cache. This includes cases where it contacted the server to revalidate a cached response.
headers

An array of objects, each representing a header of the response. Each object contains the following fields:

name

A string that contains the header name, such as Content-Type.

value

An object that contains the header value. It contains the following fields:

type

A string that indicates how the header value is encoded. It has one of the following values:

  • base64: The value is Base64-encoded bytes because the bytes are not valid UTF-8.
  • string: The value is text decoded from UTF-8 bytes.
value

A string that contains the header value in the encoding specified by the type field.

headersSize

A non-negative integer that contains the size of the response headers, in bytes, as received, or null if the browser doesn't report it.

mimeType

A string that contains the MIME type that the browser uses for the response, such as text/html or application/json. The value doesn't include MIME type parameters. It can differ from the Content-Type header, for example when the browser determines the type from the content. It can also be an empty string, for example for a redirect response.

protocol

A string that contains the protocol of the response, such as http/1.1 or h2. For a response that wasn't received over HTTP, it is the scheme of the response URL, such as data.

status

A non-negative integer that contains the HTTP status code of the response, such as 200.

statusText

A string that contains the status message of the response, such as OK.

url

A string that contains the URL of the response.

timestamp

A non-negative integer that represents the time when the event was fired, as milliseconds elapsed since the epoch.

userContext Optional

A string that contains the ID of the user context in which the request was made, or null if the request wasn't made by a document in a context.

Description

In the lifecycle of a request, this event fires after network.beforeRequestSent and before network.responseCompleted, which fires when the browser has received the whole response body.

It also fires for redirect responses and for responses served from the browser's cache. If the request fails after this event, for example because the page aborts it, the network.fetchError event fires. For a response that asks for authentication, the network.authRequired event can follow.

At this point, the response object contains the status and the headers, but the fields that describe the body, such as bodySize, bytesReceived, and content, might not have their final values yet.

When isBlocked is true, the response waits until the client resumes it with the network.continueResponse, network.failRequest, or network.provideResponse command. Depending on the phases configured for each intercept, the browser can block a response when network.responseStarted fires regardless of whether it blocked the request when network.beforeRequestSent fired. It can also block the request when network.beforeRequestSent fires without blocking the response when network.responseStarted fires.

Examples

Receiving an event when response headers arrive

Assume you have a WebDriver BiDi connection, an active session, and a subscription to network.responseStarted.

Suppose a tab has loaded https://example.com/. The browser has a theme=dark cookie for the site. The page calls fetch("/api/items") to load a list of items as JSON. When the response headers arrive, the browser sends the following event (for brevity, the headers array in the request object has been shortened and some of its fields have been omitted):

json
{
  "type": "event",
  "method": "network.responseStarted",
  "params": {
    "context": "93ee5bd6-d256-4608-a002-9a8995cc0e5f",
    "isBlocked": false,
    "navigation": null,
    "redirectCount": 0,
    "request": {
      "cookies": [
        {
          "domain": "example.com",
          "httpOnly": false,
          "name": "theme",
          "path": "/",
          "sameSite": "lax",
          "secure": false,
          "size": 9,
          "value": {
            "type": "string",
            "value": "dark"
          }
        }
      ],
      "destination": "",
      "headers": [
        {
          "name": "Host",
          "value": {
            "type": "string",
            "value": "example.com"
          }
        },
        {
          "name": "Accept",
          "value": {
            "type": "string",
            "value": "*/*"
          }
        }
      ],
      "headersSize": 401,
      "initiatorType": "fetch",
      "method": "GET",
      "request": "b9e201af-6475-4bea-a174-51a8290f8087",
      "url": "https://example.com/api/items"
    },
    "response": {
      "bodySize": 0,
      "bytesReceived": 188,
      "content": {
        "size": 0
      },
      "fromCache": false,
      "headers": [
        {
          "name": "Cache-Control",
          "value": {
            "type": "string",
            "value": "no-store"
          }
        },
        {
          "name": "Content-Type",
          "value": {
            "type": "string",
            "value": "application/json"
          }
        },
        {
          "name": "Date",
          "value": {
            "type": "string",
            "value": "Tue, 13 Oct 2026 14:58:02 GMT"
          }
        },
        {
          "name": "Connection",
          "value": {
            "type": "string",
            "value": "keep-alive"
          }
        },
        {
          "name": "Keep-Alive",
          "value": {
            "type": "string",
            "value": "timeout=5"
          }
        },
        {
          "name": "Transfer-Encoding",
          "value": {
            "type": "string",
            "value": "chunked"
          }
        }
      ],
      "headersSize": 188,
      "mimeType": "application/json",
      "protocol": "http/1.1",
      "status": 200,
      "statusText": "OK",
      "url": "https://example.com/api/items"
    },
    "timestamp": 1791903482441,
    "userContext": "default"
  }
}

At this point, the browser has received the response headers but not necessarily the body. The final bytesReceived and body sizes are in the response object of the network.responseCompleted event with the same request ID.

Receiving an event for a response from the cache

Using the same connection, session, and subscription as in the first example, suppose the page fetches the same URL twice. The server allows the browser to cache the response for an hour (Cache-Control: max-age=3600). For the second request, the browser serves the response from its cache and sends the following event (only some of the fields are shown):

json
{
  "type": "event",
  "method": "network.responseStarted",
  "params": {
    "context": "93ee5bd6-d256-4608-a002-9a8995cc0e5f",
    "isBlocked": false,
    "navigation": null,
    "redirectCount": 0,
    "request": {
      "request": "37cf22b4-f399-4450-828d-d54fce56004e",
      "url": "https://example.com/api/categories"
    },
    "response": {
      "bytesReceived": 0,
      "fromCache": true,
      "status": 200,
      "url": "https://example.com/api/categories"
    },
    "timestamp": 1791903483454
  }
}

In the response object, fromCache is true and bytesReceived is 0 because nothing was received from the server.

Specifications

Specification
WebDriver BiDi
# event-network-responseStarted

Browser compatibility

See also