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

# Get alert for run

> Resolve the alert a run triaged or created, used to link an agent run back to its alert.



## OpenAPI

````yaml https://app.cotool.ai/api/docs/openapi.json get /api/alerts/for-run/{runId}
openapi: 3.1.0
info:
  title: Cotool API
  version: 1.0.0
  description: >-
    # Cotool API Documentation


    The Cotool API allows you to interact with the Cotool platform
    programmatically, enabling you to build powerful integrations and automate
    your workflows.


    ## Getting an API Key


    Follow these steps to generate your API key:


    1. **Log in** to the Cotool web interface

    2. **Navigate** to `/settings/api-keys`

    3. **Click** "Generate Key"

    4. **Copy and store** your API key securely ⚠️ *It won't be shown again*


    ## API Key Authentication


    For programmatic access and integrations, use your API key with the
    Authorization header:


    ```http

    Authorization: Bearer your_api_key_here

    ```


    ```bash

    curl -X GET "https://app.cotool.ai/api/endpoint" \
      -H "Authorization: Bearer your_api_key_here" \
      -H "Content-Type: application/json"
    ```
servers:
  - url: https://app.cotool.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /api/alerts/for-run/{runId}:
    get:
      tags:
        - Alerts
      summary: Get alert for run
      description: >-
        Resolve the alert a run triaged or created, used to link an agent run
        back to its alert.
      parameters:
        - in: path
          name: runId
          description: Run UUID (chats.id) to resolve a linked alert for
          schema:
            type: string
            format: uuid
            description: Run UUID (chats.id) to resolve a linked alert for
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  alert:
                    type:
                      - object
                      - 'null'
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Internal alert identifier
                      displayId:
                        type: string
                        pattern: ^COT-\d+$
                        description: Human-readable alert identifier
                      organizationId:
                        type: string
                        format: uuid
                        description: Organization that owns the alert
                      organizationName:
                        type: string
                        minLength: 1
                        description: URL-safe organization name used in durable alert paths
                      title:
                        type: string
                        minLength: 1
                        description: Human-readable alert title
                      description:
                        type:
                          - string
                          - 'null'
                        description: Markdown summary or details for the alert
                      severity:
                        type:
                          - string
                          - 'null'
                        enum:
                          - low
                          - medium
                          - high
                          - critical
                          - null
                        description: Alert severity when known
                      status:
                        type: string
                        enum:
                          - open
                          - in_progress
                          - escalated
                          - closed_true_positive
                          - closed_false_positive
                          - closed_true_positive_benign
                        description: >-
                          Lifecycle status for a first-class alert. Terminal
                          closed statuses include final disposition.
                      source:
                        type: object
                        properties:
                          category:
                            type: string
                            enum:
                              - detection
                              - trigger
                              - hunting
                            description: >-
                              Broad alert source category. Hunting is reserved
                              for future threat-intel exposure alerts.
                          name:
                            type: string
                            enum:
                              - cotool_detection
                              - hunting
                              - jira
                              - jira-automation
                              - slack
                              - linear
                              - cron
                              - webhook
                              - email
                              - bugcrowd
                              - hackerone
                            description: >-
                              Filter-oriented alert source name. Trigger-created
                              alerts use the trigger type.
                          triggerType:
                            type:
                              - string
                              - 'null'
                            enum:
                              - jira
                              - jira-automation
                              - slack
                              - linear
                              - cron
                              - webhook
                              - email
                              - bugcrowd
                              - hackerone
                              - null
                            description: Trigger source when category is trigger
                        required:
                          - category
                          - name
                          - triggerType
                        description: Filter-oriented source attribution for an alert.
                      detection:
                        type:
                          - object
                          - 'null'
                        properties:
                          id:
                            type:
                              - string
                              - 'null'
                            format: uuid
                            description: Cotool detection identifier when known
                          agentId:
                            type:
                              - string
                              - 'null'
                            format: uuid
                            description: Cotool detection agent identifier when known
                          name:
                            type: string
                            minLength: 1
                            description: Detection display name
                          kind:
                            type: string
                            enum:
                              - cotool
                              - external
                            description: >-
                              Whether this detection attribution is internal or
                              extracted
                        required:
                          - id
                          - agentId
                          - name
                          - kind
                        description: Detection attribution for the alert, when known.
                      createdBy:
                        type: string
                        enum:
                          - agent
                          - trigger
                          - system
                        description: Actor class that created the alert.
                      originAgentId:
                        type:
                          - string
                          - 'null'
                        format: uuid
                        description: Agent that produced or owns the source flow
                      originTriggerId:
                        type:
                          - string
                          - 'null'
                        format: uuid
                        description: >-
                          Trigger that created this alert, when source is an
                          external trigger
                      originRunId:
                        type:
                          - string
                          - 'null'
                        format: uuid
                        description: Run that minted the alert, stored as chats.id
                      originDetectionHitId:
                        type:
                          - string
                          - 'null'
                        format: uuid
                        description: >-
                          Detection hit that produced this alert, when
                          applicable
                      externalProvider:
                        type:
                          - string
                          - 'null'
                        enum:
                          - jira
                          - jira-automation
                          - slack
                          - linear
                          - cron
                          - webhook
                          - email
                          - bugcrowd
                          - hackerone
                          - null
                        description: >-
                          External trigger provider such as jira, linear, email,
                          or webhook
                      externalRef:
                        type:
                          - string
                          - 'null'
                        description: >-
                          Provider-native event, ticket, message, or alert
                          identifier
                      externalUrl:
                        type:
                          - string
                          - 'null'
                        format: uri
                        description: Provider-native URL for the originating object
                      assignedAgentId:
                        type:
                          - string
                          - 'null'
                        format: uuid
                        description: Response agent currently assigned to triage this alert
                      triageRunId:
                        type:
                          - string
                          - 'null'
                        format: uuid
                        description: >-
                          Latest response-agent triage run for this alert,
                          stored as chats.id
                      dedupeKey:
                        type:
                          - string
                          - 'null'
                        description: Stable key used for idempotent alert creation
                      createdAt:
                        type: string
                        description: ISO timestamp when the alert was created
                      updatedAt:
                        type: string
                        description: ISO timestamp when the alert was last updated
                      firstTriagedAt:
                        type:
                          - string
                          - 'null'
                        description: ISO timestamp when triage first started
                      resolvedAt:
                        type:
                          - string
                          - 'null'
                        description: >-
                          ISO timestamp when the alert reached a terminal closed
                          status
                      derivedDisposition:
                        type:
                          - string
                          - 'null'
                        enum:
                          - true_positive
                          - false_positive
                          - true_positive_benign
                          - null
                        description: Disposition derived from terminal alert status
                      originAgentName:
                        type:
                          - string
                          - 'null'
                        description: Display name for the origin agent, when available
                      assignedAgentName:
                        type:
                          - string
                          - 'null'
                        description: >-
                          Display name for the assigned triage agent, when
                          available
                      triggerSource:
                        type:
                          - string
                          - 'null'
                        enum:
                          - jira
                          - jira-automation
                          - slack
                          - linear
                          - cron
                          - webhook
                          - email
                          - bugcrowd
                          - hackerone
                          - null
                        description: Trigger source for external-trigger alerts
                    required:
                      - id
                      - displayId
                      - organizationId
                      - organizationName
                      - title
                      - description
                      - severity
                      - status
                      - source
                      - detection
                      - createdBy
                      - originAgentId
                      - originTriggerId
                      - originRunId
                      - originDetectionHitId
                      - externalProvider
                      - externalRef
                      - externalUrl
                      - assignedAgentId
                      - triageRunId
                      - dedupeKey
                      - createdAt
                      - updatedAt
                      - firstTriagedAt
                      - resolvedAt
                      - derivedDisposition
                      - originAgentName
                      - assignedAgentName
                      - triggerSource
                    description: >-
                      Alert this run triaged or created, or null when the run is
                      not linked to an alert
                required:
                  - alert
        '400':
          description: Bad request — input validation failed or the request was malformed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized — missing or invalid API key / session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden — the authenticated user lacks the required permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermissionError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codeSamples:
        - lang: shell
          label: cURL
          source: |-
            curl -X GET "https://app.cotool.ai/api/alerts/for-run/:runId" \
              -H "Authorization: Bearer YOUR_API_KEY" \
              -H "Content-Type: application/json"
components:
  schemas:
    ValidationError:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
        issues:
          type: array
          description: >-
            Detailed validation issues, present when request or response schema
            validation fails
          items:
            type: object
            additionalProperties: true
      required:
        - error
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
      required:
        - error
    PermissionError:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
        missingPerms:
          type: array
          description: Permissions the authenticated user is missing for this operation
          items:
            type: string
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API Key authentication for programmatic access. Include your API key in
        the Authorization header as: `Bearer your_api_key_here`

````