---
title: "Create Task State"
method: POST
path: "/states"
tags: ["States"]
---

# Create Task State

`POST /states`

## Request body

- CreateStateRequest
  - `agent_id` string, required
  - `state` object, required
  - `task_id` string, required

## Response `200`

Successful Response

- State — Represents a state in the agent system. A state is associated uniquely with a task and an agent. This entity is used to store states in MongoDB, with each state associated with a specific task and agent. The combination of task_id and agent_id is globally unique. The state is a dictionary of arbitrary data.
  - `agent_id` string, required
  - `created_at` string, date-time, required — The timestamp when the state was created
  - `id` string, required — The task state's unique id
  - `state` object, required
  - `task_id` string, required
  - `updated_at` string, date-time, nullable — The timestamp when the state was last updated

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/terminaluse/apis/sb0-api.md) · [All operations](https://skmtc.net/terminaluse/apis/sb0-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/terminaluse/sb0-api/revisions/f24a474dc415/schema)
