Rules
Get
Fetch a single Nairi rule by its ID, including the full markdown content, title, description, and timestamps. Use to inspect or back up rule contents.
Returns the rule with its full content. Timestamps are omitted on this endpoint.
GET /api/public/v1/artifacts/rules/{rule_id}Example
curl -X GET https://api.nairi.ai/api/public/v1/artifacts/rules/RULE_ID \
-H "Authorization: Bearer $NAIRI_API_KEY"const res = await fetch(`https://api.nairi.ai/api/public/v1/artifacts/rules/${ruleId}`, {
headers: {
Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
},
});
const rule = await res.json();require "net/http"
require "json"
require "uri"
uri = URI("https://api.nairi.ai/api/public/v1/artifacts/rules/#{rule_id}")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['NAIRI_API_KEY']}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
rule = JSON.parse(res.body)import os
import requests
res = requests.get(
f"https://api.nairi.ai/api/public/v1/artifacts/rules/{rule_id}",
headers={"Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}"},
)
rule = res.json()package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
func main() {
ruleID := os.Getenv("RULE_ID")
req, _ := http.NewRequest("GET", "https://api.nairi.ai/api/public/v1/artifacts/rules/"+ruleID, nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("NAIRI_API_KEY"))
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
raw, _ := io.ReadAll(res.Body)
var rule map[string]any
json.Unmarshal(raw, &rule)
fmt.Println(rule)
}Response
{
"id": "aar_01KJWRKX0ZNZP91YG3Q353776Q",
"title": "Code Style Rules",
"description": "Guidelines for code formatting",
"content": "Always use 2-space indentation..."
}Create
Create a new rule in your Nairi organization with a title, description, and markdown content. Returns the rule ID, ready to attach to one or more agents.
Update
Full replace of a Nairi rule by its ID — every field is required. Use the partial update endpoints instead if you only need to change one or two fields.