---
title: "Get AI Run"
method: POST
path: "/ai-run/{id}/get-item"
tags: ["AI Run"]
---

# Get AI Run

`POST /ai-run/{id}/get-item`

## Request

- Base URL: `https://oneuptime.com/api`
- URL: `https://oneuptime.com/api/ai-run/{id}/get-item`
- Auth: API key in header `APIKey`
- TypeScript: <https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/docs/ai-run/:id/get-item/post.ts> (a function with typed inputs; its response is checked against the schema)

Endpoint to retrieve a single AI Run by ID

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `select` AIRunSelectSchema: Select schema for AIRun. Set fields to true to include them in the response.
    - `_id` boolean
    - `createdAt` boolean
    - `updatedAt` boolean
    - `deletedAt` boolean
    - `projectId` boolean
    - `runType` boolean
    - `codeFixTaskType` boolean
    - `taskNumber` boolean
    - `status` boolean
    - `codeFixRecommendation` boolean
    - `userId` boolean
    - `conversationId` boolean
    - `triggeredByIncidentId` boolean
    - `triggeredByAlertId` boolean
    - `followUpForAlertId` boolean
    - `ruleWaitMinutes` boolean
    - `llmProviderId` boolean
    - `triggeredByTelemetryExceptionId` boolean
    - `triggeredByAiInsightId` boolean
    - `triggeredBySecurityCaseId` boolean
    - `triggeredByAutoRemediationSuggestionId` boolean
    - `monitorId` boolean
    - `aiAgentId` boolean
    - `attemptCount` boolean
    - `handedBackCount` boolean
    - `startedAt` boolean
    - `completedAt` boolean
    - `lastHeartbeatAt` boolean
    - `llmCallCount` boolean
    - `toolCallCount` boolean
    - `totalTokens` boolean
    - `totalCostInUSDCents` boolean
    - `egressManifest` boolean
    - `codeRepositoryId` boolean
    - `codeTaskId` boolean
    - `needsUserInput` boolean
    - `errorMessage` boolean
    - `analysisTldr` boolean
    - `humanVerdict` boolean
    - `humanVerdictAt` boolean
    - `humanVerdictByUserId` boolean
    - `autoGrade` boolean
    - `autoGradeAt` boolean

## Response `200`

Successful response

