Run your first Qoder Cloud Agent in five steps.
Get your first Qoder Cloud Agent running in five steps: obtain a PAT or SAT, select an environment, create an agent, create a session, and exchange messages. All you need is curl—no SDK installation is required.
Choose a PAT or SAT based on the calling identity. The remaining steps use the common
List the available environments and capture the ID:
Example response:
Define a general-purpose Agent with a shell tool:
Example response:
Creating a Session requires two parameters:
Example response:
Send a user message to the Session, then receive Agent responses live over SSE:
Example event stream output:
The whole flow combined into a single runnable script:
Q: I'm getting 401 Unauthorized.
A: Check that
Prerequisites
- A Qoder account
- A terminal environment (macOS, Linux, or WSL)
curlandjq
For Windows users: The commands in this document use bash syntax. We recommend using Git Bash (included with Git for Windows) or WSL (install with
wsl --install). If you use PowerShell, you must adapt the commands: set an environment variable with $env:QODER_ACCESS_TOKEN="your-token", use curl.exe to bypass PowerShell's curl alias, and install jq separately (e.g., winget install jqlang.jq).Step 1: Obtain an access token
Choose a PAT or SAT based on the calling identity. The remaining steps use the common QODER_ACCESS_TOKEN environment variable.
Set the service endpoints first. The SAT exchange and business API requests must use endpoints in the same region:
Option 1: PAT (personal user)
- Sign in to the Qoder Console.
- Navigate to Settings > Personal Access Tokens.
- Click Create Token, then set a name and expiration.
- Copy the token and set it as an environment variable:
The PAT is shown only once at creation. Save it securely right away.
Option 2: SAT (Service Account Token)
- Sign in to the Qoder console as an organization administrator.
- Create or select a Service Account under organization management.
- Create an API Key from the Service Account details page. You do not select scopes when creating the key; specify the required scopes when exchanging it for an SAT.
- Copy the SA Key, then exchange it for an SAT:
Use the SA Key only to exchange for an SAT; do not send it directly to Cloud Agents APIs. An SAT is valid for at most 12 hours. Exchange the SA Key again after the SAT expires.
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_ACCESS_TOKEN is set correctly and has not expired. PAT users should create a replacement token; Service Account users should exchange the SA Key for a new SAT.
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. To query historical events, use GET /api/v1/cloud/sessions/{id}/events?order=desc.
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
- Defining an Agent — every field in the Agent configuration.
- Cloud Environments — customize the runtime environment.
- Sessions — manage Session lifecycle in depth.
- Agent Skills — attach domain expertise to your Agent for better task performance.

