> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crewship.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Thread

> Create a new thread for a deployment

## Request

<ParamField body="deployment_id" type="string" required>
  Deployment ID to scope this thread to
</ParamField>

<ParamField body="metadata" type="object">
  User-defined metadata (e.g., user ID, session info)
</ParamField>

<ParamField body="values" type="object">
  Initial thread state values
</ParamField>

## Response

<ResponseField name="thread_id" type="string">
  Thread ID (e.g., `thr_abc123xyz`)
</ResponseField>

<ResponseField name="deployment_id" type="string">
  Deployment ID
</ResponseField>

<ResponseField name="status" type="string">
  Thread status: `idle`
</ResponseField>

<ResponseField name="metadata" type="object">
  User-defined metadata
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.crewship.dev/v1/threads \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "deployment_id": "dep_abc123",
      "metadata": {"user_id": "user_1"}
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "thread_id": "thr_xyz789abc",
    "deployment_id": "dep_abc123",
    "status": "idle",
    "metadata": {"user_id": "user_1"},
    "values": null,
    "created_at": "2024-01-15T10:35:00Z",
    "updated_at": "2024-01-15T10:35:00Z"
  }
  ```
</ResponseExample>
