---
title: "Create Trajectory Route"
method: POST
path: "/api/v1/trajectories"
tags: ["trajectories"]
---

# Create Trajectory Route

`POST /api/v1/trajectories`

Reuse a session-key trajectory; otherwise authenticate and create a new trajectory.

## Headers

- `Idempotency-Key` string, nullable
- `X-API-Key` string, nullable

## Request body

- CreateTrajectoryRequest
  - `agent_id` string, nullable — Optional agent ID to associate with the trajectory. When omitted for a new trajectory, no agent is assigned. When a Model Endpoint session token references an existing trajectory, omitting this field leaves its existing agent association unchanged.

## Response `201`

Successful Response

- CreateTrajectoryResponse
  - `tid` string, required — ID of the created or existing trajectory.

## Changes

- **2026-09-25** `ae26a0c95c43` — 1 warning, 2 info
  - deleted the `header` request parameter `x-model-endpoint-access-token`
  - the endpoint scheme security `ModelEndpointAccessToken` was removed from the API
  - added the new optional `header` request parameter `X-API-Key`
- **2026-09-23** `1f15ecf92088` — 3 info
  - the endpoint scheme security `ModelEndpointAccessToken` was added to the API
  - added the new optional `header` request parameter `x-model-endpoint-access-token`
  - added optional request body
- **2026-09-22** `aea928d034f7` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/trajectory/apis/trajectory-api/changes/api/v1/trajectories/post.md)

---

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