向会话发送消息
curl --request POST \
--url https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"attachment_urls": [
"<string>"
],
"message_as_user_id": "<string>"
}
'import requests
url = "https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages"
payload = {
"message": "<string>",
"attachment_urls": ["<string>"],
"message_as_user_id": "<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({
message: '<string>',
attachment_urls: ['<string>'],
message_as_user_id: '<string>'
})
};
fetch('https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages', 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/enterprise/sessions/{devin_id}/messages",
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([
'message' => '<string>',
'attachment_urls' => [
'<string>'
],
'message_as_user_id' => '<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/enterprise/sessions/{devin_id}/messages"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"message_as_user_id\": \"<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/enterprise/sessions/{devin_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"message_as_user_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages")
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 \"message\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"message_as_user_id\": \"<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>",
"status": "new",
"tags": [
"<string>"
],
"updated_at": 123,
"url": "<string>",
"automation_id": "<string>",
"category": "bug_fixing",
"child_session_ids": [
"<string>"
],
"devin_mode": "normal",
"is_archived": false,
"origin": "webapp",
"parent_session_id": "<string>",
"playbook_id": "<string>",
"service_user_id": "<string>",
"status_detail": "working",
"structured_output": {},
"subcategory": "<string>",
"title": "<string>",
"user_id": "<string>"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}会话(企业级)
向会话发送消息
向活跃会话发送消息。如果会话已被挂起,将自动恢复。
POST
/
v3
/
enterprise
/
sessions
/
{devin_id}
/
messages
向会话发送消息
curl --request POST \
--url https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"attachment_urls": [
"<string>"
],
"message_as_user_id": "<string>"
}
'import requests
url = "https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages"
payload = {
"message": "<string>",
"attachment_urls": ["<string>"],
"message_as_user_id": "<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({
message: '<string>',
attachment_urls: ['<string>'],
message_as_user_id: '<string>'
})
};
fetch('https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages', 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/enterprise/sessions/{devin_id}/messages",
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([
'message' => '<string>',
'attachment_urls' => [
'<string>'
],
'message_as_user_id' => '<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/enterprise/sessions/{devin_id}/messages"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"message_as_user_id\": \"<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/enterprise/sessions/{devin_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"message_as_user_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/enterprise/sessions/{devin_id}/messages")
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 \"message\": \"<string>\",\n \"attachment_urls\": [\n \"<string>\"\n ],\n \"message_as_user_id\": \"<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>",
"status": "new",
"tags": [
"<string>"
],
"updated_at": 123,
"url": "<string>",
"automation_id": "<string>",
"category": "bug_fixing",
"child_session_ids": [
"<string>"
],
"devin_mode": "normal",
"is_archived": false,
"origin": "webapp",
"parent_session_id": "<string>",
"playbook_id": "<string>",
"service_user_id": "<string>",
"status_detail": "working",
"structured_output": {},
"subcategory": "<string>",
"title": "<string>",
"user_id": "<string>"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}devin_id 是在会话 ID 前加上前缀 devin- 后得到的值 (例如:devin-abc123) 。权限
ManageAccountSessions 权限的服务用户。授权
服务用户凭据(前缀:cog_)
路径参数
Devin 会话 ID(前缀:devin-)
示例:
"devin-abc123def456"
查询参数
请求体
application/json
响应
成功响应
Show child attributes
Show child attributes
可用选项:
new, claimed, running, exit, error, suspended, resuming 创建此会话的自动化 ID(如有)。
如果已完成分类,则为会话分配的用例类别。仅在 get/list 端点中返回。
可用选项:
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, production_investigation, refactoring_and_optimization, research_and_exploration, security, unit_test_generation 创建会话时使用的 Devin Agent 模式,已解析 org/user 默认设置和父会话继承。若会话运行的是没有对应模式的 Agent 预览,则为 None。
可用选项:
normal, fast, lite, ultra, fusion 该会话的创建来源。
可用选项:
webapp, slack, teams, api, linear, jira, automation, cli, desktop, code_scan, other 会话当前状态的附加信息。当 status 为“running”时:可为“working”(正在处理)、“waiting_for_user”(需要用户输入)、“waiting_for_approval”(在安全模式下等待操作批准)或“finished”(任务已完成)。当 status 为“suspended”时:表示挂起原因,例如“inactivity”“user_request”“usage_limit_exceeded”“out_of_credits”“out_of_quota”“no_quota_allocation”“payment_declined”“org_usage_limit_exceeded”“user_usage_limit_exceeded”“total_session_limit_exceeded”或“error”。仅在 get/list 端点中返回。
可用选项:
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, user_usage_limit_exceeded, total_session_limit_exceeded, error 来自会话的已验证结构化输出。仅在 GET/LIST 端点中返回。
为会话分配的子类别显示名称。若已设置类别但未分配或未解析出子类别,则为“Other”。仅在 get/list 端点中返回。

