Zum Hauptinhalt springen
POST
/
v3
/
organizations
/
{org_id}
/
sessions
Session erstellen
curl --request POST \
  --url https://api.devin.ai/v3/organizations/{org_id}/sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "attachment_urls": [
    "<string>"
  ],
  "bypass_approval": true,
  "child_playbook_id": "<string>",
  "create_as_user_id": "<string>",
  "knowledge_ids": [
    "<string>"
  ],
  "max_acu_limit": 123,
  "platform": "<string>",
  "playbook_id": "<string>",
  "repos": [
    "<string>"
  ],
  "resumable": true,
  "secret_ids": [
    "<string>"
  ],
  "session_links": [
    "<string>"
  ],
  "session_secrets": [
    {
      "key": "<string>",
      "value": "<string>",
      "sensitive": true
    }
  ],
  "structured_output_required": true,
  "structured_output_schema": {},
  "tags": [
    "<string>"
  ],
  "title": "<string>"
}
'
import requests

url = "https://api.devin.ai/v3/organizations/{org_id}/sessions"

payload = {
"prompt": "<string>",
"attachment_urls": ["<string>"],
"bypass_approval": True,
"child_playbook_id": "<string>",
"create_as_user_id": "<string>",
"knowledge_ids": ["<string>"],
"max_acu_limit": 123,
"platform": "<string>",
"playbook_id": "<string>",
"repos": ["<string>"],
"resumable": True,
"secret_ids": ["<string>"],
"session_links": ["<string>"],
"session_secrets": [
{
"key": "<string>",
"value": "<string>",
"sensitive": True
}
],
"structured_output_required": True,
"structured_output_schema": {},
"tags": ["<string>"],
"title": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
attachment_urls: ['<string>'],
bypass_approval: true,
child_playbook_id: '<string>',
create_as_user_id: '<string>',
knowledge_ids: ['<string>'],
max_acu_limit: 123,
platform: '<string>',
playbook_id: '<string>',
repos: ['<string>'],
resumable: true,
secret_ids: ['<string>'],
session_links: ['<string>'],
session_secrets: [{key: '<string>', value: '<string>', sensitive: true}],
structured_output_required: true,
structured_output_schema: {},
tags: ['<string>'],
title: '<string>'
})
};

fetch('https://api.devin.ai/v3/organizations/{org_id}/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3/organizations/{org_id}/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'attachment_urls' => [
'<string>'
],
'bypass_approval' => true,
'child_playbook_id' => '<string>',
'create_as_user_id' => '<string>',
'knowledge_ids' => [
'<string>'
],
'max_acu_limit' => 123,
'platform' => '<string>',
'playbook_id' => '<string>',
'repos' => [
'<string>'
],
'resumable' => true,
'secret_ids' => [
'<string>'
],
'session_links' => [
'<string>'
],
'session_secrets' => [
[
'key' => '<string>',
'value' => '<string>',
'sensitive' => true
]
],
'structured_output_required' => true,
'structured_output_schema' => [

],
'tags' => [
'<string>'
],
'title' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.devin.ai/v3/organizations/{org_id}/sessions"

payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"bypass_approval\": true,\n \"child_playbook_id\": \"<string>\",\n \"create_as_user_id\": \"<string>\",\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 123,\n \"platform\": \"<string>\",\n \"playbook_id\": \"<string>\",\n \"repos\": [\n \"<string>\"\n ],\n \"resumable\": true,\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_links\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"structured_output_required\": true,\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.devin.ai/v3/organizations/{org_id}/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"bypass_approval\": true,\n \"child_playbook_id\": \"<string>\",\n \"create_as_user_id\": \"<string>\",\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 123,\n \"platform\": \"<string>\",\n \"playbook_id\": \"<string>\",\n \"repos\": [\n \"<string>\"\n ],\n \"resumable\": true,\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_links\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"structured_output_required\": true,\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.devin.ai/v3/organizations/{org_id}/sessions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"bypass_approval\": true,\n \"child_playbook_id\": \"<string>\",\n \"create_as_user_id\": \"<string>\",\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 123,\n \"platform\": \"<string>\",\n \"playbook_id\": \"<string>\",\n \"repos\": [\n \"<string>\"\n ],\n \"resumable\": true,\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_links\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"structured_output_required\": true,\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "acus_consumed": 123,
  "created_at": 123,
  "org_id": "<string>",
  "pull_requests": [
    {
      "pr_state": "<string>",
      "pr_url": "<string>"
    }
  ],
  "session_id": "<string>",
  "tags": [
    "<string>"
  ],
  "updated_at": 123,
  "url": "<string>",
  "child_session_ids": [
    "<string>"
  ],
  "is_archived": false,
  "parent_session_id": "<string>",
  "playbook_id": "<string>",
  "service_user_id": "<string>",
  "structured_output": {},
  "subcategory": "<string>",
  "title": "<string>",
  "user_id": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Berechtigungen

Erfordert einen Servicebenutzer mit der Berechtigung ManageOrgSessions auf Organisationsebene.

Zusätzliche Berechtigungen für erweiterte Funktionen

FunktionErforderliche Berechtigung
create_as_user_idImpersonateOrgSessions

Devin-Modus

Der Parameter devin_mode legt fest, welcher Devin-Agent-Modus für die Sitzung verwendet wird:
ModusBeschreibung
normalDer Standard-Agent-Modus. Schnell und gut für langfristige Planung.
fast~2x schneller, 4x teurer, gleiche Intelligenz.
Wenn der Parameter weggelassen wird, verwendet die Sitzung den Standardmodus der Organisation. Für den schnellen Modus gelten dieselben Einschränkungen hinsichtlich Feature-Flags und der Enterprise-Agent-Preview wie für die Web-App.

Nutzer-Impersonation

Der Parameter create_as_user_id ermöglicht das Erstellen einer Sitzung im Namen eines anderen Nutzers. Dafür ist Folgendes erforderlich:
  1. Der Servicebenutzer muss die Berechtigung ImpersonateOrgSessions haben
  2. Der Zielnutzer muss Mitglied der Organisation sein
  3. Der Zielnutzer muss die Berechtigung UseDevinSessions haben

Autorisierungen

Authorization
string
header
erforderlich

Servicebenutzer-Anmeldedaten (Präfix: cog_)

Pfadparameter

org_id
string | null
erforderlich

Organisations-ID (Präfix: org-)

Beispiel:

"org-abc123def456"

Abfrageparameter

devin_id
string | null

Body

application/json
prompt
string
erforderlich
attachment_urls
string<uri>[] | null
Required string length: 1 - 2083
bypass_approval
boolean | null
child_playbook_id
string | null
create_as_user_id
string | null
devin_mode
enum<string> | null

Überschreibt den Devin Agent-Modus für die Sitzung. 'normal' verwendet den Standard-Agent-Modus, 'fast' verwendet den Fast-Modus, 'lite' verwendet Devin Lite, 'ultra' verwendet Devin Ultra und 'fusion' verwendet Fusion. Für Preview-Modi gelten dieselben Feature-Flag- und Enterprise-Agent-Preview-Einschränkungen wie für die Web-App.

Verfügbare Optionen:
normal,
fast,
lite,
ultra,
fusion
knowledge_ids
string[] | null
max_acu_limit
integer | null
platform
string | null

Überschreibt die VM-Plattform für die Sitzung (z. B. 'windows'). Wenn kein Wert angegeben ist (oder 'inherit' gesetzt ist), übernimmt eine von einem übergeordneten Devin erstellte Sitzung die Plattform des übergeordneten Devin; andernfalls wird die Standardplattform der Organisation verwendet. Jeder Wert muss mit einer für Ihre Organisation konfigurierten Plattform übereinstimmen (Groß-/Kleinschreibung wird nicht beachtet); unbekannte Werte werden mit einem 400-Fehler abgelehnt, dessen Fehlertext die für die Organisation verfügbaren Plattformbezeichnungen auflistet.

