> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://devin.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://devin.ferndocs.com/_mcp/server.

# Get session insights

GET https://api.devin.ai/v3/enterprise/sessions/{devin_id}/insights

Get detailed insights for a specific session, including message counts,
session size classification, and AI-generated analysis.

Reference: https://devin.ferndocs.com/api-reference/v-3/get-account-session-insights

## Authentication

- `Authorization` header (bearer token, required) — Personal API Key (apk_user_*) or Service API Key (apk_*)

## Request

### Path parameters

- `devin_id` (string, required) — Devin session ID (prefix: devin-)

### Query parameters

- `org_id` (string, optional, nullable)

## Response

### 200

Successful Response

- `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)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### 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: [])

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### 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)

### ValidationErrorLocItems

### 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
{
  "acus_consumed": 12.5,
  "created_at": 1686806400,
  "num_devin_messages": 15,
  "num_user_messages": 20,
  "org_id": "org-456def",
  "pull_requests": [
    {
      "state": "open",
      "url": "https://github.com/example/repo/pull/42"
    }
  ],
  "session_id": "devin-abc123def456",
  "session_size": "m",
  "status": "running",
  "tags": [
    "authentication",
    "bugfix",
    "security"
  ],
  "updated_at": 1686810000,
  "url": "https://app.devin.ai/sessions/devin-abc123def456",
  "analysis": {
    "action_items": [
      {
        "action_item": "Refactor authentication module to improve security",
        "issue_id": "issue-789",
        "type": "repo_config"
      }
    ],
    "classification": {
      "category": "bug_fixing",
      "confidence": 0.92,
      "programming_languages": [
        "Python",
        "JavaScript"
      ],
      "tools_and_frameworks": [
        "Django",
        "React"
      ]
    },
    "issues": [
      {
        "impact": "High",
        "issue": "Memory leak detected in data processing pipeline",
        "label": "bug",
        "id": "issue-123"
      }
    ],
    "note_usage": {
      "bad_usages": [
        {
          "message": "Deprecated API usage in module X",
          "note_id": "note-456",
          "reason": "Causes compatibility issues with latest SDK"
        }
      ],
      "good_usages": [
        {
          "message": "Implemented caching to reduce database load",
          "note_id": "note-789",
          "reason": "Improves performance and scalability"
        }
      ]
    },
    "suggested_prompt": {
      "original_prompt": "Fix bugs in the authentication flow",
      "suggested_prompt": "Refactor authentication flow to handle edge cases and improve security",
      "feedback_items": [
        {
          "details": "Consider specifying the error handling strategy more clearly",
          "excerpt": "Handle exceptions gracefully in the API layer",
          "summary": "Improve error handling",
          "issue_id": "issue-123"
        }
      ]
    },
    "timeline": [
      {
        "description": "Session started and initial analysis performed",
        "title": "Session Start",
        "color": "green",
        "issue_id": null
      }
    ]
  },
  "category": "bug_fixing",
  "child_session_ids": [
    "devin-xyz987abc654"
  ],
  "is_archived": false,
  "origin": "webapp",
  "parent_session_id": "devin-parent123",
  "playbook_id": "playbook-789ghi",
  "service_user_id": "service-user-123",
  "status_detail": "working",
  "structured_output": {
    "summary": "Fixed critical bugs in authentication and improved session stability",
    "metrics": {
      "tests_passed": 120,
      "tests_failed": 0
    }
  },
  "subcategory": "Authentication",
  "title": "Authentication Bug Fix Session",
  "user_id": "user-789xyz"
}
```

**SDK Code**

```python
import requests

url = "https://api.devin.ai/v3/enterprise/sessions/devin-abc123def456/insights"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "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/devin-abc123def456/insights';
const options = {
  method: 'GET',
  headers: {Authorization: 'Bearer <token>', '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/devin-abc123def456/insights"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", 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(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.devin.ai/v3/enterprise/sessions/devin-abc123def456/insights")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
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<String> response = Unirest.get("https://api.devin.ai/v3/enterprise/sessions/devin-abc123def456/insights")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.devin.ai/v3/enterprise/sessions/devin-abc123def456/insights', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.devin.ai/v3/enterprise/sessions/devin-abc123def456/insights");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "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/devin-abc123def456/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()
```