Getting Started with the APIs

Everything you can do in Elegant Machine's UI is backed by HTTP APIs, and most of it is available to your own integrations. This page covers the two things every API consumer needs first: where the APIs live, and how to authenticate.

Base URLs

Elegant Machine's APIs are served on the medchatapp.com domain, one path prefix per service:

APIBase URL
Automation API (tasks, playbooks, AI agents, templates)https://medchatapp.com/automationapi
Live Chat APIhttps://medchatapp.com/livechatapi2.0
Voice Chat APIhttps://medchatapp.com/voicechatapi

Each service publishes an interactive Swagger explorer at {baseUrl}/swagger and its OpenAPI document at {baseUrl}/swagger/v1/swagger.json.

Authentication overview

To call the APIs you need your Org ID and a scoped API access token. Both live in the developer area of the app: Admin › Developer › Auth (visible to users with the Developer role).

Tokens are passed as a bearer credential on every request:

curl "https://medchatapp.com/automationapi/orgs/$ORG_ID/tasks?\$top=5" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/vnd.medchat+json;v=1.0"

Almost every endpoint is org-scoped — the {orgId} in the URL must be the org your token was issued for. Calling another org's URL returns 403 even with a valid token.

Managing access tokens

Tokens are created, rotated, and revoked on the Auth screen at Admin › Developer › Auth — see the Auth page for the full walkthrough. Two rules worth knowing up front: a token is displayed once, at creation; and its scopes and expiration can't be changed afterward — changing access means rotating to a new token.

Scopes

Scopes map to permissions the APIs check on every request. The ones relevant to the currently documented surface:

DomainScopeWhat it unlocks
Tasksread.tasksRead tasks, batches, discussion, files, analyzer outputs
write.tasksCreate/update tasks, instantiate templates, batches, discussion posts, file uploads
Automation resourcesread.automationsRead playbooks, AI agents, task templates, data types, knowledge sets, custom AI actions, analyzer configurations
manage.automationsCreate/update/delete those same resources
Live chatsread.my_orgs.chatsRead all of your org's chats, transcripts, and files
Voiceread.voice_chatsRead call logs, transcripts, and AI evaluations
read.voice_chat_phone_numbersRead phone numbers and their voice configuration
Custom Reportsread.analytics_query_resultsExecute report queries and read/export results
Datasetsmanage.datasetCreate, update, and delete datasets
get.datasetRead and query datasets

A caller only needs one of the permissions listed on an endpoint — where docs list several, they are alternatives, not requirements.

📘

Grants are read-only via the API today. Reading a resource returns its grants, but modifying a grants collection requires an elevated permission that isn't currently available on scoped access tokens. Author grants in the app UI.

Errors you'll meet first

StatusMeaning
401Missing, expired, or invalid token
403Valid token, but missing the required scope — or the URL's {orgId} doesn't match your org
400Validation failure; the body is a dictionary of field names to error messages

Next: API Conventions — the request/response patterns shared by every service.


Did this page help you?