# Start

Create a new conversation and dispatch the first message to an agent.





Creates a new job and dispatches the first message to an available agent.

```http
POST /api/public/v1/conversations/start
```

## Request body [#request-body]

<TypeTable
  type="{
  agent_id: {
    type: &#x22;string&#x22;,
    required: true,
    description: &#x22;Identifier of the agent. Accepts either the ULID (`cci_...`) or the human-readable slug (the `agent_id` field from `GET /agents`).&#x22;
  },
  prompt: {
    type: &#x22;string&#x22;,
    required: true,
    description: &#x22;The user prompt to send to the agent.&#x22;
  },
  ask_mode: {
    type: &#x22;boolean&#x22;,
    default: &#x22;false&#x22;,
    description: &#x22;If true, the agent runs in read-only ask mode (no tool execution).&#x22;
  }
}"
/>

## Example [#example]

<Tabs items="[&#x22;bash&#x22;, &#x22;TypeScript&#x22;, &#x22;Ruby&#x22;, &#x22;Python&#x22;, &#x22;Go&#x22;]">
  <Tab value="bash">
    ```bash
    curl -X POST https://api.nairi.ai/api/public/v1/conversations/start \
      -H "Authorization: Bearer $NAIRI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "agent_id": "my-agent",
        "prompt": "Your task description",
        "ask_mode": false
      }'
    ```
  </Tab>

  <Tab value="TypeScript">
    ```ts
    const res = await fetch(
      "https://api.nairi.ai/api/public/v1/conversations/start",
      {
        method: "POST",
        headers: {
          Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          agent_id: "my-agent",
          prompt: "Your task description",
          ask_mode: false,
        }),
      },
    );
    const data = (await res.json()) as { job_id: string; message_id: string };
    ```
  </Tab>

  <Tab value="Ruby">
    ```ruby
    require "net/http"
    require "json"
    require "uri"

    uri = URI("https://api.nairi.ai/api/public/v1/conversations/start")
    req = Net::HTTP::Post.new(uri)
    req["Authorization"] = "Bearer #{ENV['NAIRI_API_KEY']}"
    req["Content-Type"] = "application/json"
    req.body = {
      agent_id: "my-agent",
      prompt: "Your task description",
      ask_mode: false,
    }.to_json

    res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
    data = JSON.parse(res.body)
    ```
  </Tab>

  <Tab value="Python">
    ```python
    import os
    import requests

    res = requests.post(
        "https://api.nairi.ai/api/public/v1/conversations/start",
        headers={
            "Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}",
            "Content-Type": "application/json",
        },
        json={
            "agent_id": "my-agent",
            "prompt": "Your task description",
            "ask_mode": False,
        },
    )
    data = res.json()
    ```
  </Tab>

  <Tab value="Go">
    ```go
    package main

    import (
    	"bytes"
    	"encoding/json"
    	"fmt"
    	"io"
    	"net/http"
    	"os"
    )

    func main() {
    	body, _ := json.Marshal(map[string]any{
    		"agent_id": "my-agent",
    		"prompt":   "Your task description",
    		"ask_mode": false,
    	})
    	req, _ := http.NewRequest(
    		"POST",
    		"https://api.nairi.ai/api/public/v1/conversations/start",
    		bytes.NewReader(body),
    	)
    	req.Header.Set("Authorization", "Bearer "+os.Getenv("NAIRI_API_KEY"))
    	req.Header.Set("Content-Type", "application/json")
    	res, _ := http.DefaultClient.Do(req)
    	defer res.Body.Close()
    	raw, _ := io.ReadAll(res.Body)
    	var data map[string]any
    	json.Unmarshal(raw, &data)
    	fmt.Println(data)
    }
    ```
  </Tab>
</Tabs>

## Response [#response]

```json
{
  "job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
  "message_id": "cmsg_01KRK1V475HBTME8QJQMAPWK16"
}
```

<Callout type="info">
  Only API-started jobs can be continued via the API. Trying to continue a job created from Slack, Discord, or the web UI returns `400 job is not an API job`.
</Callout>
