---
title: "Change a layer's stacking order"
method: POST
path: "/designs/{uid}/layers/{layerId}/z-index"
tags: ["Design authoring"]
---

# Change a layer's stacking order

`POST /designs/{uid}/layers/{layerId}/z-index`

## Request

- Base URL: `https://api.dynapictures.com`
- URL: `https://api.dynapictures.com/designs/{uid}/layers/{layerId}/z-index`
- Auth: HTTP bearer

Moves a layer in front of or behind the others.

## Path parameters

- `uid` string, required
- `layerId` string, required

## Request body

- ReorderLayerRequest: Send `op` or `zIndex`.
  - `op` 'toFront' | 'toBack' | 'up' | 'down': Move the layer relative to the others. Takes precedence over `zIndex`.
  - `zIndex` integer: An absolute stacking position.

## Response `200`

The moved layer.

- LayerResult
  - `designUid` string, required: The ID of the design.
  - `layer` object, required: The layer as stored in the design.

## Other responses

- `400`: The request is invalid. `message` says why.
- `401`: The API key is missing or wrong.
- `403`: The plan limit is reached, the trial has expired, or the key has no access to this resource.
- `404`: The resource does not exist, or the key has no access to it.

---

[API](https://skmtc.dev/dynapictures/apis/dynapictures-api.md) - [All operations](https://skmtc.dev/dynapictures/apis/dynapictures-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dynapictures/apis/dynapictures-api/revisions/a9820777cfb3?raw)
