Skip to main content
The MeshAgent REST API exposes administrative and lifecycle operations for projects, rooms, users, permissions, services, storage, billing, sessions, and integrations. The REST API can be used for:
  • Projects & Rooms: Create projects, manage rooms, and mint room connection tokens
  • Room grants : Persist per-user permissions to manage participant access and available actions
  • Project storage: Upload/download project files by path
  • Services: Manage project-wide and room-scoped services
  • Secrets: Manage key-based and image-pull secrets
  • Integrations: Manage webhooks, API keys, OAuth clients
  • Shares: Create share links for Rooms
  • Mailboxes: Manage mailboxes mapped to Rooms
  • Operations: Understand sessions (events/spans/metrics) and create/manage scheduled tasks
  • Billing & usage: Get insight into your account balance, transactions, subscriptions, and usage reporting
For room-specific operations such as working with agents, databases, or queues use the Room APIs.

Getting started

To call the MeshAgent REST API, authenticate with a project API key. The simplest path is:
  1. Set up a Python environment with the MeshAgent SDK installed (requires Python 3.13)
  2. Use the MeshAgent CLI to create and activate an API key, then store it in a .env file
  3. Load the key from .env and create a Meshagent() client
MeshAgent requires Python 3.13. We recommend using uv, which manages Python versions, virtual environments, and dependencies automatically. To learn more about uv see the Machine Setup Guide for Python

1. Set up the SDK

Install uv, then create a project and virtual environment with MeshAgent installed:
# Install uv if needed
curl -LsSf https://astral.sh/uv/install.sh | sh 

# Create and navigate to your project directory
mkdir meshagent-project && cd meshagent-project 

# Initialize the project and pin Python 3.13 
uv init --python 3.13

# Create virtual environment (uv will download python 3.13 if not already installed on your machine)
uv venv --python 3.13

# Install MeshAgent SDK and other dependencies
uv add "meshagent[all]" python-dotenv
Activate your virtual environment:
source .venv/bin/activate
Note: You’ll know your virtual environment is active when you see (.venv) at the start of your terminal prompt. When the environment is activated, you can run commands directly (e.g. meshagent setup or python main.py). If the environment is not activated, prefix commands with uv run (e.g. uv run meshagent setup or uv run python main.py).
To upgrade dependencies later, run:
uv lock --upgrade
uv sync

2. Create a new API key and store it in .env

# Authenticate to MeshAgent if not already signed in
meshagent setup # this will also print your project ID

# Get your current project ID
meshagent project list # the project with the * next to it is the current active project

# Create an API Key
meshagent api-key create --activate my-key
Create a .env file in your project and paste the key value:
MESHAGENT_API_KEY=your-api-key-value
MESHAGENT_PROJECT_ID=your-project-id

3. Create a MeshAgent client

Now we can create the MeshAgent client and use it to do something like list all the rooms in our project.
import asyncio
import os
from dotenv import load_dotenv
from meshagent.api.client import Meshagent

load_dotenv()
api_key = os.getenv("MESHAGENT_API_KEY")
project_id = os.getenv("MESHAGENT_PROJECT_ID")

if not api_key:
    raise RuntimeError("MESHAGENT_API_KEY is not set")
if not project_id:
    raise RuntimeError("MESHAGENT_PROJECT_ID is not set")

async def main():
    client = Meshagent(token=api_key)
    try:
        rooms = await client.list_rooms(project_id=project_id)
        print(rooms)
    finally:
        await client.close()

asyncio.run(main())

Client configuration

