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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.kosli.com/feedback

```json
{
  "path": "/api-reference/trails/list-trails-for-organization",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# List trails for organization

> Get a paginated list of trails for an organization based on filters provided as query parameters.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json get /trails/{org}
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /trails/{org}:
    get:
      tags:
        - Trails
      summary: List trails for organization
      description: >-
        Get a paginated list of trails for an organization based on filters
        provided as query parameters.
      operationId: list_trails_for_org_trails__org__get
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
        - name: flow
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The name of the flow to filter trails by
            title: Flow
          description: The name of the flow to filter trails by
        - name: flow_tag
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Filter trails by flows that have this tag (format: key=value,
              e.g., team=backend)
            title: Flow Tag
          description: >-
            Filter trails by flows that have this tag (format: key=value, e.g.,
            team=backend)
        - name: fingerprint
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The fingerprint of the artifact reported to the trail or trails
            title: Fingerprint
          description: The fingerprint of the artifact reported to the trail or trails
        - name: page
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: The page number of response
            default: 1
            title: Page
          description: The page number of response
        - name: per_page
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: How many results to return per page of response
            default: 20
            title: Per Page
          description: How many results to return per page of response
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListTrails'
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    ListTrails:
      properties:
        data:
          items:
            $ref: '#/components/schemas/ListTrailItem'
          type: array
          title: Data
          description: List of trails
        pagination:
          anyOf:
            - $ref: '#/components/schemas/ListTrailsPagination'
            - type: 'null'
          description: Pagination info (only present when there are multiple pages)
      type: object
      required:
        - data
      title: ListTrails
      description: >-
        Response model for listing Trails with pagination.


        When pagination is not requested, returns a list of trails directly.

        When pagination is requested, returns data with optional pagination
        info.
    ListTrailItem:
      properties:
        name:
          type: string
          title: Name
          description: Name of the trail
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the trail
        git_commit_info:
          anyOf:
            - $ref: '#/components/schemas/GitCommitInfo'
            - type: 'null'
          description: Git commit information for the trail
        origin_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Origin Url
          description: Origin URL where the trail was reported from
        user_data:
          anyOf:
            - additionalProperties: true
              type: object
            - items: {}
              type: array
            - type: 'null'
          title: User Data
          description: User-defined data attached to the trail
        repo_ids:
          items:
            type: string
          type: array
          title: Repo Ids
          description: List of repository IDs associated with the trail
        last_modified_at:
          type: number
          title: Last Modified At
          description: Timestamp when the trail was last modified
        created_at:
          type: number
          title: Created At
          description: Timestamp when the trail was created
        compliance_status:
          $ref: '#/components/schemas/TrailComplianceStatus'
          description: Compliance status of the trail
        template:
          $ref: '#/components/schemas/Template'
          description: Flow template associated with the trail
        compliance_state:
          type: string
          enum:
            - INCOMPLETE
            - COMPLIANT
            - NON-COMPLIANT
          title: Compliance State
          description: Overall compliance state of the trail
        is_compliant:
          type: boolean
          title: Is Compliant
          description: Whether the trail is compliant
        events:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Events
          description: List of events that occurred on the trail
        created_by:
          type: string
          title: Created By
          description: Display name of the user who created the trail
        flow:
          $ref: '#/components/schemas/FlowInfo'
          description: Information about the flow containing this trail
        external_urls:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/ExternalUrl'
              type: object
            - type: 'null'
          title: External Urls
          description: External URLs associated with the trail
        html_url:
          type: string
          title: Html Url
          description: URL of the trail's web page
      type: object
      required:
        - name
        - last_modified_at
        - created_at
        - compliance_status
        - template
        - compliance_state
        - is_compliant
        - created_by
        - flow
        - html_url
      title: ListTrailItem
      description: A trail item in the list trails response.
    ListTrailsPagination:
      properties:
        total:
          type: integer
          title: Total
          description: Total number of trails
        page:
          type: integer
          title: Page
          description: Current page number
        per_page:
          type: integer
          title: Per Page
          description: Number of items per page
        page_count:
          type: integer
          title: Page Count
          description: Total number of pages
      type: object
      required:
        - total
        - page
        - per_page
        - page_count
      title: ListTrailsPagination
      description: Pagination info for list trails response.
    GitCommitInfo:
      properties:
        sha1:
          type: string
          title: Sha1
          description: The SHA-1 hash of the commit
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: The commit message
        author:
          anyOf:
            - type: string
            - type: 'null'
          title: Author
          description: The commit author
        branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Branch
          description: The branch name
        timestamp:
          anyOf:
            - type: number
            - type: 'null'
          title: Timestamp
          description: The commit timestamp
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: The commit URL
      type: object
      required:
        - sha1
      title: GitCommitInfo
      description: |-
        Git commit information response model.

        Excludes author_username, parents, and url from JSON when not present.
    TrailComplianceStatus:
      properties:
        status:
          type: string
          enum:
            - INCOMPLETE
            - COMPLIANT
            - NON-COMPLIANT
          title: Status
          description: Overall compliance status of the trail
        is_compliant:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Compliant
          description: Whether the trail is compliant
        attestations_statuses:
          items:
            $ref: '#/components/schemas/AttestationComplianceStatus'
          type: array
          title: Attestations Statuses
          description: Trail-level attestation statuses
        artifacts_statuses:
          additionalProperties:
            $ref: '#/components/schemas/ArtifactComplianceStatus'
          type: object
          title: Artifacts Statuses
          description: Artifact compliance statuses keyed by artifact name
        evaluated_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Evaluated At
          description: Timestamp when compliance was evaluated
        flow_template_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Flow Template Id
          description: ID of the flow template used for evaluation
      type: object
      required:
        - status
      title: TrailComplianceStatus
      description: Trail compliance status response model.
    Template:
      properties:
        version:
          type: integer
          const: 1
          title: Version
          description: Template version
          default: 1
        trail:
          $ref: '#/components/schemas/TemplateTrailDefinition'
          description: Trail definition in the template
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: Raw YAML content of the template
      additionalProperties: false
      type: object
      required:
        - trail
      title: Template
      description: Flow template response model.
    FlowInfo:
      properties:
        name:
          type: string
          title: Name
          description: Name of the flow
        tags:
          additionalProperties:
            type: string
          type: object
          title: Tags
          description: Tags associated with the flow
      type: object
      required:
        - name
      title: FlowInfo
      description: Flow information in trail response.
    ExternalUrl:
      properties:
        href:
          type: string
          title: Href
          description: The URL
        fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Fingerprint
          description: Optional fingerprint associated with the URL
      type: object
      required:
        - href
      title: ExternalUrl
      description: External URL with optional fingerprint for GetTrail response.
    AttestationComplianceStatus:
      properties:
        attestation_name:
          type: string
          title: Attestation Name
          description: Name of the attestation
        attestation_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Attestation Type
          description: Type of the attestation
        attestation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Attestation Id
          description: ID of the attestation
        overridden_attestation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Overridden Attestation Id
          description: ID of the override attestation if overridden
        status:
          anyOf:
            - type: string
              enum:
                - MISSING
                - COMPLETE
            - type: 'null'
          title: Status
          description: Status of the attestation
        is_compliant:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Compliant
          description: Whether the attestation is compliant
        unexpected:
          type: boolean
          title: Unexpected
          description: Whether the attestation was unexpected
          default: false
      type: object
      required:
        - attestation_name
      title: AttestationComplianceStatus
      description: Attestation compliance status in a trail.
    ArtifactComplianceStatus:
      properties:
        artifact_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Artifact Fingerprint
          description: SHA-256 fingerprint of the artifact
        artifact_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Artifact Id
          description: ID of the artifact
        status:
          type: string
          enum:
            - MISSING
            - INCOMPLETE
            - COMPLIANT
            - NON-COMPLIANT
          title: Status
          description: Compliance status of the artifact
        is_compliant:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Compliant
          description: Whether the artifact is compliant
        attestations_statuses:
          items:
            $ref: '#/components/schemas/AttestationComplianceStatus'
          type: array
          title: Attestations Statuses
          description: Compliance statuses of attestations
        unexpected:
          type: boolean
          title: Unexpected
          description: Whether the artifact was unexpected
          default: false
        evaluated_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Evaluated At
          description: Timestamp when compliance was evaluated
        flow_template_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Flow Template Id
          description: ID of the flow template used for evaluation
      type: object
      required:
        - status
      title: ArtifactComplianceStatus
      description: Artifact compliance status within a trail.
    TemplateTrailDefinition:
      properties:
        attestations:
          items:
            $ref: '#/components/schemas/TemplateAttestation'
          type: array
          title: Attestations
          description: Trail-level attestations
        artifacts:
          items:
            $ref: '#/components/schemas/TemplateArtifact'
          type: array
          title: Artifacts
          description: Artifacts defined in the template
      additionalProperties: false
      type: object
      title: TemplateTrailDefinition
      description: Trail definition within a template.
    TemplateAttestation:
      properties:
        name:
          type: string
          title: Name
          description: Name of the attestation
        type:
          type: string
          title: Type
          description: Type of the attestation
      additionalProperties: false
      type: object
      required:
        - name
        - type
      title: TemplateAttestation
      description: Attestation definition in a template.
    TemplateArtifact:
      properties:
        name:
          type: string
          title: Name
          description: Name of the artifact
        attestations:
          items:
            $ref: '#/components/schemas/TemplateAttestation'
          type: array
          title: Attestations
          description: List of attestations for this artifact
      additionalProperties: false
      type: object
      required:
        - name
      title: TemplateArtifact
      description: Artifact definition in a template.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````