API access
API access to your eesel AI agent: get a workspace token, then use it from your own code, a script or CI through the eesel CLI or eesel's MCP endpoint, with no browser sign-in.
API access lets your own code, a script or a CI job use your eesel agent without a browser sign-in. It works with one workspace token.
eesel doesn't have a separate REST API. Your code uses the same two ways in that AI assistants use:
The eesel CLI, with the token set as an environment variable. Easiest for scripts and CI.
eesel's MCP endpoint, called over plain HTTP. Easiest from your own backend code.
Both give you the same things: chat with your agent, check what's connected, connect integrations, manage automations, read files and decide approvals.
For hands-on setup, use the dashboard. For programmatic operation, use eesel CLI with existing workspace credentials or call the MCP endpoint. Both let your coding agent inspect connections, chat and manage supported automation settings. If you are starting from a terminal without eesel MCP connected, use the CLI and follow the coding-agent quickstart for the requested setup. If eesel MCP is already connected to the intended workspace, use it without adding another connection.
If you need connection details, npx @eesel/cli mcp token returns the actual mcp_url, agent_id and authorization headers. Use those outputs instead of asking someone to find IDs in the dashboard. Select the intended workspace and agent first. A new anonymous trial can start through eesel init; external account approvals and any required dashboard forms remain separate steps.
Get a token
From the dashboard
Go to Settings > Developers and click Add API token.
Name it after the script or tool that will use it, for example "Nightly import script", and click Create token.
Copy the token. It's shown once, so put it in your secrets store before you close the popup.
A token from the dashboard lasts until someone revokes it. It acts with your access, and stops working if you stop being an editor of the workspace. Make one per script or tool, so you can revoke one without breaking the rest.
Your code also needs the agent id. It's in the agent's dashboard address: /platform/<agent id>/.
Only editors can add or revoke tokens. Everyone in the workspace can see the list. Workspaces under a HIPAA agreement can't make API tokens.
From the eesel CLI
Sign in once from a machine with a browser, then ask the CLI for the token:
mcp token prints three things your code needs:
mcp_url, the full MCP endpoint URLtokenandheaders, including the authorization headeragent_id, the id of the agent to use, andexpires_at
Keep the token in your secrets store or .env file, never in your code. Anyone holding it can act in your workspace until it expires.
If you set up eesel with the CLI without signing in (an anonymous workspace), mcp token still works, but the token ends when that workspace does, after 7 days. Run eesel login for a signed-in workspace token, then check its claim result and selected workspace before continuing. A claim can leave the anonymous trial separate if the account already has a workspace.
For a token that doesn't expire, make one in Settings > Developers instead.
Revoke a token
In Settings > Developers, open the token's ... menu and choose Revoke token, then confirm. It stops working on its next request. A CLI token can't be revoked on its own. A signed-in CLI token expires after 30 days; an anonymous one ends with the trial.
Use it from a script or CI
Set three environment variables and the CLI runs without a sign-in:
Environment credentials work with commands such as status, chat, automations and widget. init and files upload use a stored browser login or anonymous session instead; init can create the anonymous session. agents create and the direct website or chat-bubble connect commands need a browser login. Follow each command's error hint. Setup and status results are JSON; chat returns a JSON receipt when piped. See The eesel CLI.
Use it from your own code
Send a POST to the MCP endpoint. This asks your agent a question:
The reply comes back as JSON. If your agent is still working on it, the reply includes a task_id. Send chat again with just that task_id to collect the answer, or with a task_id and a new message to continue the conversation.
To see everything you can call, send "method": "tools/list" instead. The tools are the same ones listed on Claude Code & MCP clients.
Let your code wake the agent instead
If your code only needs to hand the agent some data and let it act on its own, such as "a new order came in, check it", a webhook automation is simpler. It gives you a URL, and your code sends a plain HTTP POST with no API token.
Good to know
A token covers the whole workspace. The
X-Eesel-Agent-Idheader, orEESEL_AGENT_ID, picks which agent it acts as.A CLI token carries your role from when you made it: a viewer's changes wait for an editor to approve them, and if your role changes, make a new one. A dashboard token always acts as an editor, and stops working if its maker stops being one.
To change the agent's instructions or memory, ask it in
chat. There's no direct write for those, from the API or anywhere else.When a CLI token expires, run
eesel mcp tokenagain and update your secret. Dashboard tokens don't expire.
FAQ
Related
The eesel CLI for every command
Claude Code & MCP clients to use the same token from an AI coding tool
Webhooks to wake your agent from another service
Last updated