Skip to main content
This page walks through common end-to-end workflows with the Devin API. Each flow includes the full sequence of API calls with code examples. For individual endpoint details, see the relevant API reference pages.

Setup

Set these environment variables before running any example:

Getting started: API key to first session

The most common workflow — authenticate, discover your account, and create your first session.

Step 1: Verify your credentials

Organization-scoped service users can skip to Step 3 — you already know your org ID from the Settings page.
Response:

Step 2: List your organizations

Enterprise service users can list all organizations:
Organization-scoped service users already know their org ID (it’s shown at the top of the Settings > Devin API page, where the service user was provisioned).

Step 3: Create a session

Response:

Step 4: Poll for events

Monitor the session by polling for messages:

Full Python example


Downloading session attachments

Retrieve files produced by a session (logs, screenshots, generated code, etc.).

Step 1: Get the session

Step 2: List attachments

Response:

Step 3: Download

Use the url from the attachment response to download the file directly.

Full Python example


Knowledge & playbook management

Manage the context and instructions that Devin uses across sessions.

Create a knowledge note

List knowledge notes

Update a knowledge note

Delete a knowledge note

Create a playbook

Full Python example


Scheduling automated sessions

Create recurring sessions with an automation that has a schedule:recurring trigger. The trigger takes one rrule condition: an iCalendar RRULE evaluated in UTC (for example FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=13;BYMINUTE=0 for weekdays at 9 AM Eastern during daylight time). Requires the ManageOrgAutomations permission.
The older /schedules endpoints are deprecated. Starting September 24, 2026, POST /v3/organizations/{org_id}/schedules returns 403 for organizations migrated to Automations. See the API release notes.

Create a scheduled automation

For a one-time run, use a DTSTART with COUNT=1, for example DTSTART:20260915T170000Z\nRRULE:FREQ=DAILY;COUNT=1. The automation fires once and then disables itself.

List, update, and delete

Full Python example


Hand off a task from anywhere

Because the Sessions API creates a cloud Devin session from a single request, any tool, script, or coding agent can “hand off” work to Devin — bundling the current repo, branch, and uncommitted changes into the prompt so the cloud session picks up where you left off.

Create a session with repo context

The cloud session clones the repo, applies the context from your prompt, and runs in its own VM with a shell, browser, and full repo access. Track it by polling for messages or in the Devin web app.
git diff HEAD can include uncommitted secrets — API keys, tokens, or .env edits — and the prompt is uploaded to the cloud session. Review your diff and commit, stash, or remove sensitive changes before handing off.
Don’t want to build this yourself? The open-source Devin Handoff plugin wraps exactly this flow — auto-detecting repo, branch, and diff — so you can hand off from the Devin CLI, Claude Code, Codex, Cursor, or a plain shell script. See Hand off to Devin.

Error handling

All examples above should include error handling in production. Here’s a reusable pattern:

Support

Need Help?

For questions about the API or to report issues, email support@cognition.ai