@mesadev/rest client, resolves the default organization for you, verifies webhooks, and exposes a native virtual filesystem for repo I/O and shell execution.
Node.js 18 or newer is required.
Installation
Create a client
Client options
string | undefined
Ed25519 private key. In Node.js, the SDK reads
MESA_PRIVATE_KEY when no explicit credential is supplied.{ privateKey: string } | { accessToken: string } | undefined
A credential group holding either a private key or an existing access token. A client built from an access token forwards that token unchanged and cannot mint another one.
string
REST API base URL. Defaults to
https://api.mesa.dev/v1. http and https are accepted. Trailing slashes are stripped.string
Optional VCS gateway override. Only use when self-hosting Mesa.
string | undefined
Optional organization check. Private-key and access-token clients derive the organization from the credential and only accept a matching value.
typeof globalThis.fetch | undefined
Custom fetch implementation for REST requests.
string | undefined
Appended to the SDK user agent. Node.js uses
User-Agent; browser-like runtimes use X-Mesa-User-Agent.string | undefined
Signing secret used by
mesa.webhooks.receive(...).Lifecycle
The TypeScript client does not hold an HTTP session and does not need to be closed. Reuse oneMesa instance where practical.
Private-key mounts sign one short-lived, scoped access token locally and use it for the mount’s whole lifetime, while a client built from an access token forwards that token unchanged. Private-key mounts default to 15 minutes and can run up to 4 hours. Layout mounts work the same way, with the ttl carried on the definition: mesa.fs({ layout, ttl }).mount().
Organization resolution
Private-key and access-token clients read the organization from the credential. A constructor or per-callorg value is optional, but it must match that organization.
Resource namespaces
Bulk repository tag updates are available through
mesa.raw.
Response objects
High-level SDK methods return response data directly. They do not return generated HTTP wrapper objects.GetRepoResponse live in @mesadev/rest.
Common types
Import SDK-owned types from@mesadev/sdk.
High-level REST method input types are inferred from the method signatures. If you need named REST schema types, import them from
@mesadev/rest.
Error model
SDK-owned setup and webhook errors extendMesaError and expose a stable code field.
API operations throw Mesa API error payloads directly when the server returns an error response. These payloads are not
MesaError instances.
Raw generated client
mesa.raw exposes generated REST operations with authentication, base URL, fetch, and user-agent already wired in. Use it when the high-level SDK does not expose an operation or option yet.
path, query, body) and return response data directly.

