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

# Retrieve GitOps logs

> API key must have the `View GitOps logs` permission.



## OpenAPI

````yaml /openapi/cortex_swagger.json get /api/v1/gitops-logs
openapi: 3.0.1
info:
  description: >-
    The Cortex REST API provides programmatic access to the data in the catalog,
    Scorecards, and more.
  title: Cortex API
  version: v1
servers:
  - url: https://api.getcortexapp.com
    description: Cortex Cloud API host
security:
  - bearerAuth: []
tags:
  - name: API Keys
  - name: Audit Logs
  - name: Catalog Entities
  - name: Catalogs
  - name: Custom Data
  - name: Custom Data [Advanced]
  - name: Custom Events
  - name: Custom Metrics
  - name: Dependencies
  - name: Deploys
  - name: Discovery Audit
  - name: Docs
  - name: 'Eng Intel: 1-Registry'
  - name: 'Eng Intel: 2-Metrics'
  - name: 'Eng Intel: 3-Trace'
  - name: 'Eng Intel: User Labels'
  - name: Entity Relationship Types
  - name: Entity Relationships
  - name: Entity Types
  - name: GitOps Logs
  - name: Groups
  - name: IP Allowlist
  - name: Initiatives
  - name: My Workspace
  - name: Notification Logs
  - name: On-call
  - name: Packages
  - name: Plugins
  - name: Queries
  - name: SCIM
  - name: Scaffolder
  - name: Scorecards
  - name: Secrets
  - name: Team Roles
  - name: Teams
  - name: Teams Hierarchies
  - name: Teams [Advanced]
  - name: Teams [Departments] (legacy)
  - name: Users
  - name: Verifications
  - name: Workflows
  - name: '[Integrations] AWS'
  - name: '[Integrations] Anthropic'
  - name: '[Integrations] Apiiro'
  - name: '[Integrations] ArgoCD'
  - name: '[Integrations] Azure Active Directory'
  - name: '[Integrations] Azure Devops'
  - name: '[Integrations] Azure Resources'
  - name: '[Integrations] BambooHR'
  - name: '[Integrations] Bitbucket'
  - name: '[Integrations] Bugsnag'
  - name: '[Integrations] Buildkite'
  - name: '[Integrations] Checkmarx SAST'
  - name: '[Integrations] CircleCI'
  - name: '[Integrations] ClickUp'
  - name: '[Integrations] Codecov'
  - name: '[Integrations] Coralogix'
  - name: '[Integrations] Datadog'
  - name: '[Integrations] Dynatrace'
  - name: '[Integrations] Firehydrant'
  - name: '[Integrations] GitHub'
  - name: '[Integrations] GitLab'
  - name: '[Integrations] Harness'
  - name: '[Integrations] Incident.io'
  - name: '[Integrations] Instana'
  - name: '[Integrations] Jenkins'
  - name: '[Integrations] Jira'
  - name: '[Integrations] Kubernetes'
  - name: '[Integrations] LaunchDarkly'
  - name: '[Integrations] Lightstep'
  - name: '[Integrations] Mend SAST'
  - name: '[Integrations] Mend SCA'
  - name: '[Integrations] New Relic'
  - name: '[Integrations] Okta'
  - name: '[Integrations] Opsgenie'
  - name: '[Integrations] PagerDuty'
  - name: '[Integrations] Prometheus'
  - name: '[Integrations] Rollbar'
  - name: '[Integrations] Rootly'
  - name: '[Integrations] Semgrep'
  - name: '[Integrations] Sentry'
  - name: '[Integrations] ServiceNow'
  - name: '[Integrations] SignalFx'
  - name: '[Integrations] Snyk'
  - name: '[Integrations] SonarQube'
  - name: '[Integrations] SumoLogic'
  - name: '[Integrations] Veracode'
  - name: '[Integrations] VictorOps'
  - name: '[Integrations] Wiz'
  - name: '[Integrations] Workday'
  - name: '[Integrations] xMatters'
  - name: dev-login-controller
  - name: public-scim-schema-controller
