Version 1 of the public API, for your servers. Keys are created by a workspace owner, admin or developer in Developers; each key does only what its scopes allow and what its creator may do.
Machine-readable: /api/public/v1/openapi.json (OpenAPI 3.1) · version 1.0.0
Send the key as a bearer token. Keys look like mai_live_… (published agents, real workflow runs) or mai_test_… (draft agents; workflow steps that act outside the platform are simulated). Never put a key in a browser or mobile app.
curl https://YOUR-DOMAIN/api/public/v1/agents \ -H "Authorization: Bearer $MAI_API_KEY"
Idempotency-Key header. Repeating a request with the same key returns the first result instead of creating a second record or run.RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset; over the limit you get 429 with Retry-After. Your plan's monthly request quota is in X-Quota-Limit and X-Quota-Remaining.{"error":{"code":"FORBIDDEN","message":"…","requestId":"…"}} with a stable code. Quote the request id to support.data, hasMore and nextCursor; pass cursor to get the next page.| Method | Path | What it does |
|---|---|---|
| GET | /api/public/v1/agents | List agents (published and drafts) |
| POST | /api/public/v1/agents/{id}/execute | Run an agent on a message and wait for its reply (up to 60 s). Live keys use the published version; test keys the draft. Same Idempotency-Key = same run |
| GET | /api/public/v1/conversations | Conversations the key's creator may see, newest first |
| GET | /api/public/v1/conversations/{id}/messages | Messages of one conversation (customer, AI and staff text), oldest first |
| POST | /api/public/v1/knowledge/search | Search a knowledge base: matching passages with scores and citations (no model answer) |
| GET | /api/public/v1/crm/contacts | Contacts, newest first; filter by email or update time |
| POST | /api/public/v1/crm/contacts | Create a contact (same rules as the dashboard: duplicates by email are refused) |
| GET | /api/public/v1/crm/leads | Leads, newest first; filter by status |
| POST | /api/public/v1/crm/leads | Create a lead (source api) |
| PATCH | /api/public/v1/crm/leads/{id} | Update a lead's status, owner or details |
| GET | /api/public/v1/workflows | Workflows with their status and whether they can be started through the API (a Manual start trigger) |
| POST | /api/public/v1/workflows/{id}/execute | Start a workflow through its Manual start trigger with input fields. Live keys: the published version; test keys: a test run of the draft (external steps simulated) |
| GET | /api/public/v1/usage | This month's usage: AI credits, meters and the API request quota |
| GET | /api/public/v1/voice/calls | Calls (metadata only; numbers masked; no transcripts) |
| GET | /api/public/v1/integrations | Connected integrations and their state (no credentials) |
| GET | /api/public/v1/webhooks | Event types you can subscribe to, and this workspace's endpoints (no secrets) |
Add an HTTPS endpoint in Developers → Webhooks and choose events (agent runs finished or failed, conversations started or handed to a person, leads created or updated, contacts created, workflows finished or failed, calls completed, campaigns completed, plan changes). Each POST carries MAI-Event-Id, MAI-Event-Type and MAI-Signature: t=…,v1=…: an HMAC-SHA256 of t + "." + raw body with your endpoint secret. Reject timestamps older than five minutes and deduplicate by event id. During a secret rotation the header carries two v1 values. Failed deliveries are retried with backoff for about a day, then marked dead; you can replay them.
import { constructWebhookEvent } from "@machintech/sdk";
const event = constructWebhookEvent(process.env.MAI_WEBHOOK_SECRET, rawBody, req.headers["mai-signature"]);TypeScript (Node 18+) and Python (3.9+, standard library only) clients ship in the repository under sdk/. They add idempotency keys, retries for rate limits and server errors, pagination and webhook verification.
import { Machintech } from "@machintech/sdk";
const mai = new Machintech({ apiKey: process.env.MAI_API_KEY!, baseUrl: "https://YOUR-DOMAIN/api/public/v1" });
const run = await mai.agents.execute(agentId, { message: "Where is order #1001?" });
console.log(run.reply);from machintech import Machintech
mai = Machintech(api_key=os.environ["MAI_API_KEY"], base_url="https://YOUR-DOMAIN/api/public/v1")
lead = mai.crm.create_lead(title="Website enquiry", contact={"name": "Priya Nair", "email": "priya@example.com"})Have an account? Open Developers to create a key.