Agent Imprint Documentation
Welcome to the Agent Imprint API documentation. This guide covers everything you need to integrate persistent memory capabilities into your AI agents.
Base URL
https://agentimprint.ai/api/v1
The Agent Imprint API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
Authentication
The Agent Imprint API uses API keys to authenticate requests. You can create and manage your API keys after creating an organization.
Authorization: Bearer your-api-key-here
⚠️ Keep your API keys secure
API keys carry many privileges. Do not share your API keys in publicly accessible areas such as GitHub, client-side code, or in your application's frontend.
Quickstart
Get up and running with Agent Imprint in just a few minutes. This guide will walk you through creating an organization, generating an API key, creating an agent, and storing your first memory.
1 Create an Organization
Organizations are the top-level container for all your agents and vaults.
/api/v1/organizations
{
"name": "My Organization",
"tier": "free"
}
2 Create an API Key
The organization creation response includes a bootstrap API key. Use it to create additional keys.
/api/v1/api-keys
{
"name": "Production Key",
"permissions": ["read", "write"]
}
3 Create an Agent
Agents represent individual AI instances that have memory. Each agent has a unique Ed25519 fingerprint.
/api/v1/agents
{
"name": "My Assistant",
"model": "gpt-4",
"metadata": {
"version": "1.0.0",
"purpose": "customer-support"
}
}
4 Create a Vault and Store Memory
Vaults hold encrypted memory entries. Create a vault for your agent, then store memories.
/api/v1/vaults
{
"name": "conversation-memory",
"agent_uuid": "agent-uuid-here"
}
/api/v1/vaults/{vault_uuid}/entries
{
"type": "conversation",
"content": {
"summary": "User prefers dark mode and concise responses",
"preferences": {
"theme": "dark",
"verbosity": "low"
}
},
"metadata": {
"source": "chat-session-123"
}
}
TypeScript SDK Installation
The official TypeScript SDK provides a convenient way to interact with the Agent Imprint API.
npm install @agentimprint/sdk
pnpm add @agentimprint/sdk
SDK Basic Usage
Here's a complete example of using the TypeScript SDK to create vaults and store memories.
import { AgentImprint, ImprintML } from '@agentimprint/sdk';
// Initialize the client
const imprint = new AgentImprint({
apiKey: process.env.AGENT_IMPRINT_API_KEY,
baseUrl: 'https://agentimprint.ai/api/v1'
});
// Create or retrieve an agent
const agent = await imprint.agents.create({
name: 'My Assistant',
model: 'claude-3-sonnet'
});
// Create a vault for the agent
const vault = await imprint.vaults.create({
name: 'user-preferences',
agentUuid: agent.uuid
});
// Store a memory entry with ImprintML validation
const entry = await vault.entries.create({
type: 'preference',
content: ImprintML.preference({
category: 'communication',
value: { style: 'formal', language: 'en' }
}),
tags: ['user-settings']
});
// Retrieve entries with filtering
const entries = await vault.entries.list({
type: 'preference',
limit: 10
});
// Search across vaults
const results = await imprint.search({
query: 'user preferences',
filters: { type: 'preference' }
});
// Verify vault integrity
const proof = await vault.getMerkleProof(entry.uuid);
const isValid = await vault.verifyIntegrity();
Organizations
Organizations are the top-level container for agents, vaults, and API keys.
/organizations
Create a new organization. This is a bootstrap endpoint and does not require authentication.
Request Body
{
"name": "string (required)",
"tier": "free | pro | enterprise (default: free)"
}
Response
{
"uuid": "org-uuid",
"name": "My Organization",
"tier": "free",
"api_key": "ai_xxxxxxxxxxxx",
"created_at": "2024-01-01T00:00:00Z"
}
/organizations/{uuid}
Retrieve organization details.
Response
{
"uuid": "org-uuid",
"name": "My Organization",
"tier": "pro",
"agents_count": 5,
"vaults_count": 12,
"created_at": "2024-01-01T00:00:00Z"
}
Agents
Agents represent AI instances that have persistent memory. Each agent has a unique Ed25519 fingerprint for cryptographic identity verification.
/agents
List all agents in your organization.
Query Parameters
page- Page number (default: 1)per_page- Items per page (default: 15, max: 100)
/agents
Create a new agent with automatic Ed25519 key generation.
Request Body
{
"name": "string (required)",
"model": "string (optional)",
"metadata": "object (optional)"
}
Response
{
"uuid": "agent-uuid",
"name": "My Assistant",
"model": "gpt-4",
"fingerprint": "SHA256:xxxxx...",
"public_key": "-----BEGIN PUBLIC KEY-----...",
"metadata": {},
"created_at": "2024-01-01T00:00:00Z"
}
/agents/{uuid}
Retrieve a specific agent by UUID.
/agents/discover/{fingerprint}
Discover an agent by its Ed25519 fingerprint. Useful for cross-organization agent discovery.
Vaults
Vaults are encrypted containers for memory entries. Each vault is associated with an agent and uses AES-256-GCM encryption.
/vaults
List all vaults in your organization.
/vaults
Create a new encrypted vault.
Request Body
{
"name": "string (required)",
"agent_uuid": "string (required)",
"description": "string (optional)"
}
/vaults/{uuid}
Retrieve vault details including entry count and storage statistics.
/vaults/{uuid}/export
Export all vault entries as encrypted ImprintML. Useful for backup and migration.
/vaults/{uuid}/import
Import entries from an ImprintML export file.
Vault Entries
Entries are individual memory records stored in vaults. All entries are validated against the ImprintML schema and encrypted at rest.
/vaults/{vault_uuid}/entries
List entries in a vault with optional filtering.
Query Parameters
type- Filter by entry typetags- Filter by tags (comma-separated)since- Entries created after this ISO 8601 timestamppage- Page number (default: 1)per_page- Items per page (default: 50, max: 200)
/vaults/{vault_uuid}/entries
Create a new entry in the vault. Content is validated against ImprintML schema.
Request Body
{
"type": "string (required: conversation|preference|fact|event|relationship)",
"content": "object (required)",
"tags": "array (optional)",
"metadata": "object (optional)"
}
Response
{
"uuid": "entry-uuid",
"type": "conversation",
"content": { ... },
"tags": ["user-settings"],
"checksum": "sha256:xxxx...",
"created_at": "2024-01-01T00:00:00Z"
}
/vaults/{vault_uuid}/entries/bulk
Create multiple entries in a single request. Maximum 100 entries per request.
Request Body
{
"entries": [
{ "type": "fact", "content": { ... } },
{ "type": "preference", "content": { ... } }
]
}
/vaults/{vault_uuid}/entries/{entry_uuid}
Update an existing entry. Updates create a new version while preserving history.
/vaults/{vault_uuid}/entries/{entry_uuid}
Soft-delete an entry. The entry can be restored within 30 days.
Discovery
The discovery API enables cross-vault and cross-organization memory discovery while respecting privacy settings.
/discover/{fingerprint}
Public endpoint to discover an agent by fingerprint. No authentication required.
Response
{
"found": true,
"agent": {
"uuid": "agent-uuid",
"name": "My Assistant",
"fingerprint": "SHA256:xxxxx...",
"public_key": "-----BEGIN PUBLIC KEY-----..."
},
"vaults": [
{ "uuid": "vault-uuid", "name": "public-memory", "entry_count": 42 }
]
}
/search
Search across all accessible vaults with semantic matching.
Request Body
{
"query": "string (required)",
"filters": {
"type": "string (optional)",
"tags": "array (optional)",
"vault_uuid": "string (optional)",
"since": "ISO 8601 timestamp (optional)"
},
"limit": "number (default: 20, max: 100)"
}
/agents/{uuid}/restore
Restore an agent's context from its vaults. Returns a summary of all stored memories.
Integrity & Merkle Trees
Agent Imprint uses Merkle trees to provide tamper-proof audit logs. Every vault has a Merkle root that changes when entries are added or modified.
/vaults/{uuid}/merkle
Get the current Merkle tree state for a vault.
Response
{
"root": "sha256:xxxx...",
"leaf_count": 42,
"depth": 6,
"computed_at": "2024-01-01T00:00:00Z"
}
/vaults/{uuid}/entries/{entry_uuid}/proof
Get a Merkle proof for a specific entry. Used to verify entry inclusion.
Response
{
"entry_hash": "sha256:xxxx...",
"proof": [
{ "position": "left", "hash": "sha256:yyyy..." },
{ "position": "right", "hash": "sha256:zzzz..." }
],
"root": "sha256:xxxx..."
}
/vaults/{uuid}/verify
Verify the integrity of all entries in a vault by recomputing the Merkle tree.
Response
{
"valid": true,
"entries_verified": 42,
"computed_root": "sha256:xxxx...",
"stored_root": "sha256:xxxx...",
"verified_at": "2024-01-01T00:00:00Z"
}
Error Codes
Agent Imprint uses conventional HTTP response codes to indicate the success or failure of an API request.
| Code | Status | Description |
|---|---|---|
200 |
OK | Request succeeded |
201 |
Created | Resource created successfully |
400 |
Bad Request | Invalid request body or parameters |
401 |
Unauthorized | Missing or invalid API key |
403 |
Forbidden | API key lacks required permissions |
404 |
Not Found | Resource does not exist |
422 |
Unprocessable Entity | Validation error (check errors field) |
429 |
Too Many Requests | Rate limit exceeded |
500 |
Internal Server Error | Something went wrong on our end |
Error Response Format
{
"error": {
"code": "validation_error",
"message": "The given data was invalid.",
"errors": {
"name": ["The name field is required."],
"type": ["The selected type is invalid."]
},
"request_id": "req_xxxxx"
}
}
Rate Limiting
API requests are rate limited based on your organization's tier. Rate limits are applied per API key.
| Tier | Requests/Minute | Requests/Day |
|---|---|---|
| Free | 60 | 1,000 |
| Pro | 600 | 100,000 |
| Enterprise | Unlimited | Unlimited |
Rate Limit Headers
Each response includes headers indicating your current rate limit status:
X-RateLimit-Limit- Maximum requests per minuteX-RateLimit-Remaining- Requests remaining in current windowX-RateLimit-Reset- Unix timestamp when the limit resetsRetry-After- Seconds to wait before retrying (only on 429)
💡 Handling Rate Limits
When you receive a 429 response, wait for the duration specified in the Retry-After
header before making another request. Implement exponential backoff for robust error handling.