Skip to content
API explorerProductOpen console

Core API

The Core API is how your own server uses Omazy. One token reaches the model gateway, your knowledge base, your agent, speech in both directions and outbound phone calls.

https://mw.omazy.ai/api/v1/core

It is called over HTTP with JSON. There is no client library to install, and none is needed: every example on these pages is curl or fetch.

You are building something of your own (a back office, a mobile app’s server, a nightly job) and it needs an answer from a model, a passage from your knowledge base, or your agent’s reply to a question. Without this API you would put a model vendor’s key in your own server and lose sight of what it spends.

With it, your server holds one Omazy token and no vendor key. Every model call is recorded against your workspace as Core API usage under that token. It counts toward the same budgets and passes the same guards as your agent’s own traffic, so one place shows what was spent and one place can stop it.

You want Call Page
A model’s answer, streamed or whole POST /ai/complete Completions
Passages from your knowledge base POST /knowledge/search Knowledge and agent
Your agent’s reply to a message POST /agent/turn Knowledge and agent
Your agent moved to another model, or its switches changed GET and PATCH /agent/settings Agent settings
Your knowledge base written from your backend POST /knowledge/documents and others Knowledge documents
Text read aloud, or a recording as text POST /voice/speak, POST /voice/transcribe Speech and calls
A phone call placed by your agent POST /voice/calls Speech and calls
A long recording transcribed, or meeting notes POST /voice/jobs Speech and calls
Customer records and messages into a conversation GET /customers/{id} and others Data and messages
The same verbs as tools, for an MCP client POST /mcp MCP

How it differs from the console API and the widget

Section titled “How it differs from the console API and the widget”

Omazy has three doors. They are easy to confuse because all three end up talking to the same agent.

Console API Widget Core API
Who calls it A signed-in person, or the CLI on their behalf A visitor’s browser Your server
Credential That person’s access token A public key that is safe in page source A cai_ token that must stay on a server
What it may do Whatever the person’s role allows Hold one conversation as a visitor Only what the token’s scopes name
Where it lives API Widget These pages

The console API manages a workspace: it is what the console and the CLI use to edit a brief or read a report. The Core API does not manage anything. It uses what you have already set up.

If you were looking for “the SDK for my app”, this is it, with one correction: it is an HTTP API, not a package. The SDK section documents something else, the Python SDK for writing plugins.

Five minutes, assuming you have a token. If you do not, read Authentication first: a workspace owner creates one.

1. Put the token in your server’s environment

Section titled “1. Put the token in your server’s environment”
Terminal window
export OMAZY_CORE_TOKEN="cai_<prefix>.<the-rest-of-your-token>"

/whoami needs no scope, so it works with any valid token. It is the cheapest way to find out which workspace a token belongs to and what it may do.

Terminal window
curl https://mw.omazy.ai/api/v1/core/whoami \
-H "Authorization: Bearer $OMAZY_CORE_TOKEN"
{
"success": true,
"data": {
"install_id": "0d6c3a7e-3f3f-4b1b-9d0c-1f5a2f1c9a11",
"workspace_id": "5b0c1c5e-8f0e-4a55-9a51-2f6d1f3f6a10",
"app_slug": "backoffice",
"scopes": ["ai:complete", "kb:search"],
"status": "active",
"token": "current"
}
}

This needs the ai:complete scope.

Terminal window
curl https://mw.omazy.ai/api/v1/core/ai/complete \
-H "Authorization: Bearer $OMAZY_CORE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"system": "You answer in one sentence.",
"messages": [{ "role": "user", "content": "What is a webhook?" }]
}'
{
"success": true,
"data": {
"text": "A webhook is an HTTP request one system sends another when something happens.",
"stop_reason": "stop",
"model": "openai/gpt-4o",
"usage": { "input_tokens": 24, "output_tokens": 17, "cached_input_tokens": 0 }
}
}

You did not choose a model. Left alone, a completion runs on the model your agent answers on, so changing the agent’s model in the console changes this too. Completions explains how to pick another.

const res = await fetch('https://mw.omazy.ai/api/v1/core/ai/complete', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.OMAZY_CORE_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
system: 'You answer in one sentence.',
messages: [{ role: 'user', content: 'What is a webhook?' }],
}),
})
const body = await res.json()
if (!body.success) throw new Error(`${body.error.code}: ${body.error.message}`)
console.log(body.data.text)

Check success and read error.code. Every JSON response on this API has the same outer shape, described in Errors and limits.

A workspace holds one or more apps, and each app has its own agent, knowledge and voice. A token belongs to the workspace, not to one app.

When the workspace has exactly one active app, you never name it. When it has more than one, every call that touches an app must say which, with the app’s handle in an app field (or an app query parameter on routes that take no JSON body). Leave it out and you get a 400 telling you to name it.

This is deliberate. A guess that is right today becomes a wrong answer on the day somebody adds a second app, and nothing would tell you.

Omazy CX documentation. One voice. Every channel. Always on.

Founded by Mosthofa Imran · imran@omazy.ai