新建会话
curl --request POST \
--url https://api.devin.ai/v1/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"idempotent": false,
"knowledge_ids": [
"<string>"
],
"max_acu_limit": 1,
"playbook_id": "<string>",
"secret_ids": [
"<string>"
],
"session_secrets": [
{
"key": "<string>",
"value": "<string>",
"sensitive": true
}
],
"snapshot_id": "<string>",
"structured_output_schema": {},
"tags": [
"<string>"
],
"title": "<string>",
"unlisted": false
}
'import requests
url = "https://api.devin.ai/v1/sessions"
payload = {
"prompt": "<string>",
"idempotent": False,
"knowledge_ids": ["<string>"],
"max_acu_limit": 1,
"playbook_id": "<string>",
"secret_ids": ["<string>"],
"session_secrets": [
{
"key": "<string>",
"value": "<string>",
"sensitive": True
}
],
"snapshot_id": "<string>",
"structured_output_schema": {},
"tags": ["<string>"],
"title": "<string>",
"unlisted": False
}
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>',
idempotent: false,
knowledge_ids: ['<string>'],
max_acu_limit: 1,
playbook_id: '<string>',
secret_ids: ['<string>'],
session_secrets: [{key: '<string>', value: '<string>', sensitive: true}],
snapshot_id: '<string>',
structured_output_schema: {},
tags: ['<string>'],
title: '<string>',
unlisted: false
})
};
fetch('https://api.devin.ai/v1/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/v1/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>',
'idempotent' => false,
'knowledge_ids' => [
'<string>'
],
'max_acu_limit' => 1,
'playbook_id' => '<string>',
'secret_ids' => [
'<string>'
],
'session_secrets' => [
[
'key' => '<string>',
'value' => '<string>',
'sensitive' => true
]
],
'snapshot_id' => '<string>',
'structured_output_schema' => [
],
'tags' => [
'<string>'
],
'title' => '<string>',
'unlisted' => false
]),
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/v1/sessions"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"idempotent\": false,\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 1,\n \"playbook_id\": \"<string>\",\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"snapshot_id\": \"<string>\",\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\",\n \"unlisted\": false\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/v1/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"idempotent\": false,\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 1,\n \"playbook_id\": \"<string>\",\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"snapshot_id\": \"<string>\",\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\",\n \"unlisted\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v1/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 \"idempotent\": false,\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 1,\n \"playbook_id\": \"<string>\",\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"snapshot_id\": \"<string>\",\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\",\n \"unlisted\": false\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"url": "<string>",
"is_new_session": true
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}会话端点
新建会话
创建一个新的 Devin 会话。可以选择性地指定快照 ID 和会话可见性等参数。
POST
/
v1
/
sessions
新建会话
curl --request POST \
--url https://api.devin.ai/v1/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"idempotent": false,
"knowledge_ids": [
"<string>"
],
"max_acu_limit": 1,
"playbook_id": "<string>",
"secret_ids": [
"<string>"
],
"session_secrets": [
{
"key": "<string>",
"value": "<string>",
"sensitive": true
}
],
"snapshot_id": "<string>",
"structured_output_schema": {},
"tags": [
"<string>"
],
"title": "<string>",
"unlisted": false
}
'import requests
url = "https://api.devin.ai/v1/sessions"
payload = {
"prompt": "<string>",
"idempotent": False,
"knowledge_ids": ["<string>"],
"max_acu_limit": 1,
"playbook_id": "<string>",
"secret_ids": ["<string>"],
"session_secrets": [
{
"key": "<string>",
"value": "<string>",
"sensitive": True
}
],
"snapshot_id": "<string>",
"structured_output_schema": {},
"tags": ["<string>"],
"title": "<string>",
"unlisted": False
}
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>',
idempotent: false,
knowledge_ids: ['<string>'],
max_acu_limit: 1,
playbook_id: '<string>',
secret_ids: ['<string>'],
session_secrets: [{key: '<string>', value: '<string>', sensitive: true}],
snapshot_id: '<string>',
structured_output_schema: {},
tags: ['<string>'],
title: '<string>',
unlisted: false
})
};
fetch('https://api.devin.ai/v1/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/v1/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>',
'idempotent' => false,
'knowledge_ids' => [
'<string>'
],
'max_acu_limit' => 1,
'playbook_id' => '<string>',
'secret_ids' => [
'<string>'
],
'session_secrets' => [
[
'key' => '<string>',
'value' => '<string>',
'sensitive' => true
]
],
'snapshot_id' => '<string>',
'structured_output_schema' => [
],
'tags' => [
'<string>'
],
'title' => '<string>',
'unlisted' => false
]),
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/v1/sessions"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"idempotent\": false,\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 1,\n \"playbook_id\": \"<string>\",\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"snapshot_id\": \"<string>\",\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\",\n \"unlisted\": false\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/v1/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"idempotent\": false,\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 1,\n \"playbook_id\": \"<string>\",\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"snapshot_id\": \"<string>\",\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\",\n \"unlisted\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v1/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 \"idempotent\": false,\n \"knowledge_ids\": [\n \"<string>\"\n ],\n \"max_acu_limit\": 1,\n \"playbook_id\": \"<string>\",\n \"secret_ids\": [\n \"<string>\"\n ],\n \"session_secrets\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"sensitive\": true\n }\n ],\n \"snapshot_id\": \"<string>\",\n \"structured_output_schema\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"title\": \"<string>\",\n \"unlisted\": false\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"url": "<string>",
"is_new_session": true
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}授权
个人 API Key(apk_user_*)或服务 API Key(apk_*)
请求体
application/json
要使用的 Knowledge ID 列表。若为 None,则使用全部 Knowledge;若为空列表,则不使用任何 Knowledge。
ACU 最大值,必须为正数
必填范围:
x > 0要使用的密钥 ID 列表。如果为 None,则表示使用所有密钥;如果为空列表,则表示不使用任何密钥。
要使用的会话专用机密列表。这些机密仅在当前会话中可用,不会存入组织机密中。
Show child attributes
Show child attributes
用于验证结构化输出的 JSON Schema(Draft 7),最大 64 KB。必须是自包含的(不得引用外部 $ref)。
要添加到本次会话的标签列表。
Maximum array length:
50会话的自定义标题。如果为 None,则会自动生成标题。
⌘I

