Conversations

Continue

Append another user message to a running conversation.

Appends another user message to a running job.

POST /api/public/v1/conversations/{job_id}/continue

Request body

Prop

Type

Example

curl -X POST https://api.nairi.ai/api/public/v1/conversations/JOB_ID/continue \
  -H "Authorization: Bearer $NAIRI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Additional instructions"
  }'
const res = await fetch(
  `https://api.nairi.ai/api/public/v1/conversations/${jobId}/continue`,
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ prompt: "Additional instructions" }),
  },
);
const data = (await res.json()) as { job_id: string; message_id: string };
require "net/http"
require "json"
require "uri"

uri = URI("https://api.nairi.ai/api/public/v1/conversations/#{job_id}/continue")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['NAIRI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = { prompt: "Additional instructions" }.to_json

res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
data = JSON.parse(res.body)
import os
import requests

res = requests.post(
    f"https://api.nairi.ai/api/public/v1/conversations/{job_id}/continue",
    headers={
        "Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={"prompt": "Additional instructions"},
)
data = res.json()
package main

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

func main() {
	jobID := os.Getenv("JOB_ID")
	body, _ := json.Marshal(map[string]any{"prompt": "Additional instructions"})
	req, _ := http.NewRequest(
		"POST",
		"https://api.nairi.ai/api/public/v1/conversations/"+jobID+"/continue",
		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)
}

Response: 201 Created

A new message resource is created on the job, so the response is 201 Created (not 200 OK).

{
  "job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
  "message_id": "cmsg_01KRK1WBPN3GSE0VWYTH4ZPN3R"
}

Error responses

HTTPBodyWhen
404{"error":"job not found"}The job_id does not exist in the calling organization.
400{"error":"job is not an API job"}The job was created via Slack, Discord, or the web UI. Only jobs started through POST /conversations/start can be continued via the API.
400{"error":"prompt is required"}The request body is missing prompt.

On this page