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

# Create Thread

Creates a new conversation thread with the specified agent.

<ParamField body="agent_id" type="string" required>
  The name of the agent to use for this thread. Must match an agent defined in `agents/agents/`.
</ParamField>

<ParamField body="user_id" type="string">
  Optional user identifier for tracking and authorization.
</ParamField>

<ParamField body="tags" type="array">
  Optional array of string tags for categorizing and filtering threads.
</ParamField>

<ResponseField name="threadId" type="string" required>
  Unique thread identifier (UUID)
</ResponseField>

<ResponseField name="agent_id" type="string" required>
  The agent name associated with this thread
</ResponseField>

<ResponseField name="message" type="string" required>
  Confirmation message
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://your-worker.workers.dev/api/threads \
    -H "Content-Type: application/json" \
    -d '{
      "agent_id": "support_agent",
      "user_id": "user_abc123",
      "tags": ["support", "web"]
    }'
  ```

  ```typescript JavaScript theme={null}
  const response = await fetch('https://your-worker.workers.dev/api/threads', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      agent_id: 'support_agent',
      user_id: 'user_abc123',
      tags: ['support', 'web']
    })
  });
  const thread = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "threadId": "550e8400-e29b-41d4-a716-446655440000",
    "agent_id": "support_agent",
    "message": "Thread created successfully"
  }
  ```
</ResponseExample>
