---
title: "set a scenario's state, optionally scheduling a timed auto-transition"
method: PUT
path: "/mockserver/scenario/{name}"
tags: ["scenario"]
---

# set a scenario's state, optionally scheduling a timed auto-transition

`PUT /mockserver/scenario/{name}`

## Request

- Base URL: `http://localhost:1080`
- URL: `http://localhost:1080/mockserver/scenario/{name}`
- Auth: none declared

Sets the named scenario to the given state immediately. Optionally schedules a timed auto-transition to nextState after transitionAfterMs milliseconds; the transition only fires if the scenario is still in the set state when the timer expires, and scheduling a new transition cancels any pending one.

## Path parameters

- `name` string, required

## Request body

- object
  - `state` string, required: the state to set immediately
  - `transitionAfterMs` integer: delay in milliseconds before auto-transitioning to nextState (requires nextState)
  - `nextState` string: the state to auto-transition to after transitionAfterMs (requires transitionAfterMs)

## Response `200`

scenario state set

- object
  - `scenarioName` string
  - `currentState` string
  - `nextState` string
  - `transitionAfterMs` integer

## Other responses

- `400`: invalid request (e.g. missing scenario name or state field)

---

[API](https://skmtc.dev/mock-server/apis/mockserver-api.md) · [All operations](https://skmtc.dev/mock-server/apis/mockserver-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mock-server/apis/mockserver-api/revisions/9239b693996e?raw)