- object
  - `data` AIRun
    - `_id` string, uuid: ID of this object. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `createdAt` object: Date and Time when the object was created. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `updatedAt` object: Date and Time when the object was updated. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `deletedAt` object: Date and Time when the object was deleted. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `version` number: Object version
    - `projectId` string, uuid, required: ID of the project this run belongs to. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `runType` 'Chat' | 'Investigation' | 'CodeFix' | 'RemediationPlan' | 'RemediationExecution', required: Type of AI run: Chat or Investigation. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `codeFixTaskType` 'FixException' | 'WriteRegressionTest' | 'ImproveExceptionHandling' | 'ImproveInstrumentation' | 'FixPerformance' | 'ImproveLogging' | 'ImproveTracing' | 'FixFromIncident' | 'GitHubIssueFix' | 'GitHubPullRequestRevision' | 'GitHubPullRequestReview' | 'GitHubPullRequestProductionReview' | 'CodeRequest': For CodeFix runs: which task recipe this run executes (fix the exception, write a regression test, ...). Null means FixException — rows created before task recipes existed. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `taskNumber` number: Per-project sequential number for this AI task (code-fix runs only). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `status` 'Queued' | 'Running' | 'WaitingForApproval' | 'Completed' | 'NoFixFound' | 'Error' | 'Cancelled' | 'Stale', required: Current status of this run. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `codeFixRecommendation` 'Pending' | 'Recommended' | 'NotRecommended', required: For incident/alert investigations: whether the structured investigation outcome recommends opening a code-fix pull request. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `userId` string, uuid: ID of the user who triggered this run. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `conversationId` string, uuid: ID of the conversation this run belongs to. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `triggeredByIncidentId` string, uuid: The incident that triggered this run (for autonomous investigations). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `triggeredByAlertId` string, uuid: The alert that triggered this run (for autonomous investigations). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `followUpForAlertId` string, uuid: For a follow-up check of an incident: the alert that opened on the incident's linked infrastructure after its first investigation and made OneUptime AI check it again. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `ruleWaitMinutes` number: For an investigation an investigation rule made wait: the minutes the rule waited to see whether the incident or alert would still be open. Empty when it started right away. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `llmProviderId` string, uuid: The LLM provider the rule that started this run picked for it. Empty when no rule picked one: the project's default provider, else the global one. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `triggeredByTelemetryExceptionId` string, uuid: The telemetry exception that triggered this run (for code-fix runs). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `triggeredByAiInsightId` string, uuid: The preventive AI insight that triggered this run (for insight triage and insight-created fix runs). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `triggeredBySecurityCaseId` string, uuid: The security case this run triaged (for security case triage runs). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `triggeredByAutoRemediationSuggestionId` string, uuid: The auto-remediation suggestion this planning run picks a runbook for. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `monitorId` string, uuid: The monitor behind the alert that triggered this run — the dedupe key for per-monitor investigation windows. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `aiAgentId` string, uuid: The external AI agent that claimed this run (for code-fix runs executed by an agent container). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `attemptCount` number, required: How many times a worker has claimed this run for execution. Incremented on each claim; the queue stops retrying after the maximum, not counting the claims a server shutting down handed back (Handed Back Count). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `handedBackCount` number, required: How many times a server shutting down handed this run back to the queue for another server to run. Those claims are not counted as failed attempts. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `startedAt` object: When the run started. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `completedAt` object: When the run completed. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `lastHeartbeatAt` object: Last time the run reported progress. Used to detect and fail stale runs. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `llmCallCount` number: Number of LLM calls made during this run. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `toolCallCount` number: Number of tool calls executed during this run. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `totalTokens` number: Total LLM tokens used during this run. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `totalCostInUSDCents` number: Total billed cost of this run in USD cents. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `egressManifest` object: What data was sent to which LLM during this run: provider, model, and per-tool row/byte/redaction counts. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `codeRepositoryId` string, uuid: ID of the repository this code task works in. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `codeTaskId` string, uuid: For a reply in a code task's conversation: the task it continues (the id of the task's first run). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `needsUserInput` boolean: True when the run ended by asking the person who started it a question, and waits for their answer. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `errorMessage` string: Error message if the run failed. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `analysisTldr` string: For investigation runs: a one or two sentence plain-text summary of the posted analysis, generated by AI. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `humanVerdict` 'Confirmed' | 'Rejected': For investigation runs: the one-click human verdict on the posted analysis (Confirmed or Rejected). Null until a user weighs in. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `humanVerdictAt` object: When the human verdict was recorded (or last changed). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `humanVerdictByUserId` string, uuid: The user who recorded (or last changed) the human verdict. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `autoGrade` 'Match' | 'Partial' | 'Mismatch': For investigation runs: how the posted analysis compared to the incident's final recorded root cause (Match, Partial or Mismatch). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]
    - `autoGradeAt` object: When the automatic grade was recorded. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer], Update: [No access - you don't have permission for this operation]

## Other responses

- `400`: Bad request. This response indicates that the request was malformed or contained invalid data.
- `401`: Unauthorized. This response indicates that the request requires user authentication.
- `402`: Payment Required. This response indicates that the request requires payment or a valid subscription.
- `403`: Forbidden. This response indicates that the server understood the request, but refuses to authorize it.
- `404`: Not found. The record does not exist, belongs to another project, or is one you may not read - the same answer for each.
- `405`: Project not found. This response indicates that the requested project does not exist or is not accessible.
- `408`: Request Timeout. This response indicates that the server timed out waiting for the request.
- `415`: Unable to reach server. This response indicates that the server is currently unreachable or down.
- `422`: Not authorized. This response indicates that the user does not have permission to access the requested resource.
- `500`: Internal Server Error. This response indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

---

[API](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification.md) - [All operations](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/revisions/ba3307d00304?raw)
