Examples
Real calls for real agents.
Use these snippets to connect an agent, ingestion job, or monitoring script to a hosted Memorylayer workspace.
env
auth
call
observe
01 / Env
Set variables once Use MEMORYLAYER_URL, SLUG, and MEMORYLAYER_KEY across shell scripts and launchers.
02 / Auth
Send a workspace key Use Authorization bearer tokens or X-API-Key for every private workspace route.
03 / Call
Copy a working route Recipes cover bootstrap, MCP tools, ingest, usage, checkpointing, and curation.
04 / Observe
Check what happened Usage and audit feeds show which key called which route and when.
Variables Set MEMORYLAYER_URL, SLUG, and MEMORYLAYER_KEY first.
Auth Use Authorization: Bearer or X-API-Key.
Observe Every authenticated call appears in workspace usage.
Copyable recipes
Each recipe maps to a concrete hosted feature.
Codex-style handoff
Load bootstrap
Recall recent context
Work normally
Remember outcome
curl -H "Authorization: Bearer $MEMORYLAYER_KEY" "$MEMORYLAYER_URL/api/workspaces/$SLUG/bootstrap"
Copy
Hosted MCP bridge
List bridge tools
POST tool name and args
Store audit trail
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"tool":"recall_recent","args":{"limit":5}}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/mcp"
Copy
Ingestion pipeline
Create a service key
POST memories
Watch usage events
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"source_name":"handoff.md","items":["Deployment completed","Follow up on billing UI"],"layer":"episodic","memory_type":"fact"}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/ingest"
Copy
Usage monitor
Poll usage endpoint
Group by route
Rotate quiet or noisy keys
curl -H "Authorization: Bearer $MEMORYLAYER_KEY" "$MEMORYLAYER_URL/api/workspaces/$SLUG/usage"
Copy
Compact prompt context
Call MCP bridge
Fetch recall_context
Inject result
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"tool":"recall_context","args":{"query":"current project state","max_tokens":1200}}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/mcp"
Copy
Session checkpoint
Summarize work
Save checkpoint
Resume later
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"tool":"session_checkpoint","args":{"note":"Finished deploy; next check onboarding flow","limit":8}}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/mcp"
Copy
Negative knowledge
Catch bad assumption
Store exclusion
Prevent repeat
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"tool":"remember_negative","args":{"content":"Do not use local SQLite for production memory","scope":"deployment","context":"Postgres is required for hosted workspaces"}}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/mcp"
Copy
Entity pivot
Find entity
Load graph
Follow related work
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"tool":"entity_graph","args":{"name":"Memorylayer"}}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/mcp"
Copy
Curation pass
Find duplicate cluster
Deduplicate
Check quality
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"tool":"dedup","args":{"threshold":0.92,"max_merges":5}}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/mcp"
Copy
Tool manifest
Fetch manifest
Group tools
Render client UI
curl "$MEMORYLAYER_URL/api/mcp/manifest"
Copy
Public capability sync
Fetch capabilities
Cache counts
Expose service map
curl "$MEMORYLAYER_URL/api/capabilities"
Copy
Workspace health check
Call health
Read memory map
Export recent
curl -X POST -H "Authorization: Bearer $MEMORYLAYER_KEY" -H "Content-Type: application/json" -d '{"tool":"health","args":{}}' "$MEMORYLAYER_URL/api/workspaces/$SLUG/mcp"
Copy
Environment block
A shared setup block for shell scripts and agent launchers.
export MEMORYLAYER_URL="https://memorylayer.run"
export SLUG="your-workspace"
export MEMORYLAYER_KEY="engram_..."
Copy
Discovery URLs
Use these to build a client setup screen or agent launcher without hardcoding the service map.
Manifest
curl "https://memorylayer.run/api/service/status"
curl "https://memorylayer.run/openapi.json"
curl "https://memorylayer.run/api/service/manifest"
Copy
Capabilities
curl "https://memorylayer.run/api/capabilities"
Copy
MCP manifest
curl "https://memorylayer.run/api/mcp/manifest"
Copy
API fixtures
curl "https://memorylayer.run/api/examples"
Copy
Request and response shapes
A shorter preview of the API explorer fixtures.
GET
public
Service status
/api/service/status
Check whether the hosted service is alive and read public counts.
GET
public
Service manifest
/api/service/manifest
Load the route map and public integration counts for client setup screens.
GET
public
Service architecture
/api/service/architecture
Read the concrete runtime, storage, model, limit, and surface contract.
GET
public
Service readiness
/api/service/readiness
Run bounded checks for database, runtime cache, security posture, and public surface wiring.