# Stateful mocking

> Build CRUD, counters, queues, carts, sessions, collections, TTLs, snapshots, and state machines.

- Canonical URL: https://dotmock.com/docs/guides/stateful-mocking
- Capability status: Available
- Last verified: 2026-07-24

## Prerequisites
- A DotMock workspace you can access
- The API ID in $API_ID and its published runtime URL in $MOCK_URL when the example calls the mock

## In this guide
- Choose the resource by behavior
- Use the narrowest useful scope
- Understand the atomic execution order
- Use proven state patterns
- Manage live values without surprises
- Preview the exact diff

## Verified boundaries
- Restoring or resetting live state is destructive and requires explicit authorization.

Read the canonical guide for its complete examples and expected results: https://dotmock.com/docs/guides/stateful-mocking
