Skip to content

AI Analyses

Request and retrieve AI-generated analyses of productivity data, including Chao analysis types for chain health monitoring and actionable insights.

Endpoints

MethodPathDescriptionAuthRate Limit
GET/ai/analysesList analysesJWT + Entitlement60/min
GET/ai/analyses/:idGet an analysisJWT + Entitlement60/min
POST/ai/analysesCreate an analysisJWT + Entitlement10/min

GET /ai/analyses

List all analyses for the authenticated user.

Request

  • Auth: JWT Bearer token + active AI entitlement required
  • Rate limit: 60/min
  • No path or query parameters

Response

Response Example
json
{
  "data": [
    {
      "id": "cm5analysis01",
      "type": "streak",
      "targetType": "chain",
      "targetId": "cm5chain01",
      "status": "completed",
      "createdAt": "2026-03-17T10:00:00.000Z"
    }
  ],
  "meta": {
    "total": 1
  }
}
Response Fields
FieldTypeDescription
idstringAnalysis ID
typestringAnalysis type
targetTypestringTarget entity type
targetIdstringTarget entity ID
statusstringpending, running, completed, failed
sourcestring | nullAnalysis source (chao, system, manual)
evidencearray | nullSupporting evidence data
chainyIdstring | nullLinked Chainy ID
createdAtstringISO 8601

Code Examples

bash
curl https://api.chainabit.com/api/v1/ai/analyses \
  -H "Authorization: Bearer $TOKEN"