The Meshagent() client accepts a base_url and token.
  • base_url: defaults to MESHAGENT_API_URL (defaults to https://api.meshagent.com)
  • token: a bearer token for the Authorization header.
    • This will default to MESHAGENT_API_KEY. API keys are scoped to a specific project, so most REST calls will also require a project_id.
Every method raises meshagent.api.RoomException on non-2xx responses and validates responses with Pydantic models, so malformed payloads surface as rich errors.

Projects & Rooms

Create and manage projects and Rooms. Room connection returns a signed token and a room URL to join the room.
SDK methodHTTP routeWhat it does
create_project(name, settings?)POST /accounts/projectsCreate a project.
list_projects()GET /accounts/projectsList projects you can access.
get_project(project_id)GET /accounts/projects/{project_id}Fetch one project.
update_project_settings(project_id, settings)PUT /accounts/projects/{project_id}/settingsUpdate project settings.
get_status(project_id)GET /accounts/projects/{project_id}/statusCheck whether the project is enabled.
get_project_role(project_id)GET /accounts/projects/{project_id}/roleGet your role in the project.
add_user_to_project(project_id, user_id, …)POST /accounts/projects/{project_id}/usersAdd a user (optionally admin/developer/can_create_rooms).
remove_user_from_project(project_id, user_id)DELETE /accounts/projects/{project_id}/users/{user_id}Remove a user from the project.
get_users_in_project(project_id)GET /accounts/projects/{project_id}/usersList users in the project.
get_user_profile(user_id)GET /accounts/profiles/{user_id}Fetch a user profile.
update_user_profile(user_id, first_name, last_name)PUT /accounts/profiles/{user_id}Update basic profile fields.
create_room(project_id, name, metadata?, permissions?, if_not_exists?)POST /accounts/projects/{project_id}/roomsCreate a room (supports metadata + optional initial permissions).
list_rooms(project_id, limit?, offset?, order_by?)GET /accounts/projects/{project_id}/roomsList rooms with pagination.
get_room(project_id, room_name)GET /accounts/projects/{project_id}/rooms/{room_name}Fetch a room by name.
update_room(project_id, room_id, name, metadata?)PUT /accounts/projects/{project_id}/rooms/{room_id}Rename/update a room.
delete_room(project_id, room_id)DELETE /accounts/projects/{project_id}/rooms/{room_id}Delete a room.
connect_room(project_id, room_name)POST /accounts/projects/{project_id}/rooms/{room_name}/connectReturn RoomConnectionInfo (jwt, room_url, etc.).

Room grants

Room grants store per-user permissions (ApiScopes) for a specific room. They are persisted as ProjectRoomGrant { room, user_id, permissions } records and are used when minting room connection tokens (see participant tokens).
SDK methodHTTP routeWhat it does
create_room_grant(project_id, room_id, user_id, permissions)POST /accounts/projects/{project_id}/room-grantsCreate a grant for a user.
create_room_grant_by_email(project_id, room_id, email, permissions)POST /accounts/projects/{project_id}/room-grantsCreate a grant targeting a user by email.
update_room_grant(project_id, room_id, user_id, permissions, grant_id?)PUT /accounts/projects/{project_id}/room-grants/{grant_id}Replace permissions for an existing grant.
delete_room_grant(project_id, room_id, user_id)DELETE /accounts/projects/{project_id}/room-grants/{room_id}/{user_id}Delete a grant.
get_room_grant(project_id, room_id, user_id)GET /accounts/projects/{project_id}/room-grants/{room_id}/{user_id}Fetch a grant (ProjectRoomGrant).
list_room_grants(project_id, limit?, offset?, order_by?)GET /accounts/projects/{project_id}/room-grantsList all grants in a project.
list_room_grants_by_user(project_id, user_id, …)GET /accounts/projects/{project_id}/room-grants/by-user/{user_id}List rooms a user can access.
list_room_grants_by_room(project_id, room_name, …)GET /accounts/projects/{project_id}/room-grants/by-room/{room_name}List users with access to a room.
list_unique_rooms_with_grants(project_id, …)GET /accounts/projects/{project_id}/room-grants/by-roomCount grants per room.
list_unique_users_with_grants(project_id, …)GET /accounts/projects/{project_id}/room-grants/by-userCount grants per user.

Project Storage

MeshAgent allows you to use both project wide and room specific storage. For room-scoped storage see the Storage API documentation.
SDK methodHTTP routeWhat it does
upload(project_id, path, data)POST /projects/{project_id}/storage/upload?path=…Upload raw bytes (Content-Type: application/octet-stream).
download(project_id, path)GET /projects/{project_id}/storage/download?path=…Download raw bytes.

Services

Create and manage project and room services. Project services are available to all rooms in your project while room services are scoped to a specific room.

Project Services

SDK methodHTTP routeWhat it does
create_service(project_id, service)POST /accounts/projects/{project_id}/servicesCreate a project-level service.
create_service_from_template(project_id, template, values)POST /accounts/projects/{project_id}/servicesCreate a project service from a template payload.
list_services(project_id)GET /accounts/projects/{project_id}/servicesList project services.
get_service(project_id, service_id)GET /accounts/projects/{project_id}/services/{service_id}Fetch a service spec.
update_service(project_id, service_id, service)PUT /accounts/projects/{project_id}/services/{service_id}Update a service.
update_service_from_template(project_id, service_id, template, values)PUT /accounts/projects/{project_id}/services/{service_id}Update a service from a template payload.
delete_service(project_id, service_id)DELETE /accounts/projects/{project_id}/services/{service_id}Delete a service.

Room Services

SDK methodHTTP routeWhat it does
create_room_service(project_id, room_name, service)POST /accounts/projects/{project_id}/rooms/{room_name}/servicesCreate a room-scoped service.
create_room_service_from_template(project_id, room_name, template, values)POST /accounts/projects/{project_id}/rooms/{room_name}/servicesCreate a room service from a template payload.
list_room_services(project_id, room_name)GET /accounts/projects/{project_id}/rooms/{room_name}/servicesList room services.
get_room_service(project_id, room_name, service_id)GET /accounts/projects/{project_id}/rooms/{room_name}/services/{service_id}Fetch a room service spec.
update_room_service(project_id, room_name, service_id, service)PUT /accounts/projects/{project_id}/rooms/{room_name}/services/{service_id}Update a room service.
update_room_service_from_template(project_id, room_name, service_id, template, values)PUT /accounts/projects/{project_id}/rooms/{room_name}/services/{service_id}Update a room service from a template payload.
delete_room_service(project_id, room_name, service_id)DELETE /accounts/projects/{project_id}/rooms/{room_name}/services/{service_id}Delete a room service.

Secrets

Create and manage secrets. You can configure key based secrets as well as image pull secrets.
SDK methodHTTP routeWhat it does
create_secret(project_id, secret)POST /accounts/projects/{project_id}/secretsCreate a secret (PullSecret or KeysSecret).
list_secrets(project_id)GET /accounts/projects/{project_id}/secretsList secrets.
update_secret(project_id, secret)PUT /accounts/projects/{project_id}/secrets/{secret_id}Update a secret.
delete_secret(project_id, secret_id)DELETE /accounts/projects/{project_id}/secrets/{secret_id}Delete a secret.

Webhooks

SDK methodHTTP routeWhat it does
create_webhook(project_id, …)POST /accounts/projects/{project_id}/webhooksCreate a webhook.
list_webhooks(project_id)GET /accounts/projects/{project_id}/webhooksList webhooks.
update_webhook(project_id, webhook_id, …)PUT /accounts/projects/{project_id}/webhooks/{webhook_id}Update a webhook.
delete_webhook(project_id, webhook_id)DELETE /accounts/projects/{project_id}/webhooks/{webhook_id}Delete a webhook.

API Keys

SDK methodHTTP routeWhat it does
create_api_key(project_id, name, description)POST /accounts/projects/{project_id}/api-keysIssue a new API key (returns value once).
list_api_keys(project_id)GET /accounts/projects/{project_id}/api-keysList keys (does not list key value).
delete_api_key(project_id, id)DELETE /accounts/projects/{project_id}/api-keys/{id}Revoke a key.

OAuth clients

Manage OAuth Clients for connections with other services.
SDK methodHTTP routeWhat it does
create_oauth_client(project_id, …)POST /accounts/projects/{project_id}/oauth/clientsCreate an OAuth client (includes secret).
list_oauth_clients(project_id)GET /accounts/projects/{project_id}/oauth/clientsList OAuth clients.
get_oauth_client(project_id, client_id)GET /accounts/projects/{project_id}/oauth/clients/{client_id}Fetch one client.
update_oauth_client(project_id, client_id, …)PUT /accounts/projects/{project_id}/oauth/clients/{client_id}Update a client.
delete_oauth_client(project_id, client_id)DELETE /accounts/projects/{project_id}/oauth/clients/{client_id}Delete a client.

Shares

Create share links/tokens that can connect into rooms.
SDK methodHTTP routeWhat it does
create_share(project_id, settings?)POST /accounts/projects/{project_id}/sharesCreate a share token.
list_shares(project_id)GET /accounts/projects/{project_id}/sharesList shares.
update_share(project_id, share_id, settings?)PUT /accounts/projects/{project_id}/shares/{share_id}Update share settings.
delete_share(project_id, share_id)DELETE /accounts/projects/{project_id}/shares/{share_id}Delete a share.
connect_share(share_id)POST /shares/{share_id}/connectReturn RoomShareConnectionInfo (jwt, room_url, settings…).

Mailboxes

Create and manage mailboxes that can be used by Agents or Rooms.
SDK methodHTTP routeWhat it does
create_mailbox(project_id, address, room, queue, public?)POST /accounts/projects/{project_id}/mailboxesCreate a mailbox mapping.
list_mailboxes(project_id)GET /accounts/projects/{project_id}/mailboxesList mailboxes.
list_room_mailboxes(project_id, room_name)GET /accounts/projects/{project_id}/rooms/{room_name}/mailboxesList mailboxes for a room.
get_mailbox(project_id, address)GET /accounts/projects/{project_id}/mailboxes/{address}Get a mailbox.
update_mailbox(project_id, address, room, queue, public?)PUT /accounts/projects/{project_id}/mailboxes/{address}Update mapping.
delete_mailbox(project_id, address)DELETE /accounts/projects/{project_id}/mailboxes/{address}Delete mapping.

Sessions

Inspect active/recent sessions and fetch diagnostics, or terminate sessions.
SDK methodHTTP routeWhat it does
list_active_sessions(project_id)GET /accounts/projects/{project_id}/sessions/activeList active sessions.
list_recent_sessions(project_id)GET /accounts/projects/{project_id}/sessionsList recent sessions.
get_session(project_id, session_id)GET /accounts/projects/{project_id}/sessions/{session_id}Fetch session metadata.
list_session_events(project_id, session_id)GET /accounts/projects/{project_id}/sessions/{session_id}/eventsSession event stream.
list_session_spans(project_id, session_id)GET /accounts/projects/{project_id}/sessions/{session_id}/spansTrace spans.
list_session_metrics(project_id, session_id)GET /accounts/projects/{project_id}/sessions/{session_id}/metricsMetrics data.
terminate(project_id, session_id)POST /accounts/projects/{project_id}/sessions/{session_id}/terminateTerminate a session.

Scheduled Tasks

Scheduled tasks let you automate room workflows by sending queued messages on a schedule (cron or one-time).
SDK methodHTTP routeWhat it does
create_scheduled_task(project_id, …)POST /accounts/projects/{project_id}/scheduled-tasksCreate a scheduled task.
update_scheduled_task(project_id, task_id, …)PUT /accounts/projects/{project_id}/scheduled-tasks/{task_id}Update a task.
delete_scheduled_task(project_id, task_id)DELETE /accounts/projects/{project_id}/scheduled-tasks/{task_id}Delete a task.
list_scheduled_tasks(project_id, room_name?, task_id?, active?, limit?, offset?)GET /accounts/projects/{project_id}/scheduled-tasksList tasks with filters.

Billing & usage

Checkout balances, transactions, subscriptions, and usage reports.
SDK methodHTTP routeWhat it does
get_pricing()GET /pricingFetch pricing metadata.
get_balance(project_id)GET /accounts/projects/{project_id}/balanceFetch current balance and auto-recharge config.
get_recent_transactions(project_id)GET /accounts/projects/{project_id}/transactionsList recent transactions.
set_auto_recharge(project_id, enabled, amount, threshold)POST /accounts/projects/{project_id}/rechargeConfigure auto-recharge.
get_checkout_url(project_id, success_url, cancel_url)POST /accounts/projects/{project_id}/subscriptionCreate subscription checkout; returns checkout_url.
get_credits_checkout_url(project_id, success_url, cancel_url, quantity)POST /accounts/projects/{project_id}/creditsPurchase credits checkout; returns checkout_url.
get_subscription(project_id)GET /accounts/projects/{project_id}/subscriptionFetch subscription info.
get_usage(project_id, start?, end?, interval?, report?)GET /accounts/projects/{project_id}/usageUsage reporting with optional filters.

What’s next?