> ## Documentation Index
> Fetch the complete documentation index at: https://developer.kallglot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Request Analysis

> Request post-session analysis for an existing transcript

Request AI-powered analysis for a session transcript.

## Path Parameters

<ParamField path="id" type="string" required>
  The unique session identifier (for example, `sess_01HXYZ123456789`).
</ParamField>

## Request Body

<ParamField body="profile" type="string">
  Optional analysis profile. Defaults to `default`.
</ParamField>

<ParamField body="include" type="array">
  Analysis components to include. Allowed values:

  * `summary`
  * `sentiment`
  * `compliance`
  * `keywords`
  * `performance`
</ParamField>

## Billing and Access

Successful `POST /v1/sessions/{id}/analysis` requests currently consume 1 API credit.

The request succeeds only when:

1. the session belongs to the authenticated organization
2. the session transcript is available
3. the organization subscription is active
4. the organization has at least 1 API credit remaining

## Response Headers

| Header                    | Description                                           |
| ------------------------- | ----------------------------------------------------- |
| `X-Request-ID`            | Stable request identifier                             |
| `X-RateLimit-Limit`       | Rate-limit window maximum                             |
| `X-RateLimit-Remaining`   | Requests remaining in the current window              |
| `X-RateLimit-Reset`       | Unix timestamp when the rate limit resets             |
| `X-API-Credits-Remaining` | Remaining credits after a successful analysis request |
| `X-API-Credits-Used`      | Credits used in the current billing period            |

## Response

Successful creates return **`202 Accepted`** with the initial analysis object below (usually `processing`). Poll [`GET /v1/analyses/{id}`](/api-reference/analysis/retrieve) or subscribe to events until status becomes `completed` or `failed`.

<ResponseField name="id" type="string">
  Unique analysis identifier.
</ResponseField>

<ResponseField name="object" type="string">
  Always `analysis`.
</ResponseField>

<ResponseField name="session_id" type="string">
  The session being analyzed.
</ResponseField>

<ResponseField name="status" type="string">
  Current analysis status. Immediate create responses return `processing`.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.kallglot.com/v1/sessions/sess_01HXYZ123456789/analysis \
    -H "Authorization: Bearer sk_live_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "profile": "default",
      "include": ["summary", "sentiment", "compliance", "keywords", "performance"]
    }'
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'

  session_id = 'sess_01HXYZ123456789'
  uri = URI("https://api.kallglot.com/v1/sessions/#{session_id}/analysis")
  request = Net::HTTP::Post.new(uri)
  request['Authorization'] = "Bearer #{ENV['KALLGLOT_API_KEY']}"
  request['Content-Type'] = 'application/json'
  request.body = {
    profile: 'default',
    include: %w[summary sentiment compliance keywords performance]
  }.to_json

  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end

  analysis = JSON.parse(response.body)
  puts "Analysis started: #{analysis['id']}"
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "net/http"
      "os"
  )

  func main() {
      sessionID := "sess_01HXYZ123456789"
      payload := map[string]any{
          "profile": "default",
          "include": []string{"summary", "sentiment", "compliance", "keywords", "performance"},
      }
      body, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", "https://api.kallglot.com/v1/sessions/"+sessionID+"/analysis", bytes.NewBuffer(body))
      req.Header.Set("Authorization", "Bearer "+os.Getenv("KALLGLOT_API_KEY"))
      req.Header.Set("Content-Type", "application/json")

      resp, _ := http.DefaultClient.Do(req)
      defer resp.Body.Close()

      var analysis map[string]any
      json.NewDecoder(resp.Body).Decode(&analysis)
      fmt.Printf("Analysis started: %s\n", analysis["id"])
  }
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.kallglot.com/v1/sessions/sess_01HXYZ123456789/analysis',
      headers={
          'Authorization': 'Bearer sk_live_your_api_key',
          'Content-Type': 'application/json'
      },
      json={
          'profile': 'default',
          'include': ['summary', 'sentiment', 'compliance', 'keywords', 'performance']
      }
  )

  analysis = response.json()
  print(f"Analysis started: {analysis['id']}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.kallglot.com/v1/sessions/sess_01HXYZ123456789/analysis', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_live_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      profile: 'default',
      include: ['summary', 'sentiment', 'compliance', 'keywords', 'performance']
    })
  });

  const analysis = await response.json();
  console.log(`Analysis started: ${analysis.id}`);
  ```
</RequestExample>

<ResponseExample>
  ```json 202 theme={null}
  {
    "id": "anl_01HDEF456789012",
    "object": "analysis",
    "session_id": "sess_01HXYZ123456789",
    "status": "processing"
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": "transcript_not_available",
      "message": "Session transcript is not available for analysis",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": "insufficient_api_credits",
      "message": "API credits exhausted. Purchase more credits to continue.",
      "type": "permission_error"
    }
  }
  ```

  ```json 403 theme={null}
  {
    "error": {
      "code": "organization_inactive",
      "message": "Organization subscription is inactive",
      "type": "permission_error"
    }
  }
  ```
</ResponseExample>
