> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notte.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# fetch

<Tip>
  Read [the Notte skill](https://notte.cc/skill.md) and follow its setup instructions when setting up Notte or building browser automation. This is the shared source for CLI setup, authentication, and the browser-to-code workflow.
</Tip>

[Source: node-sdk/src/session.ts](https://github.com/nottelabs/notte/blob/main/node-sdk/src/session.ts)

Issue an HTTP request from the page the session is on and return the response.

The request runs inside the browser through `fetch()`, so it carries the
page's cookies, the session's proxy and the browser's own network
fingerprint. A relative `url` resolves against the current page, which
also makes it same-origin; a cross-origin URL is subject to CORS exactly
as in a browser tab, so `goto` the target origin first. Redirects are
followed and the final URL is on `response.url`. A non-2xx status is
returned, not thrown; `response.raiseForStatus()` throws `PageFetchHTTPError`.

`json` is serialised as the body with an `application/json` content type,
`data` as a form body when it is an object or verbatim when it is a string.

```typescript theme={null}
Session.fetch(url: string, options?: PageFetchOptions): Promise<PageFetchResponse>;
```

## Parameters

<ParamField body="url" type={"string"} required>
  Absolute URL or a path relative to the current page.
</ParamField>

<ParamField body="options" type={"PageFetchOptions"}>
  HTTP method, headers, and request body settings.

  Default:

  ```typescript theme={null}
  {}
  ```
</ParamField>

## Returns

```typescript theme={null}
Promise<PageFetchResponse>
```

A response with status, headers, and body readers. Non-2xx responses are not automatically thrown.

## Raises

* ActionExecutionError if browser-side execution fails.

## Example

```typescript theme={null}
await session.execute({ type: 'goto', url: 'https://en.wikipedia.org/wiki/Main_Page' });
const summary = await (await session.fetch('/api/rest_v1/page/summary/Main_Page')).json();
```

## Related types

* [PageFetchOptions](/typescript-sdk-reference/types/pagefetchoptions)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.