CARNETIA

API Documentation

Build with CARNETIA. Verify any agent in 1 HTTP call.

Last updated: April 28, 2026

Quick Start

The CARNETIA API is REST/JSON, public for verification, key-authenticated for management.

Base URL: https://carnetia.ai/api/v2

Format: JSON · Auth: Bearer token (Sanctum)

curl https://carnetia.ai/api/v2/health

Authentication

Public endpoints require no authentication. Authenticated endpoints use a Bearer token obtained via login:

curl -X POST https://carnetia.ai/api/v2/auth/token \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"...","device":"my-app"}'

Returns {"ok":true,"token":"1|xxx..."}

Use the token in subsequent requests:

curl https://carnetia.ai/api/v2/auth/me \
  -H "Authorization: Bearer 1|xxx..."

Endpoints

Public

Live Challenge (anti-impersonation)

The TOTP-based live challenge proves that whoever answers holds the agent's secret right now, not just that the agent is registered. It does not prove who operates the agent or how well it works. Codes rotate every 30 seconds (RFC 6238 with HMAC-SHA1).

Authenticated

How the Live Challenge works (3-step flow)

  1. Verifier wants to confirm the agent is real and alive. They open https://carnetia.ai/verify/{ID} or call GET /api/v2/challenge/{ID} to see if challenge is active.
  2. Verifier asks the agent over their existing channel (chat/voice/email): "What's your CARNETIA code right now?"
  3. Agent fetches their current code via GET /api/v2/agents/{ID}/code (using their API key) and replies. Verifier submits to POST /api/v2/verify-totp. Valid = proven aliveness.

Why it works: An impostor who doesn't have the agent's API key can't fetch the code. Codes expire in 30s, so replay attacks fail.

Code Examples

JavaScript

// Verify an agent
const res = await fetch(
  'https://carnetia.ai/api/v2/verify/CAR-2026-MX-1042-GP6X'
);
const { ok, agent } = await res.json();
if (ok && agent.status === 'active') {
  console.log('Verified:', agent.name);
}

Python

import requests

r = requests.get(
  'https://carnetia.ai/api/v2/verify/CAR-2026-MX-1042-GP6X'
)
data = r.json()
if data['ok'] and data['agent']['status'] == 'active':
    print(f"Verified: {data['agent']['name']}")

PHP

$json = file_get_contents(
  'https://carnetia.ai/api/v2/verify/CAR-2026-MX-1042-GP6X'
);
$data = json_decode($json, true);
if ($data['ok'] && $data['agent']['status'] === 'active') {
    echo "Verified: " . $data['agent']['name'];
}

cURL

curl https://carnetia.ai/api/v2/verify/CAR-2026-MX-1042-GP6X

Rate Limits

Exceeding limits returns HTTP 429.

Errors

All errors return JSON with ok: false:

{
  "ok": false,
  "error": "agent_not_found",
  "message": "The ID CAR-... does not exist."
}

SDKs

Official SDKs are in development:

Until then, use the REST API directly. Want early access to SDKs? Email [email protected].

Changelog

Need help?

Email [email protected] · Open an issue on GitHub