playbook_id
string | null
repos
string[] | null
resumable
boolean
Standard:true

Ob der VM-Status der Sitzung nach dem Beenden beibehalten werden soll, damit die Sitzung fortgesetzt werden kann. Für temporäre Sitzungen auf false setzen.

secret_ids
string[] | null
session_secrets
SessionSecretInput · object[] | null
structured_output_required
boolean | null

Wenn „true“ (Standard), MUSS der Agent provide_structured_output mit is_final=true aufrufen, bevor sein Turn endet. Wenn „false“, ist das Tool verfügbar, aber nicht erforderlich — es ist nicht garantiert, dass es in einem bestimmten Turn aufgerufen wird.

structured_output_schema
Structured Output Schema · object | null

JSON-Schema (Draft 7) zur Validierung strukturierter Ausgaben. Max. 64 KB. Muss in sich abgeschlossen sein (keine externen $ref-Verweise).

tags
string[] | null
title
string | null

Antwort

Erfolgreiche Antwort

acus_consumed
number
erforderlich
created_at
integer
erforderlich
org_id
string
erforderlich
pull_requests
SessionPullRequest · object[]
erforderlich
session_id
string
erforderlich
status
enum<string>
erforderlich
Verfügbare Optionen:
new,
claimed,
running,
exit,
error,
suspended,
resuming
tags
string[]
erforderlich
updated_at
integer
erforderlich
url
string
erforderlich
category
enum<string> | null

Die der Sitzung zugewiesene Anwendungsfallkategorie, falls die Kategorisierung ausgeführt wurde. Nur bei GET-/List-Endpunkten befüllt.

Verfügbare Optionen:
bug_fixing,
ci_cd_and_devops,
code_quality_and_security,
code_review,
code_review_and_analysis,
data_and_automation,
documentation_and_content,
feature_development,
migrations_and_upgrades,
other,
refactoring_and_optimization,
research_and_exploration,
security,
unit_test_generation
child_session_ids
string[] | null
is_archived
boolean
Standard:false
origin
enum<string> | null

Die Quelle, aus der die Sitzung erstellt wurde.

Verfügbare Optionen:
webapp,
slack,
teams,
api,
linear,
jira,
automation,
cli,
desktop,
code_scan,
other
parent_session_id
string | null
playbook_id
string | null
service_user_id
string | null
status_detail
enum<string> | null

Zusätzliche Details zum aktuellen Status der Sitzung. Wenn der Status „running“ ist: „working“ (arbeitet aktiv), „waiting_for_user“ (benötigt Eingaben des Nutzers), „waiting_for_approval“ (wartet im abgesicherten Modus auf die Genehmigung einer Aktion) oder „finished“ (Aufgabe abgeschlossen). Wenn der Status „suspended“ ist: der Grund für die Unterbrechung, z. B. „inactivity“, „user_request“, „usage_limit_exceeded“, „out_of_credits“, „out_of_quota“, „no_quota_allocation“, „payment_declined“, „org_usage_limit_exceeded“, „total_session_limit_exceeded“ oder „error“. Nur bei GET-/List-Endpunkten befüllt.

Verfügbare Optionen:
working,
waiting_for_user,
waiting_for_approval,
finished,
inactivity,
user_request,
usage_limit_exceeded,
out_of_credits,
out_of_quota,
no_quota_allocation,
payment_declined,
org_usage_limit_exceeded,
total_session_limit_exceeded,
error
structured_output
Structured Output · object | null

Validierte strukturierte Ausgabe aus der Session. Wird nur bei GET-/LIST-Endpunkten befüllt.

subcategory
string | null

Der Anzeigename der der Sitzung zugewiesenen Unterkategorie. „Other“, wenn eine Kategorie festgelegt ist, aber keine Unterkategorie zugewiesen oder bezogen werden konnte. Nur bei GET-/List-Endpunkten befüllt.

title
string | null
user_id
string | null