## API Reference

The SwarmRecall REST API is organized around resource modules. All endpoints accept and return JSON. Authentication is via Bearer token (either an agent API key or a Firebase ID token).

Base URL: https://api.swarmrecall.ai (production) or http://localhost:3300 (local development)

## Authentication

All requests must include an Authorization header:

Authorization: Bearer <token>

Agent API keys are used for agent-to-service calls. Firebase ID tokens are used for dashboard (owner) calls.

## Registration

Agent self-registration and claim flow.

POST /api/v1/register

Register a new agent. No auth required.

FieldTypeDescription
namestringDisplay name for the agent
platformstringOptional. Platform identifier (e.g. "swarmclaw")

Response: agentId, apiKey, claimCode

POST /api/v1/claim

Claim an agent. Requires Firebase ID token.

FieldTypeDescription
claimCodestringThe claim code from agent registration

Response: agentId, ownerId

## Memory

Store and retrieve agent memories with semantic search.

POST /api/v1/memory

Store a memory. Requires agent API key.

FieldTypeDescription
contentstringThe memory content to store
tagsstring[]Optional. Tags for filtering
metadataobjectOptional. Arbitrary key-value metadata

GET /api/v1/memory/search?q=<query>

Semantic search across memories. Requires agent API key.

ParamTypeDescription
qstringSearch query
limitnumberOptional. Max results (default 10)
tagsstringOptional. Comma-separated tag filter

GET /api/v1/memory/:id

Get a specific memory by ID.

DELETE /api/v1/memory/:id

Delete a specific memory.

## Knowledge

Entity and relationship graph management.

POST /api/v1/knowledge/entities

Create or update an entity.

FieldTypeDescription
namestringEntity name
typestringEntity type (e.g. "person", "concept")
propertiesobjectOptional. Entity properties

POST /api/v1/knowledge/relations

Create a relationship between entities.

FieldTypeDescription
fromEntityIdstringSource entity ID
toEntityIdstringTarget entity ID
typestringRelationship type (e.g. "knows", "uses")

GET /api/v1/knowledge/entities

List all entities. Supports ?type= filter.

GET /api/v1/knowledge/entities/:id

Get entity with its relations.

GET /api/v1/knowledge/search?q=<query>

Search across entities and relations.

## Learnings

Pattern extraction and distilled insights.

POST /api/v1/learnings

Store a learning.

FieldTypeDescription
contentstringThe learning content
categorystringOptional. Category (e.g. "success", "failure", "pattern")
confidencenumberOptional. Confidence score 0-1

GET /api/v1/learnings

List learnings. Supports ?category= and ?limit= filters.

GET /api/v1/learnings/search?q=<query>

Semantic search across learnings.

## Skills

Agent skill registry.

POST /api/v1/skills

Register a skill.

FieldTypeDescription
namestringSkill name
descriptionstringWhat the skill does
versionstringOptional. Semantic version
schemaobjectOptional. JSON schema for skill parameters

GET /api/v1/skills

List all skills for the agent.

GET /api/v1/skills/:id

Get a specific skill.

DELETE /api/v1/skills/:id

Remove a skill.

## Owners

Owner (dashboard user) management. Requires Firebase token.

GET /api/v1/owners/me

Get the current owner profile.

GET /api/v1/owners/me/agents

List all agents owned by the current user.

## Agents

Agent management endpoints.

GET /api/v1/agents/:id

Get agent details. Requires owner token or agent API key.

PATCH /api/v1/agents/:id

Update agent settings. Requires owner token.

DELETE /api/v1/agents/:id

Delete an agent and all its data. Requires owner token.

## API Keys

Manage API keys. Requires Firebase token.

POST /api/v1/api-keys

Create a new API key.

FieldTypeDescription
namestringDisplay name for the key
agentIdstringOptional. Scope to a specific agent

GET /api/v1/api-keys

List all API keys.

DELETE /api/v1/api-keys/:id

Revoke an API key.