Passer au contenu principal
POST
/
v3
/
organizations
/
{org_id}
/
sessions
Créer une session
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>",
  "advanced_mode": "analyze",
  "attachment_urls": [
    "<string>"
  ],
  "bypass_approval": true,
  "child_playbook_id": "<string>",
  "create_as_user_id": "<string>",
  "knowledge_ids": [
    "<string>"
  ],
  "max_acu_limit": 123,
  "playbook_id": "<string>",
  "repos": [
    "<string>"
  ],
  "secret_ids": [
    "<string>"
  ],
  "session_links": [
    "<string>"
  ],
  "session_secrets": [
    {
      "key": "<string>",
      "value": "<string>",
      "sensitive": true
    }
  ],
  "structured_output_schema": {},
  "tags": [
    "<string>"
  ],
  "title": "<string>"
}
'
{
  "acus_consumed": 123,
  "created_at": 123,
  "org_id": "<string>",
  "pull_requests": [
    {
      "pr_state": "<string>",
      "pr_url": "<string>"
    }
  ],
  "session_id": "<string>",
  "status": "new",
  "tags": [
    "<string>"
  ],
  "updated_at": 123,
  "url": "<string>",
  "child_session_ids": [
    "<string>"
  ],
  "is_advanced": false,
  "is_archived": false,
  "parent_session_id": "<string>",
  "playbook_id": "<string>",
  "service_user_id": "<string>",
  "status_detail": "working",
  "structured_output": {},
  "title": "<string>",
  "user_id": "<string>"
}

Autorisations

Nécessite un compte de service disposant de l’autorisation ManageOrgSessions au niveau de l’organisation.

Autorisations supplémentaires pour les fonctions avancées

FonctionnalitéAutorisation requise
create_as_user_idImpersonateOrgSessions

Usurpation d’identité d’un utilisateur

Le paramètre create_as_user_id permet de créer une session sur le compte d’un autre utilisateur. Cela nécessite :
  1. Le compte de service doit disposer de l’autorisation ImpersonateOrgSessions
  2. L’utilisateur cible doit être membre de l’organisation
  3. L’utilisateur cible doit disposer de l’autorisation UseDevinSessions

Autorisations

Authorization
string
header
requis

Identifiant de compte de service (préfixe : cog_)

Corps

application/json
prompt
string
requis
advanced_mode
enum<string> | null
Options disponibles:
analyze,
create,
improve,
batch,
manage
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
knowledge_ids
string[] | null
max_acu_limit
integer | null
playbook_id
string | null
repos
string[] | null
secret_ids
string[] | null
session_secrets
SessionSecretInput · object[] | null
structured_output_schema
Structured Output Schema · object

JSON Schema (Draft 7) pour la validation de la sortie structurée. Taille maximale : 64 Ko. Doit être autonome (aucune référence externe via $ref).

tags
string[] | null
title
string | null

Réponse

Réponse réussie

acus_consumed
number
requis
created_at
integer
requis
org_id
string
requis
pull_requests
SessionPullRequest · object[]
requis
session_id
string
requis
status
enum<string>
requis
Options disponibles:
new,
creating,
claimed,
running,
exit,
error,
suspended,
resuming
tags
string[]
requis
updated_at
integer
requis
url
string
requis
child_session_ids
string[] | null
is_advanced
boolean
défaut:false
is_archived
boolean
défaut:false
parent_session_id
string | null
playbook_id
string | null
service_user_id
string | null
status_detail
enum<string> | null

Informations supplémentaires sur le statut actuel de la session. Lorsque status est égal à 'running' : 'working' (travail en cours), 'waiting_for_user' (en attente d’une intervention de l’utilisateur), 'waiting_for_approval' (en attente de l’approbation d’une action en mode sécurisé) ou 'finished' (tâche terminée). Lorsque status est égal à 'suspended' : le motif de la suspension, par exemple 'inactivity', 'user_request', 'usage_limit_exceeded', 'out_of_credits', 'out_of_quota', 'no_quota_allocation', 'payment_declined', 'org_usage_limit_exceeded' ou 'error'. Renseigné uniquement sur les endpoints get/list.

Options disponibles:
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,
error
structured_output
Structured Output · object

Sortie structurée validée provenant de la session. Renseignée uniquement sur les endpoints GET/list.

title
string | null
user_id
string | null