API Reference

Complete REST API documentation. Base URL: https://agenthistory.ai

Records API

Manage agent records (memory containers).

Create Record

Free
POST /api/v1/records
Content-Type: application/json
Authorization: Bearer <agentKey>

{
  "name": "MyAgent",
  "tags": ["assistant", "coding"],
  "category": "personal"
}

Response:

{
  "success": true,
  "data": {
    "id": "rec_01jx8a7qz2...",
    "name": "MyAgent",
    "tags": ["assistant", "coding"],
    "category": "personal",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

Request Body

FieldTypeRequiredDescription
namestringYesRecord name (1-128 chars)
tagsstring[]NoTags for categorization (max 10)
categorystringNoCategory (max 32 chars, default: "general")
parentRecordIdstringNoParent record for hierarchies

List Records

Free
GET /api/v1/records?limit=20&offset=0
Authorization: Bearer <agentKey>

Get Record

Free
GET /api/v1/records/{recordId}
Authorization: Bearer <agentKey>

Update Record

Free
PATCH /api/v1/records/{recordId}
Content-Type: application/json
Authorization: Bearer <agentKey>

{
  "name": "UpdatedName",
  "tags": ["new-tag"]
}

Delete Record

Free
DELETE /api/v1/records/{recordId}
Authorization: Bearer <agentKey>

Memory API

Store, search, and retrieve memories.

Recall (Semantic Search)

$0.05/query
POST /api/v1/records/{recordId}/recall
Content-Type: application/json
Authorization: Bearer <agentKey>

{
  "query": "user preferences for morning meetings",
  "limit": 10,
  "types": ["fact", "relationship"]
}

Response:

{
  "success": true,
  "data": {
    "memories": [
      {
        "id": "mem_...",
        "path": "relationships/john-smith",
        "type": "relationship",
        "summary": "John Smith prefers morning appointments",
        "similarity": 0.92
      }
    ],
    "count": 1
  }
}

Request Body

FieldTypeRequiredDescription
querystringYesSearch query (1-1000 chars)
limitnumberNoMax results (1-50, default: 10)
typesstring[]NoFilter by memory types

Remember (Store Memory)

$0.05/write
POST /api/v1/records/{recordId}/remember
Content-Type: application/json
Authorization: Bearer <agentKey>

{
  "content": "John Smith prefers morning appointments before 10am",
  "type": "relationship",
  "path": "relationships/john-smith"
}

Response:

{
  "success": true,
  "data": {
    "id": "mem_...",
    "path": "relationships/john-smith",
    "type": "relationship",
    "summary": "John Smith prefers morning appointments"
  }
}

Request Body

FieldTypeRequiredDescription
contentstringYesMemory content (1-50KB)
typestringNoMemory type (auto-classified if omitted)
pathstringNoStorage path (max 256 chars)
idempotency_keystringNoPrevent duplicate writes

Read File

$0.05/file
GET /api/v1/records/{recordId}/read?path=config/settings
Authorization: Bearer <agentKey>

Response:

{
  "success": true,
  "data": {
    "content": "{ \"theme\": \"dark\", \"language\": \"en\" }",
    "path": "config/settings"
  }
}

Write File

$0.05/file
POST /api/v1/records/{recordId}/write
Content-Type: application/json
Authorization: Bearer <agentKey>

{
  "path": "config/settings",
  "content": "{ \"theme\": \"dark\", \"language\": \"en\" }"
}

Response:

{
  "success": true,
  "data": {
    "path": "config/settings",
    "contentHash": "abc123..."
  }
}

Request Body

FieldTypeRequiredDescription
pathstringYesFile path (max 256 chars)
contentstringYesFile content (max 1MB)
idempotency_keystringNoPrevent duplicate writes

Get Full Context

$0.05/request
GET /api/v1/records/{recordId}/context
Authorization: Bearer <agentKey>

Response:

{
  "success": true,
  "data": {
    "identity": [...],
    "fact": [...],
    "relationship": [...],
    "episode": [...],
    "skill": [...]
  }
}

Raw Blob Access (LOCAL Mode)

Free
POST /api/v1/records/{recordId}/raw
GET /api/v1/records/{recordId}/raw
Authorization: Signature <sig>

Direct blob storage for LOCAL mode with wallet signature authentication.


Agent API

Create and manage agents.

Create Agent

Free
POST /api/v1/agents
Content-Type: application/json

{
  "name": "MyAgent",
  "mode": "cloud"
}

Response:

{
  "success": true,
  "data": {
    "agentKey": "aht_live_...",
    "recordId": "rec_...",
    "walletAddress": "0x...",
    "mode": "cloud"
  }
}

Request Body

FieldTypeRequiredDescription
namestringYesAgent name (1-128 chars)
modestringNo"local" or "cloud" (default: "cloud")
tagsstring[]NoTags for categorization
categorystringNoAgent category (default: "agent")

Get Agent

Free
GET /api/v1/agents
Authorization: Bearer <agentKey>

Error Responses

All errors follow this format:

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Content is required"
  }
}

Error Codes

CodeHTTP StatusDescription
VALIDATION_ERROR400Invalid request body
UNAUTHORIZED401Missing or invalid authentication
FORBIDDEN403Insufficient permissions
NOT_FOUND404Resource not found
RATE_LIMITED429Too many requests
PAYMENT_REQUIRED402Insufficient payment
INTERNAL_ERROR500Server error

Rate Limits

EndpointLimit
All endpoints100 requests/minute per agent
Remember/Write30 writes/minute per record
Recall/Context60 queries/minute per record

See Pricing for operation costs or Authentication for auth details.