curl — no SDK required.
Prerequisites
- A Qoder account
- A terminal (macOS, Linux, or WSL)
curl, plusjq(optional, for formatting JSON)
Windows users
Windows users
The commands in this guide use bash syntax. Windows users should use one of the following:
- Git Bash (recommended): included with Git for Windows
- WSL: install via
wsl --install
- Set environment variables:
$env:QODER_PAT="your-token"(notexport) - Use real curl: type
curl.exe(PowerShell aliasescurltoInvoke-WebRequest) - Install jq separately:
winget install jqlang.jq
Step 1: Obtain a PAT
- Sign in to the Qoder console.
- Open “Settings → Personal Access Tokens”.
- Click “Create Token”, set a name and expiration.
- Copy the token and export it as an environment variable:
The token is shown only once at creation. Save it immediately — adding it to
~/.bashrc or ~/.zshrc is recommended.Step 2: Pick an Environment
List the available environments and capture the ID:Step 3: Create an Agent
Define a general-purpose Agent with a shell tool:Step 4: Create a Session
Creating a Session requires two parameters:agent (Agent ID or object) and environment_id (Environment ID).
Bind the Agent to the Environment to create a runtime instance:
The Session starts in
idle status. It will only begin processing once you send a message in the next step.Step 5: Send a Message and Stream Events
Send a user message to the Session, then receive Agent responses live over SSE:- Every event (except
heartbeat) includes anid:line and the JSON payload containsid,type, andprocessed_atfields. heartbeatevents are sent approximately every 15 seconds to keep the connection alive.- The
contentfield inagent.messageuses the[{"type":"text","text":"..."}]array format. session.status_running/session.status_idlecarry no extra fields beyondid,type,processed_at, and (for idle)stop_reason.agent.thinkingsignals that the model is reasoning but contains nocontentortextfield.
End-to-End Script
The whole flow combined into a single runnable script:FAQ
Q: I’m getting 401 Unauthorized. A: Check that$QODER_PAT is set correctly and the token has not expired. Recreate the token and update the environment variable.
Q: Creating an Agent returns 400 Bad Request.
A: Verify the request JSON. The model field must be a valid value (such as "ultimate"), and tools must be an array.
Q: The Session stays in idle and emits no events.
A: A newly created Session starts in idle status. You must send a user.message event (Step 5) to trigger Agent execution.
Q: My SSE stream disconnected.
A: The stream endpoint supports the Last-Event-ID header for reconnection replay. Pass the last event id you received; the stream resumes from the event after that ID. Event-type query filters are not currently supported.
Q: GET /api/v1/cloud/environments returns an empty array.
A: New accounts may not have a pre-provisioned environment. Follow the tip in Step 2 to create one manually.
Next steps
Agent setup
Every field in the Agent configuration.
Cloud environment setup
Customize the runtime environment.
Start a session
Manage Session lifecycle in depth.
Agent Skills
Attach domain expertise to your Agent for better task performance.