javascript
const res = await fetch(`${BASE_URL}/ai/analyses`, {
  headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data, meta } = await res.json();
python
import requests

res = requests.get(
    f"{BASE_URL}/ai/analyses",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
body = res.json()

GET /ai/analyses/:id

Get the full details and result of a specific analysis.

Request

  • Auth: JWT Bearer token + active AI entitlement required
  • Rate limit: 60/min
  • Path params: id — use the id from Create an Analysis's response (data.id) as $ANALYSIS_ID

Response

Response Example
json
{
  "data": {
    "id": "cm5analysis01",
    "type": "streak",
    "targetType": "chain",
    "targetId": "cm5chain01",
    "status": "completed",
    "result": {
      "summary": "Your vocabulary practice chain shows strong consistency with 85% completion rate over the past 6 weeks.",
      "insights": [
        "You tend to miss completions on weekends",
        "Your longest streak was 12 days in February",
        "Morning completions correlate with higher retention scores"
      ],
      "recommendations": [
        "Set a weekend-specific reminder at 10 AM",
        "Consider shorter weekend sessions to maintain streaks"
      ]
    },
    "createdAt": "2026-03-17T10:00:00.000Z"
  }
}
Response Fields
FieldTypeDescription
idstringAnalysis ID
typestringAnalysis type
targetTypestringTarget entity type
targetIdstringTarget entity ID
statusstringpending, running, completed, failed
sourcestring | nullAnalysis source (chao, system, manual)
evidencearray | nullSupporting evidence data
chainyIdstring | nullLinked Chainy ID
result.summarystringSummary text
result.insightsstring[]Key insights
result.recommendationsstring[]Action recommendations
createdAtstringISO 8601

Code Examples

bash
curl https://api.chainabit.com/api/v1/ai/analyses/$ANALYSIS_ID \
  -H "Authorization: Bearer $TOKEN"
javascript
const analysisId = process.env.ANALYSIS_ID; // id of the analysis to fetch

const res = await fetch(`${BASE_URL}/ai/analyses/${analysisId}`, {
  headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await res.json();
python
import os
import requests

analysis_id = os.environ["ANALYSIS_ID"]  # id of the analysis to fetch

res = requests.get(
    f"{BASE_URL}/ai/analyses/{analysis_id}",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]

POST /ai/analyses

Create a new AI analysis for a target entity.

Request

  • Auth: JWT Bearer token + active AI entitlement required
  • Rate limit: 10/min
  • targetId must be the id of an existing entity matching targetType — e.g. a chain's id from Create Chain, shown below as $CHAIN_ID.
Request Body
FieldTypeRequiredConstraintsDescription
typestringYesstreak, productivity, routine, time, chainy_health, continuity, blocker, focus, recoveryAnalysis type
targetTypestringYeschain, chainy, bitTarget entity type
targetIdstringYesValid entity IDID of the target entity
dateRangeobjectNoISO 8601 dates{ from: string, to: string }

Response

Response Example
json
{
  "data": {
    "id": "cm5analysis01",
    "type": "streak",
    "targetType": "chain",
    "targetId": "cm5chain01",
    "status": "completed",
    "result": {
      "summary": "Your vocabulary practice chain shows strong consistency with 85% completion rate over the past 6 weeks.",
      "insights": [
        "You tend to miss completions on weekends",
        "Your longest streak was 12 days in February",
        "Morning completions correlate with higher retention scores"
      ],
      "recommendations": [
        "Set a weekend-specific reminder at 10 AM",
        "Consider shorter weekend sessions to maintain streaks"
      ]
    },
    "createdAt": "2026-03-17T10:00:00.000Z"
  }
}
Response Fields
FieldTypeDescription
idstringAnalysis ID
typestringAnalysis type
targetTypestringTarget entity type
targetIdstringTarget entity ID
statusstringpending, running, completed, failed
sourcestring | nullAnalysis source (chao, system, manual)
evidencearray | nullSupporting evidence data
chainyIdstring | nullLinked Chainy ID
result.summarystringSummary text
result.insightsstring[]Key insights
result.recommendationsstring[]Action recommendations
createdAtstringISO 8601

Code Examples

bash
curl -X POST https://api.chainabit.com/api/v1/ai/analyses \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "streak",
    "targetType": "chain",
    "targetId": "'"$CHAIN_ID"'",
    "dateRange": {
      "from": "2026-02-01T00:00:00Z",
      "to": "2026-03-17T23:59:59Z"
    }
  }'
javascript
const chainId = process.env.CHAIN_ID; // id of the chain to analyze

const res = await fetch(`${BASE_URL}/ai/analyses`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    type: "streak",
    targetType: "chain",
    targetId: chainId,
    dateRange: {
      from: "2026-02-01T00:00:00Z",
      to: "2026-03-17T23:59:59Z",
    },
  }),
});
const { data } = await res.json();
python
import os
import requests

chain_id = os.environ["CHAIN_ID"]  # id of the chain to analyze

res = requests.post(
    f"{BASE_URL}/ai/analyses",
    headers={
        "Authorization": f"Bearer {TOKEN}",
        "Content-Type": "application/json",
    },
    json={
        "type": "streak",
        "targetType": "chain",
        "targetId": chain_id,
        "dateRange": {
            "from": "2026-02-01T00:00:00Z",
            "to": "2026-03-17T23:59:59Z",
        },
    },
)
data = res.json()["data"]

Chao Analysis Types

TypeDescriptionKey Output Fields
chainy_healthComposite health score (0-100) from active chain ratio, streak health, velocity, and fragmentationhealthScore, signals, breakdown
continuityIdentifies chains at risk of streak break, broken streaks, and strong performersatRisk, broken, strong
blockerDetects stalled chains with zero/declining progressstalled, declining
routineTime-of-day and day-of-week completion pattern analysispeakHours, peakDays, patterns
focusChain attention distribution, identifies neglected vs over-served chainsdistribution, neglected, dominant
recoveryStructured recovery plan for broken streaks with prioritized next actionsrecoveryPlan (array of {chainTitle, action, recommendation, priority})

Note: Chao analyses may automatically generate pending suggestions (proposals) when actionable findings are detected. These proposals are always created with source: 'chao' and require explicit user approval — Chao never auto-applies changes.

Built with purpose.