Pakt Docs

API and MCP Reference

Two peer interfaces for the same account-scoped Pakt operations.

Pakt exposes the same account-scoped authoring, lifecycle, portfolio, and authorization operations through two peer interfaces. Use the HTTP API from a code-based agent, or MCP from a compatible agent client. Both use the same Pakt rules and proof-gated authorization path; neither interface submits transactions.

InterfaceEndpointAuthenticationBest for
HTTP APIhttps://api.usepakt.ai/api/v1Account API keyCustom code and agents with ordinary HTTP clients
MCPhttps://api.usepakt.ai/mcpBrowser OAuthMCP-compatible agent clients

Create an API key from your account, or connect an MCP client and complete browser sign-in. For setup and a first Pakt, follow the Quickstart guide.

Tool pages are generated from a committed snapshot of the server's tools/list response. The connected server's catalogue is authoritative if its capabilities differ.

HTTP API

The HTTP API reference documents every route from the server's OpenAPI 3.1 document. Send the API key as a bearer credential and keep it out of source code, logs, prompts, and browser URLs. The account and environment come from that credential, not from request fields.

MCP

Examples use client.callTool on an already connected, authenticated MCP client. They are tool calls, not unauthenticated HTTP requests. Use your client's browser OAuth flow; do not substitute a wallet key or copy a token into a public example.

Pakt returns structured tool results. Check isError before acting on the data. A client may expose it as structuredContent, or as JSON in a text content block. This small helper works with either representation:

function decodePaktResult(result) {
  const data = result.structuredContent ?? JSON.parse(
    result.content.find((item) => item.type === "text").text,
  );
  if (result.isError) {
    throw Object.assign(new Error(data.message), { paktFault: data });
  }
  return data;
}

const catalogue = decodePaktResult(await client.callTool({
  name: "list_pakt_templates",
  arguments: {},
}));
console.log(catalogue.templates.map((template) => template.name));

This call is read-only. For a complete example without Pakt signer approval or trading, list templates, call draft_pakt with an available preset ID, then display draft.pakt.review. Do not call activation preparation in a draft-only workflow.

Shared Integration Boundaries

  • The authenticated connection selects the account and environment. Tool arguments cannot substitute another account or wallet.
  • Lifecycle and execution lists are paginated. Follow next_cursor until null when you need a complete result; do not infer absence from one page.
  • Prices and sizes use exact decimal strings where the schema specifies them. Preserve integer precision: JSON integers larger than JavaScript's safe range need a lossless serializer, not a rounded Number or a schema-changing string.
  • propose_execution may lead to a signature and synchronously returns its result. It never submits. Keep the exact request and receipt for recovery.
  • Completion is a client-reported annotation. It is not an independent settlement oracle and cannot authorize a retry.

Follow the Hyperliquid workflow and implement the status and retry rules before enabling live submission.

On this page