curl — at your agent and it answers as a
streaming chat completion.
{base-url} is https://api.datagen.dev on DataGen Cloud, or
http://<your-server-ip>:3001 if you self-host — see Base URL.
What runs behind it is a full agent session, not a bare model call: your agent’s
files and repo, its skills, its MCP tools, and its secrets are all live inside a
sandbox for the duration of the turn.
{agent-name} is the agent’s slug as shown on its detail page. Repo-backed
agents use owner-repo (lowercase, / replaced by -), e.g.
datagendev-executive-assistant. Storage-backed agents use the name you gave
them, e.g. data-agent.Base URL
Every example in this section uses the DataGen Cloud host. If you self-host, swap that host for your own server — the paths are identical.
So the same endpoint, on each:
Port 3001 is the API server, not the web UI. Your team opens DataGen on
port 3000; integrations call 3001. Both are on the same machine. If your
operator changed
WASP_BACKEND_PORT in .env, use that port instead — it is
whatever WASP_SERVER_URL in your .env points at./api/* to the API server, so port 3001 is closed to the
network and your base URL is simply your DataGen domain with no port.
Your first call
1
Get an API key
In DataGen, open Workspace Settings → API Keys and create a key. Create
it in the same workspace as the agent you want to call — the key can
only reach that workspace’s agents.
2
Send a message
3
Keep the conversation id
The response carries an
X-Conversation-Id header. Send it back as
metadata.conversation_id on the next call and the agent picks up exactly
where it left off. See Conversations.Two turns, end to end
The whole contract in one copy-pasteable script — ask something, then follow up in the same conversation:stream: true on every
request, one user message per call (history comes from the conversation, not
the array), and the conversation id read from the response header and sent back.
Sending turns back to back from a script — as above — can outrun the server’s
bookkeeping and lose the previous turn’s context. Add a short wait between
automated turns; see
Resuming.
Three differences from the Anthropic API
The wire format matches Anthropic’s, so existing clients connect without changes. The semantics differ in three ways that matter.Sampling parameters are ignored. The server reads
messages, stream,
model, system, and metadata. max_tokens, temperature, top_p,
stop_sequences, tools, and tool_choice are accepted and dropped —
max_tokens is not required. The agent uses its own configured tools; you
cannot inject client-side tool definitions.API-key calls are read-only by default. An agent backed by a connected
repository reads it but never commits or pushes, unless you send
metadata.read_only: false — in which case a turn that changes files pushes a
commit to the repository’s default branch. See
Writing to a connected repository.Authentication
One header, on every request:/workspace/settings?tab=apikeys) — the same page on a self-hosted install.
The key decides the workspace. Keys are created inside a workspace and belong
to it, so a key reaches only that workspace’s agents — an agent in another
workspace returns 404, even if you can see it in the web UI. To call an agent
in a team workspace, create the key while that workspace is selected. There is no
header for choosing a workspace per-request.
The key decides what you may do. Running a turn requires an Admin,
Builder, or Operator key; a Viewer key can read conversations but gets
403 when it tries to send a message.
A missing or unrecognized key returns 401; a revoked key returns
401 {"message": "API key has been revoked"}.
Models
/v1/messages, which makes it a cheap way to
check that an agent name and key work together before sending a real turn.
When you omit model, resolution falls back to the automation’s model (if you
passed metadata.automation), then the agent’s default model.
Where to go next
Send a Message
Full request body, SSE event stream, and SDK examples.
Conversations
Resume, fork, list, share, and delete conversations.
Errors & Limits
Status codes, timeouts, and concurrency guidance.