> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://devin.ferndocs.com/api-reference/v-3/get-account-sessions-insights/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://devin.ferndocs.com/_mcp/server. # List sessions with insights GET https://api.devin.ai/v3/enterprise/sessions/insights List sessions with detailed insights including message counts, session size classification, and AI-generated analysis. Reference: https://devin.ferndocs.com/api-reference/v-3/get-account-sessions-insights ## Authentication - `Authorization` header (bearer token, required) — Personal API Key (apk_user_*) or Service API Key (apk_*) ## Request ### Query parameters - `after` (string, optional, nullable) - `first` (integer, optional, default: 100) - `session_ids` (list of string, optional, nullable) - `created_after` (integer, optional, nullable) - `created_before` (integer, optional, nullable) - `updated_after` (integer, optional, nullable) - `updated_before` (integer, optional, nullable) - `tags` (list of string, optional, nullable) - `playbook_id` (string, optional, nullable) - `origins` (list of enum, optional, nullable) - Allowed values: `webapp`, `slack`, `teams`, `api`, `linear`, `jira`, `automation`, `cli`, `desktop`, `other` - `schedule_id` (string, optional, nullable) - `user_ids` (list of string, optional, nullable) - `service_user_ids` (list of string, optional, nullable) - `category` (enum, optional, nullable) - Allowed values: `bug_fixing`, `ci_cd_and_devops`, `code_quality_and_security`, `code_review_and_analysis`, `data_and_automation`, `documentation_and_content`, `feature_development`, `migrations_and_upgrades`, `other`, `refactoring_and_optimization`, `research_and_exploration`, `unit_test_generation` - `org_ids` (list of string, optional, nullable) - `include_deleted_orgs` (boolean, optional, default: false) ## Response ### 200 Successful Response - `items` (list of SessionInsightsResponse, required) - `end_cursor` (string, optional, nullable) — Cursor to fetch the next page, or None if this is the last page. - `has_next_page` (boolean, optional, default: false) — Whether there are more items available after this page. - `total` (integer, optional, nullable) — Optional total count (can be omitted for performance). ## Errors ### 422 Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ## Types ### SessionInsightsResponse Session details augmented with quantitative metrics and AI analysis. Extends SessionResponse with additional fields that require extra queries. - `acus_consumed` (double, required) — Total ACUs consumed by this session so far. - `created_at` (integer, required) — Unix timestamp (seconds) when the session was created. - `num_devin_messages` (integer, required) — Number of Devin messages sent during the session. - `num_user_messages` (integer, required) — Number of user messages sent during the session. - `org_id` (string, required) — Organization that owns this session (prefix org-). - `pull_requests` (list of SessionPullRequest, required) — Pull requests created by this session. - `session_id` (string, required) — Unique session identifier (prefix devin-). - `session_size` (enum, required) — Session size classification based on ACU usage and message count. - Allowed values: `xs`, `s`, `m`, `l`, `xl` - `status` (enum, required) — Current lifecycle status: running, suspended, stopped, or blocked. - Allowed values: `new`, `claimed`, `running`, `exit`, `error`, `suspended`, `resuming` - `tags` (list of string, required) — Tags applied to this session. - `updated_at` (integer, required) — Unix timestamp (seconds) of the last session update. - `url` (string, required) — URL to view the session in the Devin web app. - `analysis` (SessionInsightsAnalysis, optional, nullable) — AI-generated session analysis. None if analysis has not completed. - `category` (enum, optional, nullable) — The session's assigned use-case category, if categorisation has run. Only populated on get/list endpoints. - Allowed values: `bug_fixing`, `ci_cd_and_devops`, `code_quality_and_security`, `code_review_and_analysis`, `data_and_automation`, `documentation_and_content`, `feature_development`, `migrations_and_upgrades`, `other`, `refactoring_and_optimization`, `research_and_exploration`, `unit_test_generation` - `child_session_ids` (list of string, optional, nullable) - `is_archived` (boolean, optional, default: false) - `origin` (enum, optional, nullable) — The origin from which the session was created. - Allowed values: `webapp`, `slack`, `teams`, `api`, `linear`, `jira`, `automation`, `cli`, `desktop`, `other` - `parent_session_id` (string, optional, nullable) - `playbook_id` (string, optional, nullable) - `service_user_id` (string, optional, nullable) - `status_detail` (enum, optional, nullable) — Additional detail about the session's current status. When status is 'running': 'working' (actively working), 'waiting_for_user' (needs user input), 'waiting_for_approval' (awaiting action approval in safe mode), or 'finished' (task complete). When status is 'suspended': the reason for suspension such as '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', or 'error'. Only populated on get/list endpoints. - Allowed values: `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` (map from string to any, optional, nullable) — Validated structured output from the session. Only populated on get/list endpoints. - `subcategory` (string, optional, nullable) — The session's assigned subcategory display name. 'Other' when a category is set but no subcategory was assigned or resolved. Only populated on get/list endpoints. - `title` (string, optional, nullable) — Human-readable session title. - `user_id` (string, optional, nullable) ### ValidationError - `loc` (list of ValidationErrorLocItems, required) - `msg` (string, required) - `type` (string, required) ### SessionPullRequest - `pr_state` (string, required, nullable) - `pr_url` (string, required) ### SessionInsightsAnalysis AI-generated analysis data from a completed session analysis. - `action_items` (list of SessionInsightsActionItem, optional, default: []) - `classification` (SessionInsightsClassification, optional, nullable) - `issues` (list of SessionInsightsIssue, optional, default: []) - `note_usage` (SessionInsightsNoteUsage, optional, nullable) - `suggested_prompt` (SessionInsightsSuggestedPrompt, optional, nullable) - `timeline` (list of SessionInsightsTimelineEvent, optional, default: []) ### ValidationErrorLocItems ### SessionInsightsActionItem - `action_item` (string, required) - `issue_id` (string, optional, nullable) - `type` (enum, optional, default: other) - Allowed values: `machine_setup`, `repo_config`, `knowledge`, `prompt_improvement`, `other` ### SessionInsightsClassification - `category` (string, required) - `confidence` (double, required) - `programming_languages` (list of string, optional, default: []) - `tools_and_frameworks` (list of string, optional, default: []) ### SessionInsightsIssue - `impact` (string, required) - `issue` (string, required) - `label` (string, required) - `id` (string, optional, default: ) ### SessionInsightsNoteUsage - `bad_usages` (list of SessionInsightsNoteUsageItem, optional, default: []) - `good_usages` (list of SessionInsightsNoteUsageItem, optional, default: []) ### SessionInsightsSuggestedPrompt - `original_prompt` (string, required) - `suggested_prompt` (string, required) - `feedback_items` (list of SessionInsightsFeedbackItem, optional, default: []) ### SessionInsightsTimelineEvent - `description` (string, required) - `title` (string, required) - `color` (string, optional, default: ) - `issue_id` (string, optional, nullable) ### SessionInsightsNoteUsageItem - `message` (string, required) - `note_id` (string, required) - `reason` (string, required) ### SessionInsightsFeedbackItem - `details` (string, required) - `excerpt` (string, required) - `summary` (string, required) - `issue_id` (string, optional, nullable) ## Examples **Request** ```json {} ``` **Response** ```json { "items": [ { "acus_consumed": 12.7, "created_at": 1688208000, "num_devin_messages": 5, "num_user_messages": 12, "org_id": "org-5678", "pull_requests": [ { "state": "open", "url": "https://github.com/example/repo/pull/42" } ], "session_id": "session-1234", "session_size": "m", "status": "running", "tags": [ "authentication", "bugfix", "urgent" ], "updated_at": 1688294400, "url": "https://app.devin.ai/sessions/session-1234", "analysis": { "action_items": [ { "action_item": "Update repository configuration to enable branch protection rules.", "issue_id": "ISSUE-1234", "type": "repo_config" } ], "classification": { "category": "bug_fixing", "confidence": 0.92, "programming_languages": [ "Python", "JavaScript" ], "tools_and_frameworks": [ "Django", "React" ] }, "issues": [ { "impact": "High", "issue": "Uncaught exception in user authentication flow.", "label": "bug", "id": "ISSUE-1234" } ], "note_usage": { "bad_usages": [ { "message": "Note lacks context about the error handling.", "note_id": "note-789", "reason": "Insufficient detail" } ], "good_usages": [ { "message": "Clear explanation of the fix applied to the login module.", "note_id": "note-456", "reason": "Well documented" } ] }, "suggested_prompt": { "original_prompt": "Fix login error", "suggested_prompt": "Fix uncaught exception in user authentication flow", "feedback_items": [ { "details": "Consider specifying the error type in the prompt for better accuracy.", "excerpt": "Fix login error", "summary": "Prompt could be more specific", "issue_id": "ISSUE-1234" } ] }, "timeline": [ { "description": "Session started and initial analysis began.", "title": "Session Start", "color": "green", "issue_id": null }, { "description": "Waiting for user input to proceed with fix.", "title": "User Input Required", "color": "yellow", "issue_id": null } ] }, "category": "bug_fixing", "child_session_ids": [ "session-2345" ], "is_archived": false, "origin": "webapp", "parent_session_id": null, "playbook_id": "playbook-9012", "service_user_id": "svc-user-3456", "status_detail": "working", "structured_output": { "summary": "Fixed authentication bug causing login failures.", "files_changed": 3, "tests_passed": true }, "subcategory": "Authentication", "title": "Fix login authentication bug", "user_id": "user-7890" } ], "end_cursor": "eyJwYWdlIjoxfQ==", "has_next_page": true, "total": 1 } ``` **SDK Code** ```python import requests url = "https://api.devin.ai/v3/enterprise/sessions/insights" payload = {} headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.get(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.devin.ai/v3/enterprise/sessions/insights'; const options = { method: 'GET', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.devin.ai/v3/enterprise/sessions/insights" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.devin.ai/v3/enterprise/sessions/insights") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.devin.ai/v3/enterprise/sessions/insights") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('GET', 'https://api.devin.ai/v3/enterprise/sessions/insights', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.devin.ai/v3/enterprise/sessions/insights"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.devin.ai/v3/enterprise/sessions/insights")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```