# Tell the server the popup's new size

> Tell the server the popup's new size: CustomDomain™ API reference in the cloud browser group. Covers parameters, request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/cloud-browser/browserSessionViewport

## `POST https://api.customdomain.ai/v1/browser-sessions/{sid}:viewport`

The popup's live area after a resize, a turn or full screen, in CSS pixels. Each side is clamped to 320 to 1600 wide and 400 to 1200 high and divided by the scale the session shows the provider's page at (the provider's fit for the kind of device the popup started as), and the page the customer sees is set to that size (device scale factor 1, not mobile) after a read that says the page is not loading; the view's `signals.viewport` reports it once it took, and `sign_in_viewport` is the new size. Allowed only while the customer is in control: signing in (a code or link wait included) or a page the agent handed back. At most 6 a minute per session; send one when a resize has settled.

### Authentication

`browserSession`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `sid` | path | string | yes | The cloud browser session id, `bs_` and 32 hex characters. |

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `w` | integer | yes | The live area's width; clamped to 320..1600. |
| `h` | integer | yes | The live area's height; clamped to 400..1200. |

### Responses

| Status | Description |
| --- | --- |
| `202` | The size the page is set to. |
| `400` | `invalid_request`: the body is not `{w, h}` with two whole numbers. |
| `401` | `browser_expired`: the token is wrong, expired, or for another session. |
| `404` | Error envelope: {code, title, details}. |
| `409` | `browser_wrong_state`: the agent has the page; the customer is not in control. |
| `410` | `browser_expired`: the session ran out of time. |
| `429` | `browser_rate_limited`: more than 6 in a minute for this session. |
| `503` | Error envelope: {code, title, details}. |

### `202` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `viewport` | object | yes | The remote screen's size in CSS pixels, sent with the live view: `sign_in_viewport` while the customer signs in (the size the popup last asked for with `:viewport`, when it did), `work_viewport` after. |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