paths:
  /api/v1/gitops-logs:
    get:
      tags:
        - GitOps Logs
      summary: Retrieve GitOps logs
      description: API key must have the `View GitOps logs` permission.
      operationId: listGitOpsLogs
      parameters:
        - description: File name the within repository
          in: query
          name: file
          schema:
            type: string
        - description: Repository name as defined in your Git provider
          in: query
          name: repository
          required: false
          schema:
            type: string
        - description: Commit SHA
          in: query
          name: sha
          required: false
          schema:
            type: string
        - description: Filter by error only
          in: query
          name: errorOnly
          required: false
          schema:
            type: boolean
        - description: Filter by operation
          in: query
          name: operation
          required: false
          schema:
            type: string
            enum:
              - CREATED
              - UPDATED
              - ARCHIVED
              - NO_CHANGE
        - description: Page number to return, 0-indexed. Default 0.
          in: query
          name: page
          required: true
          schema:
            type: integer
            format: int32
            default: 0
        - description: >-
            Number of results to return per page, between 1 and 1000. Default
            250.
          in: query
          name: pageSize
          required: true
          schema:
            type: integer
            format: int32
            default: 250
        - in: query
          name: fileName
          required: false
          schema:
            type: string
        - description: Unique tag for the Scorecard.
          in: query
          name: scorecardTag
          required: true
          schema:
            type: string
        - in: query
          name: workflowTag
          required: false
          schema:
            type: string
        - description: The entity tag (`x-cortex-tag`) that identifies the entity.
          in: query
          name: tag
          required: true
          schema:
            type: string
            description: The entity tag (`x-cortex-tag`) that identifies the entity.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GitOpsLogPaginatedResponse'
          description: Retrieve GitOps logs based on given criteria
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    GitOpsLogPaginatedResponse:
      required:
        - logs
        - page
        - total
        - totalPages
      type: object
      properties:
        logs:
          type: array
          items:
            $ref: '#/components/schemas/GitOpsLogResponse'
        page:
          type: integer
          description: Current page number, 0-indexed
          format: int32
        total:
          type: integer
          description: Total number of results
          format: int32
        totalPages:
          type: integer
          description: Total number of pages
          format: int32
    GitOpsLogResponse:
      required:
        - commit
        - dateCreated
        - files
        - repository
      type: object
      properties:
        commit:
          type: string
        dateCreated:
          type: string
          format: date-time
        files:
          type: array
          items:
            $ref: '#/components/schemas/GitOpsLogFileResponse'
        repository:
          $ref: '#/components/schemas/GitOpsLogRepositoryResponse'
    TooManyRequestsProblemDetail:
      required:
        - type
        - title
        - status
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
          format: uri-reference
        retryAfter:
          minimum: 0
          type: integer
          description: The number of seconds until the rate limiting resets.
          format: int32
        status:
          maximum: 599
          minimum: 100
          type: integer
          format: int32
          enum:
            - 429
        title:
          type: string
        type:
          type: string
          format: uri-reference
    GitOpsLogFileResponse:
      required:
        - fileName
        - isPackageFile
      type: object
      properties:
        entity:
          $ref: '#/components/schemas/GitOpsLogEntityChange'
        error:
          $ref: '#/components/schemas/GitOpsLogFileErrorResponse'
        fileName:
          type: string
        isPackageFile:
          type: boolean
        scorecard:
          $ref: '#/components/schemas/GitOpsLogScorecardChange'
        workflow:
          $ref: '#/components/schemas/GitOpsLogWorkflowChange'
    GitOpsLogRepositoryResponse:
      required:
        - provider
        - repositoryName
      type: object
      properties:
        provider:
          type: string
          description: Git provider (GitHub, GitLab, etc.)
          enum:
            - AZURE_DEVOPS
            - BITBUCKET
            - GITHUB
            - GITLAB
        repositoryName:
          type: string
          description: Repository name as defined in your Git provider
          example: cortexapps/catalog
    GitOpsLogEntityChange:
      required:
        - name
        - operation
        - tag
        - type
      type: object
      properties:
        name:
          type: string
        operation:
          type: string
          enum:
            - CREATED
            - UPDATED
            - ARCHIVED
            - NO_CHANGE
        tag:
          type: string
        type:
          type: string
    GitOpsLogFileErrorResponse:
      required:
        - errorType
        - message
      type: object
      properties:
        errorType:
          type: string
        message:
          type: string
    GitOpsLogScorecardChange:
      required:
        - name
        - operation
        - tag
      type: object
      properties:
        name:
          type: string
        operation:
          type: string
          enum:
            - CREATED
            - UPDATED
            - ARCHIVED
            - NO_CHANGE
        tag:
          type: string
    GitOpsLogWorkflowChange:
      required:
        - name
        - operation
        - tag
      type: object
      properties:
        name:
          type: string
        operation:
          type: string
          enum:
            - CREATED
            - UPDATED
            - ARCHIVED
            - NO_CHANGE
        tag:
          type: string
  responses:
    TooManyRequests:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/TooManyRequestsProblemDetail'
      description: >-
        The client has exceeded the rate limit by performing too many requests
        in a short period. Retry the request after a delay.
      headers:
        Retry-After:
          description: The number of seconds until the rate limiting resets.
          schema:
            minimum: 0
            type: integer
            format: int32
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: >-
        All requests to the Cortex API need to provide an `Authorization: Bearer
        <token>` header, where `<token>` is an API key created in the Settings
        page of your workspace.
      scheme: bearer
      type: http

````

## Related topics

- [GitOps logs](/configure/gitops/gitops-logs.md)
- [GitOps Logs](/api/rest/gitops-logs.md)
- [Retrieve most recent GitOps log for entity](/api/rest/catalog-entities/retrieve-most-recent-gitops-log-for-entity.md)
