Agents

Create

Create a new agent.

POST /api/public/v1/agents

Request body

Prop

Type

Example

curl -X POST https://api.nairi.ai/api/public/v1/agents \
  -H "Authorization: Bearer $NAIRI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My New Agent",
    "instances_count": 1
  }'
const res = await fetch("https://api.nairi.ai/api/public/v1/agents", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "My New Agent",
    instances_count: 1,
  }),
});
const data = (await res.json()) as { agent_id: string };
require "net/http"
require "json"
require "uri"

uri = URI("https://api.nairi.ai/api/public/v1/agents")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['NAIRI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = { name: "My New Agent", instances_count: 1 }.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(
    "https://api.nairi.ai/api/public/v1/agents",
    headers={
        "Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "name": "My New Agent",
        "instances_count": 1,
    },
)
data = res.json()
package main

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

func main() {
	body, _ := json.Marshal(map[string]any{
		"name":            "My New Agent",
		"instances_count": 1,
	})
	req, _ := http.NewRequest("POST", "https://api.nairi.ai/api/public/v1/agents", 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

{
  "id": "cci_01KRB300FK14FRRSMDHRB4NG3T",
  "name": "My New Agent",
  "agent_id": "my-new-agent",
  "instances_count": 1,
  "description": "",
  "is_self_hosted": false,
  "system_prompt": null,
  "created_at": "2026-04-12T18:45:12.000Z",
  "updated_at": "2026-04-12T18:45:12.000Z"
}

On this page