Attachments

Get

Fetch a single attachment's metadata and bytes by ID. Bytes come back base64-encoded inside the JSON response — decode them to write to disk.

Returns the attachment record (metadata + raw bytes) for the given ID. Bytes are base64-encoded inside the JSON data field so the whole response is a single JSON document — no separate streaming endpoint.

GET /api/public/v1/attachments/{attachment_id}

Path parameters

Prop

Type

Example

# Fetch the JSON envelope and write the decoded bytes to disk
curl -s https://api.nairi.ai/api/public/v1/attachments/$ATTACHMENT_ID \
  -H "Authorization: Bearer $NAIRI_API_KEY" \
  | jq -r .data | base64 -d > out.bin
const res = await fetch(
  `https://api.nairi.ai/api/public/v1/attachments/${attachmentId}`,
  { headers: { Authorization: `Bearer ${process.env.NAIRI_API_KEY}` } },
);
const att = (await res.json()) as {
  id: string;
  filename: string;
  data: string; // base64
};
const bytes = Buffer.from(att.data, "base64");
require "net/http"
require "json"
require "uri"
require "base64"

uri = URI("https://api.nairi.ai/api/public/v1/attachments/#{attachment_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) }
att = JSON.parse(res.body)
bytes = Base64.decode64(att["data"])
import base64
import os
import requests

res = requests.get(
    f"https://api.nairi.ai/api/public/v1/attachments/{attachment_id}",
    headers={"Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}"},
)
att = res.json()
data = base64.b64decode(att["data"])
package main

import (
	"encoding/base64"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequest("GET",
		"https://api.nairi.ai/api/public/v1/attachments/"+os.Args[1], nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("NAIRI_API_KEY"))
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	var att struct {
		ID, Filename, Data string
	}
	json.NewDecoder(res.Body).Decode(&att)
	bytes, _ := base64.StdEncoding.DecodeString(att.Data)
	fmt.Printf("got %d bytes (%s)\n", len(bytes), att.Filename)
}

Response

{
  "id": "att_01KRK1V46BXS73CSNK2VR35NPJ",
  "organization_id": "org_01KQ...",
  "type": "temporary",
  "data": "iVBORw0KGgoAAAANSUhEUgAAA...",
  "filename": "screenshot.png",
  "created_at": "2026-05-27T08:31:14Z",
  "updated_at": "2026-05-27T08:31:14Z"
}

Attachments are scoped to the org that uploaded them. Trying to fetch an ID belonging to a different org returns 404 attachment not found.

On this page