This project is a work in progress and is not ready for production use.

REST API Reference

Complete reference for the MeMesh Cloud REST API. All endpoints require authentication via the x-api-key header.

Base URL: https://api.memesh.ai/v1

Authentication Header

x-api-key: mk_your_api_key_here

All requests must include a valid API key. Create keys at Dashboard > Settings > API Keys.

Marketplace

Browse, search, and submit A2A-compatible agents to the marketplace.

GET
/marketplace/agents

List and search marketplace agents with filtering and pagination.

Query: category?, trustLevel? (SANDBOX|REVIEWED|VERIFIED), status? (ACTIVE|PENDING|INACTIVE|SUSPENDED), search?, featured?, limit? (default: 20), offset?

GET
/marketplace/agents/:id

Get detailed agent information including reviews, provider info, and task statistics.

POST
/marketplace/agents

Submit a new A2A agent. Fetches Agent Card, validates spec compliance, and tests reachability.

Body: { agentCardUrl (required, URL), category? (default: "general") }

GET
/marketplace/categories

List all agent categories with counts of active agents in each.

Agent Reviews

Rate and review marketplace agents after task completion.

POST
/marketplace/agents/:id/review

Submit a review for an agent (1-5 stars). Self-reviews are blocked. One review per user per task.

Body: { rating (1-5, required), comment? (max 2000 chars), taskId? (UUID) }

Memory

Store and search memories with semantic search via pgvector embeddings.

POST
/memory/write

Write a new memory with optional metadata. Memories are automatically embedded for semantic search.

Body: { content, space?, summary?, tags?, sensitivity?, source? }

GET
/memory/search

Semantic search across stored memories using a natural language query.

Query: query (required), spaces?, limit?

POST
/memory/search

Semantic search with structured request body. Recommended for complex queries.

Body: { query, spaces?, limit? }

GET
/memory/count

Get total memory count for the authenticated user.

POST
/memory/batch

Batch write up to 100 memories. Supports transactional (all-or-nothing) or partial success modes.

Body: { memories[], transactional? }

POST
/memory/batch/search

Execute up to 50 search queries in parallel with optional cross-query deduplication.

Body: { queries[], deduplicate? }

GET
/memory/spaces

List all memory spaces for the authenticated user.

POST
/memory/query

Natural language query with hybrid filtering. Supports temporal, tags, and semantic search.

Body: { query, limit?, offset?, similarityThreshold? }

POST
/memory/context-window

Select memories for LLM context window within a token budget.

Body: { query, tokenBudget }

SSE
/memory/stream/export

Stream memory export using Server-Sent Events. No timeout for large exports.

Query: spaces?

Agents

Register, manage, and discover AI agents with trust scoring.

POST
/agents/register

Register an agent instance with MeMesh. Called automatically on first connection.

Body: { agentType, agentName?, agentVersion?, capabilities? }

GET
/agents

List all registered agents with optional filters.

Query: status?, agentType?

GET
/agents/:id

Get details of a specific agent by ID.

PUT
/agents/:id

Update agent name, version, capabilities, or status.

Body: { agentName?, agentVersion?, capabilities?, status? }

DELETE
/agents/:id

Revoke and disable an agent instance.

POST
/agents/:id/heartbeat

Update agent last-seen timestamp to indicate it is still active.

GET
/agents/:id/trust

Get the trust score and level for a specific agent.

Inbox

Inter-agent messaging with tasks, priorities, smart routing, and real-time events.

POST
/inbox/send

Send a message to another agent's inbox. Supports smart routing by agent type.

Body: { recipientAgentType?, recipientAgentId?, messageType, title, content, priority?, attachments?, parentId?, routingHints? }

GET
/inbox

Get messages in the current agent's inbox with filters and pagination.

Query: status?, messageType?, priority?, platform?, limit?, offset?

GET
/inbox/summary

Get counts of messages by status (pending, read, processing, completed, archived).

GET
/inbox/:messageId

Get a specific inbox message with attachments and replies.

POST
/inbox/:messageId/complete

Mark a task as completed and optionally send result back to sender.

Body: { result?, sendResultBack? }

SSE
/inbox/events

Subscribe to real-time inbox events via Server-Sent Events.

Team

Team member management, invitations, and role-based access control.

GET
/team/members

List all team members for the current tenant.

POST
/team/members/invite

Invite a new team member by email. Requires OWNER or ADMIN role.

Body: { email, role? }

PATCH
/team/members/:userId/role

Change a team member's role.

Body: { role }

DELETE
/team/members/:userId

Remove a member from the team.

Audit

Query audit logs for security monitoring and compliance.

GET
/audit/logs

Query audit logs with optional filters by action, resource, date range, and limit.

Query: action?, resource?, startDate?, endDate?, limit? (default: 100)

Billing & Usage

Subscription plans, usage statistics, and quota management.

GET
/billing/plan

Get the current user's subscription plan (free, pro, or enterprise).

GET
/usage/summary

Get complete usage statistics including memory, API keys, agents, seats, and rate limits.

API Keys

Create, list, and revoke API keys for programmatic access.

POST
/keys

Create a new API key. The key value is only shown once in the response.

Body: { name }

GET
/keys

List all API keys for the current user (values are masked).

DELETE
/keys/:id

Permanently revoke an API key.

Device Authorization

OAuth 2.0 Device Authorization flow (RFC 8628) for CLI and MCP clients.

POST
/auth/device

Initiate device authorization flow. Returns device_code, user_code, and verification_uri. Public endpoint.

Body: { client_id, scope? }

POST
/auth/device/token

Poll for token after user authorizes the device. Public endpoint.

Body: { grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code }

Example Requests

List marketplace agentsbash
curl "https://api.memesh.ai/v1/marketplace/agents?category=productivity&limit=10" \
  -H "x-api-key: mk_your_api_key"
Submit an agent to the marketplacebash
curl -X POST https://api.memesh.ai/v1/marketplace/agents \
  -H "x-api-key: mk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agentCardUrl": "https://my-agent.example.com/.well-known/agent-card.json",
    "category": "productivity"
  }'
Write a memorybash
curl -X POST https://api.memesh.ai/v1/memory/write \
  -H "x-api-key: mk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "User prefers dark mode",
    "space": "preferences",
    "tags": ["ui"]
  }'

HTTP Status Codes

CodeDescription
200Success
201Created (agent submitted, review submitted, memory written)
400Bad Request (validation error, invalid Agent Card)
401Unauthorized (invalid or missing API key)
403Forbidden (self-review blocked, insufficient permissions)
404Not Found (agent or resource does not exist)
409Conflict (agent endpoint already registered)
429Too Many Requests (rate limit exceeded)