---
name: "X-Up-Accept-Layer"
area: "API"
kind: "HTTP header"
parent: "up.protocol module"
url: "https://unpoly.com/api/X-Up-Accept-Layer"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.protocol module](https://unpoly.com/api/up.protocol.md)</nav>

# X-Up-Accept-Layer

The server may set this response header to [accept](https://unpoly.com/api/up.layer.accept.md) the targeted overlay in response to a fragment update.

Upon seeing the header, Unpoly will cancel the fragment update and accept the layer instead.

The header value is the acceptance value serialized as a [relaxed JSON](https://unpoly.com/api/relaxed-json.md) value. To accept an overlay without value, set the header value to the string `null`.

> #### Important
>
> HTTP headers [may only contain US-ASCII (7-bit) characters](https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4). If you have higher code points in a JSON value, you may [encode those characters using Unicode escape sequences](https://makandracards.com/makandra/536174-http-headers-can-only-transport-us-ascii-characters-safely).

## Example {#example}

The response below will accept the targeted overlay with the value `{ user_id: 1012 }`:

```http
Content-Type: text/html
X-Up-Accept-Layer: { user_id: 1012 }

<html>
  ...
</html>
```

## Rendering content {#rendering-content}

The response may contain `text/html` content. If the root layer is targeted, the `X-Up-Accept-Layer` header is ignored and the fragment is updated with the response's HTML content.

If you know that an overlay will be closed and don't want to render HTML, have the server change the render target to [`:none`](https://unpoly.com/api/none.md):

```http
Content-Type: text/html
X-Up-Accept-Layer: { user_id: 1012 }
X-Up-Target: :none
```

