---
title: "Update layer"
method: PATCH
path: "/api/v2/projects/{projectKey}/layers/{layerKey}"
tags: ["Layers"]
---

# Update layer

`PATCH /api/v2/projects/{projectKey}/layers/{layerKey}`

Update a layer by adding, changing, or removing traffic reservations for experiments, or by changing layer name or description.
Updating a layer uses the semantic patch format.

To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch).

### Instructions

Semantic patch requests support the following `kind` instructions for updating layers.

<details>
<summary>Click to expand instructions for <strong>updating layers</strong></summary>

#### updateName

Updates the layer name.

##### Parameters

- `name`: The new layer name.

Here's an example:

```json
{
  "instructions": [{
      "kind": "updateName",
      "name": "New name"
  }]
}
```

#### updateDescription

Updates the layer description.

##### Parameters

- `description`: The new description.

Here's an example:

```json
{
  "instructions": [{
      "kind": "updateDescription",
      "description": "New description"
  }]
}
```

#### updateExperimentReservation

Adds or updates a traffic reservation for an experiment in a layer.

##### Parameters

- `experimentKey`: The key of the experiment whose reservation you are adding to or updating in the layer.
- `reservationPercent`: The amount of traffic in the layer to reserve. Must be an integer. Zero is allowed until iteration start.

Here's an example:

```json
{
  "environmentKey": "production",
  "instructions": [{
      "kind": "updateExperimentReservation",
      "experimentKey": "exp-key",
      "reservationPercent": 10
  }]
}
```

#### removeExperiment

Removes a traffic reservation for an experiment from a layer.

##### Parameters

- `experimentKey`: The key of the experiment whose reservation you want to remove from the layer.

Here's an example:

```json
{
  "environmentKey": "production",
  "instructions": [{
      "kind": "removeExperiment",
      "experimentKey": "exp-key"
  }]
}
```

</details>

## Path parameters

- `projectKey` string, string, required — The project key
- `layerKey` string, string, required — The layer key

## Request body

- LayerPatchInput
  - `comment` string — Optional comment describing the update
  - `environmentKey` string — The environment key used for making environment specific updates. For example, updating the reservation of an experiment
  - `instructions` Instruction[], required

## Response `200`

Layer response

- LayerRep
  - `key` string, required — The key of the layer
  - `name` string, required — The name of the layer
  - `description` string, required — The description of the layer
  - `createdAt` integer, required
  - `randomizationUnit` string — The unit of randomization for the layer
  - `environments` object — The layer configurations for each requested environment

## Other responses

- `400` — Invalid request
- `403` — Forbidden
- `404` — Invalid resource identifier
- `429` — Rate limited

---

[API](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/revisions/69c5c9aafe78/schema)
