HeroBrain API Reference
The HeroBrain API is a REST API that enables developers to programmatically interact with memory data. It provides endpoints for creating, reading, updating, and searching memories, as well as managing API keys and webhooks.Base URL
Authentication
All API requests require authentication. HeroBrain supports two authentication methods:Bearer Token Authentication
Include your API key in theAuthorization header:
Clerk JWT Authentication
For server-side requests from authenticated users:Rate Limiting
API requests are rate limited based on your plan:- Free tier: 1,000 requests per month
- Pro tier: 100,000 requests per month
- Enterprise: Custom limits
Response Format
All API responses follow a consistent format:Success Response
Error Response
Error Codes
| Code | HTTP Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Request validation failed |
AUTH_REQUIRED | 401 | Authentication required |
AUTH_INVALID | 401 | Invalid authentication token |
TENANT_MISMATCH | 403 | Resource belongs to different tenant |
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
RESOURCE_NOT_FOUND | 404 | Requested resource not found |
DUPLICATE_RESOURCE | 409 | Resource already exists |
INSUFFICIENT_QUOTA | 402 | Usage quota exceeded |
DATABASE_ERROR | 500 | Database operation failed |
EXTERNAL_SERVICE_ERROR | 502 | External service error |
Core Resources
Memories
The memory resource represents individual pieces of information stored in HeroBrain.Memory Object
Memory Types
episodic: Personal experiences and eventssemantic: Factual knowledge and conceptsprocedural: How-to knowledge and processesworking: Temporary working memoryprospective: Future plans and intentionsemotional: Emotional experiences and statescontextual: Current context and environmentidentity: Personal identity and traitsrelational: Relationships and social connectionsevent: Calendar events and occurrencespredictive: Predictions and forecaststask: Tasks and action itemsdecision: Decision-making processes
Endpoints
Create a Memory
Creates a new memory in your tenant.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | The memory content (1-10000 characters) |
type | string | Yes | Memory type (see valid types above) |
importance | number | No | Importance score (0.0-1.0, default: 0.5) |
tags | string[] | No | Array of tags |
metadata | object | No | Additional metadata |
tenantId | string | Yes | Your tenant ID |
Example Request
Example Response
Retrieve a Memory
Retrieves a specific memory by ID.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The memory ID |
tenantId | string | Yes | Your tenant ID (query parameter) |
Example Request
List Memories
Returns a paginated list of memories.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tenantId | string | Yes | Your tenant ID |
page | number | No | Page number (default: 1) |
limit | number | No | Items per page (default: 50, max: 100) |
type | string | No | Filter by memory type |
tags | string | No | Filter by tags (comma-separated) |
sort | string | No | Sort field: createdAt, importance, updatedAt |
order | string | No | Sort order: asc, desc (default: desc) |
Example Request
Example Response
Update a Memory
Updates an existing memory.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The memory ID |
content | string | No | Updated content |
importance | number | No | Updated importance (0.0-1.0) |
tags | string[] | No | Updated tags |
metadata | object | No | Updated metadata |
Example Request
Delete a Memory
Deletes a memory permanently.Example Request
Search Memories
Performs semantic search across memories.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query |
tenantId | string | Yes | Your tenant ID |
limit | number | No | Max results (default: 20, max: 100) |
type | string | No | Filter by memory type |
minRelevance | number | No | Minimum relevance score (0.0-1.0) |
tags | string[] | No | Filter by tags |
Example Request
Example Response
API Key Management
Create an API Key
Creates a new API key for programmatic access.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Key name (1-255 characters) |
tenantId | string | Yes | Your tenant ID |
environment | string | No | development or production (default: production) |
scopes | string[] | No | Permissions: read:memories, write:memories |
expiresAt | number | No | Expiration timestamp |
Example Request
Example Response
plainKey field is only returned once. Store it securely immediately.
List API Keys
Retrieves all API keys for your tenant.Example Request
Revoke an API Key
Revokes an API key, making it unusable.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
keyId | string | Yes | The API key ID to revoke |
tenantId | string | Yes | Your tenant ID |
Example Request
Webhooks
Create a Webhook
Registers a webhook endpoint for event notifications.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Webhook name |
url | string | Yes | HTTPS endpoint URL |
events | string[] | Yes | Events to subscribe to |
secret | string | Yes | Secret for signature verification |
status | string | No | active or inactive (default: active) |
Supported Events
memory.createdmemory.updatedmemory.deletedsearch.performedapi_key.createdapi_key.revoked
Example Request
Example Webhook Payload
List Webhooks
Retrieves all webhooks for your tenant.Test a Webhook
Sends a test payload to your webhook endpoint.Intelligence Features
Cross-Memory Reasoning
Analyzes relationships between memories to reconstruct decision-making processes.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
topic | string | Yes | Topic to analyze |
tenantId | string | Yes | Your tenant ID |
timeRange | object | No | Date range to analyze |
Example Request
Pattern Detection
Discovers implicit patterns in your memory data.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tenantId | string | Yes | Your tenant ID |
minOccurrences | number | No | Minimum pattern occurrences (default: 3) |
Usage & Billing
Get Usage Metrics
Retrieves current usage statistics.Example Response
SDKs
JavaScript/TypeScript SDK
Python SDK (Coming Soon)
Testing
Test Mode
Use the following test tenant ID for development:Mock Data
The test tenant contains 975 sample memories across all memory types with realistic content for testing search and intelligence features.Support
- Documentation: https://docs.herobrain.ai
- API Status: https://status.herobrain.ai
- Support: [email protected]
- Community: https://community.herobrain.ai
Changelog
v1.0.0 (November 19, 2025)
- Initial production release
- Core memory CRUD operations
- Semantic search
- API key management
- Webhook support
- Intelligence features (beta)
- TypeScript and Python SDKs