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

# Get the build analysis of an application

> Returns the latest build of the service that can be analysed and its latest analysis, if any. Only one analysis is kept per service.



## OpenAPI

````yaml /api-reference/openapi.yaml get /application/{applicationId}/buildAnalysis
openapi: 3.0.0
info:
  version: 1.0.4
  title: Qovery API
  description: >
    - Qovery is the fastest way to deploy your full-stack apps on any Cloud
    provider.

    - ℹ️ The API is stable and still in development.
  contact:
    name: Qovery Product Team
    url: https://www.qovery.com
    email: support+api+documentation@qovery.com
  x-logo:
    url: https://console.qovery.com/assets/logos/logo-white.svg
    altText: Qovery
servers:
  - url: https://api.qovery.com
security:
  - bearerAuth: []
  - ApiKeyAuth: []
tags:
  - name: Account
  - name: Account Info
  - name: IPs
  - name: Alert Receivers
  - name: Alert Rules
  - name: Admin
  - name: ArgoCD
  - name: Agentic Workflows
  - name: Application
  - name: Application Actions
  - name: Application Build Analysis
  - name: Application Configuration
  - name: Application Database
  - name: Application Deployment Restriction
  - name: Application Deployment History
  - name: Application Environment Variable
  - name: Application Logs
  - name: Application Main Calls
  - name: Application Secret
  - name: Application Annotations Group
  - name: Applications
  - name: AutoscalingPolicy
  - name: Container
  - name: Container Actions
  - name: Container Configuration
  - name: Container Database
  - name: Container Deployment History
  - name: Container Environment Variable
  - name: Container Logs
  - name: Container Main Calls
  - name: Container Registry
  - name: Container Secret
  - name: Container Annotations Group
  - name: Containers
  - name: Deployment Stage Main Calls
  - name: Job
  - name: Job Actions
  - name: Job Build Analysis
  - name: Job Configuration
  - name: Job Database
  - name: Job Deployment Restriction
  - name: Job Deployment History
  - name: Job Environment Variable
  - name: Job Logs
  - name: Job Main Calls
  - name: Job Registry
  - name: Job Secret
  - name: Job Annotations Group
  - name: Jobs
  - name: KedaTriggerAuthentication
  - name: Helm
  - name: Helm Actions
  - name: Helm Configuration
  - name: Helm Database
  - name: Helm Deployment Restriction
  - name: Helm Deployment History
  - name: Helm Logs
  - name: Helm Main Calls
  - name: Helm Repository
  - name: Helms
  - name: Backups
  - name: Billing
  - name: Blueprint Catalog
  - name: Cloud Provider
  - name: Cloud Provider Credentials
  - name: Clusters
  - name: Cluster Deployment History
  - name: Cluster Operator
  - name: Platform Configuration
  - name: Custom Domain
  - name: Container Custom Domain
  - name: LLM Providers
  - name: MCP Servers
  - name: Database
  - name: Database Actions
  - name: Database Application
  - name: Database Container
  - name: Database Deployment History
  - name: Database Main Calls
  - name: Database Annotations Group
  - name: Databases
  - name: Environment
  - name: Environment Actions
  - name: Environment Deployment History
  - name: Environment Deployment Rule
  - name: Environment Logs
  - name: Environment Main Calls
  - name: Environment Secret
  - name: Environment Variable
  - name: Environments
  - name: Git
  - name: Github App
  - name: Git repositories
  - name: Members
  - name: Organization
  - name: Organization Account Git Repositories
  - name: Organization Cluster Lock
  - name: Organization Main Calls
  - name: Organization Custom Role
  - name: Organization Event
  - name: Organization Api Token
  - name: Organization Policy Api Token
  - name: Organization Webhook
  - name: Organization Annotations Group
  - name: Organization Labels Group
  - name: Organization Enterprise Connection
  - name: Project
  - name: Project Deployment Rule
  - name: Project Environment Variable
  - name: Project Main Calls
  - name: Project Secret
  - name: Projects
  - name: Referral & Rewards
  - name: Secret Manager Access
  - name: Terraforms
  - name: Terraform Main Calls
  - name: Terraform Resources
  - name: Terraform Deployment History
  - name: Terraform Deployment Restriction
  - name: Container Registries
  - name: Helm Repositories
  - name: User Sign Up
  - name: Variable Main Calls
  - name: Helm Custom Domain
  - name: Lifecycle Template Main Calls
  - name: Blueprint Main Calls
paths:
  /application/{applicationId}/buildAnalysis:
    get:
      tags:
        - Application Build Analysis
      summary: Get the build analysis of an application
      description: >-
        Returns the latest build of the service that can be analysed and its
        latest analysis, if any. Only one analysis is kept per service.
      operationId: getApplicationBuildAnalysis
      parameters:
        - $ref: '#/components/parameters/applicationId'
      responses:
        '200':
          description: Latest analysable build and latest analysis
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuildAnalysisState'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
components:
  parameters:
    applicationId:
      name: applicationId
      in: path
      description: Application ID
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    BuildAnalysisState:
      type: object
      required:
        - latest_build_execution_id
        - analysis
      properties:
        latest_build_execution_id:
          type: string
          nullable: true
          description: >-
            Execution id of the latest build of the service, the only build that
            can be analysed. Null when no deployment in the kept history ran a
            build.
        analysis:
          type: object
          allOf:
            - $ref: '#/components/schemas/BuildAnalysisResponse'
          nullable: true
          description: The latest analysis of the service. Null when none was run.
    BuildAnalysisResponse:
      type: object
      required:
        - service_id
        - execution_id
        - status
        - stale
        - dockerfile_source
        - failure_code
        - failure_reason
        - result
        - created_at
        - updated_at
      properties:
        service_id:
          type: string
          format: uuid
        execution_id:
          type: string
          description: Execution id of the analysed build.
          example: 6e5c1d3a-6b6f-4c35-9a2f-8f1d2c3b4a5e-42
        status:
          $ref: '#/components/schemas/BuildAnalysisStatus'
        stale:
          type: boolean
          description: >-
            True when the latest build of the service is not the analysed one.
            The analysis stays readable, but only the latest build can be
            analysed.
        dockerfile_source:
          $ref: '#/components/schemas/BuildAnalysisDockerfileSource'
        failure_code:
          type: string
          allOf:
            - $ref: '#/components/schemas/BuildAnalysisFailureCode'
          nullable: true
          description: Why the analysis failed, when `status` is FAILED.
        failure_reason:
          type: string
          nullable: true
          description: Human-readable detail of the failure, when `status` is FAILED.
        result:
          type: object
          allOf:
            - $ref: '#/components/schemas/BuildAnalysisResult'
          nullable: true
          description: Set when `status` is DONE.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    BuildAnalysisStatus:
      type: string
      description: >-
        PENDING is queued, COLLECTING reads the build logs and the cache
        history, ANALYSING waits for the model, then DONE or FAILED.
      enum:
        - PENDING
        - COLLECTING
        - ANALYSING
        - DONE
        - FAILED
    BuildAnalysisDockerfileSource:
      type: string
      description: >-
        Where the analysed Dockerfile came from. GIT is the repository at the
        build commit, INLINE the Dockerfile stored on the job, PASTE a
        Dockerfile pasted by the user.
      enum:
        - GIT
        - INLINE
        - PASTE
    BuildAnalysisFailureCode:
      type: string
      description: >-
        COPILOT_DISABLED when the organization opted out of AI features,
        MODEL_ERROR when the model call failed or returned an invalid result,
        TIMEOUT when the analysis took too long, INTERNAL_ERROR otherwise.
      enum:
        - COPILOT_DISABLED
        - MODEL_ERROR
        - TIMEOUT
        - INTERNAL_ERROR
    BuildAnalysisResult:
      type: object
      required:
        - confidence
        - assets_reviewed
        - summary
        - improvements
        - agent_prompt
        - estimated_time_saved
        - dockerfile
        - dockerfile_rationale
      properties:
        confidence:
          $ref: '#/components/schemas/BuildAnalysisConfidence'
        estimated_time_saved:
          type: object
          allOf:
            - $ref: '#/components/schemas/BuildAnalysisTimeSaved'
          nullable: true
          description: >-
            Build time saved on each build once every improvement is applied.
            Null when there is nothing to save or no timing to base it on.
            `confidence` applies to this range.
        assets_reviewed:
          type: array
          items:
            $ref: '#/components/schemas/BuildAnalysisAsset'
        summary:
          type: string
          description: What slows the build and why, with the evidence from the build.
        improvements:
          type: array
          description: >-
            Changes to make, one sentence each, ordered by impact on build time,
            highest first. Empty when the build is already efficient.
          items:
            type: string
          example:
            - >-
              Copy package.json and package-lock.json before the rest of the
              code, so the install stays cached until dependencies change
        dockerfile:
          type: string
          nullable: true
          description: >-
            Reworked Dockerfile to copy. Null when no improvement is a
            Dockerfile change, for example a variable value. Values hidden from
            the analysis appear as `<redacted>` and must be put back before use.
        dockerfile_rationale:
          type: string
          nullable: true
          description: Why the reworked Dockerfile is faster.
        agent_prompt:
          type: string
          description: >-
            Prompt the customer pastes into their own AI agent to apply the
            improvements in their repository.
    BuildAnalysisConfidence:
      type: string
      description: >-
        How sure the analysis is that applying the improvements saves
        `estimated_time_saved`. HIGH when the build logs, the cache history or
        the build metrics show both the cause and the time it costs, MEDIUM when
        one of the two is inferred, LOW when only the Dockerfile suggests it or
        there is no time estimate. With no improvement, how sure the analysis is
        that the build has nothing left to gain.
      enum:
        - HIGH
        - MEDIUM
        - LOW
    BuildAnalysisTimeSaved:
      type: object
      description: >-
        Seconds saved on each build, as a range from min_seconds to max_seconds.
        When nothing is saved, the field holding it is null instead.
      required:
        - min_seconds
        - max_seconds
      properties:
        min_seconds:
          type: integer
          minimum: 0
          example: 50
        max_seconds:
          type: integer
          minimum: 0
          example: 90
    BuildAnalysisAsset:
      type: string
      description: >-
        What the analysis read. DOCKERFILE and BUILD_SETTINGS (build
        configuration and build argument names) are always read, DOCKERIGNORE
        when Qovery could check the repository for it, BUILD_LOGS when the build
        or earlier builds sharing its cache have logs.
      enum:
        - DOCKERFILE
        - DOCKERIGNORE
        - BUILD_LOGS
        - BUILD_SETTINGS
  responses:
    '401':
      description: Access token is missing or invalid
    '403':
      description: Access forbidden
    '404':
      description: Resource not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT tokens should be used with OIDC account (human to machine). JWT
        tokens used by the Qovery console to communicate with the API have a
        TTL. Curl Example ' curl https://console.qovery.com/organization -H
        "Authorization: Bearer $qovery_token" '
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Token API are generated by Qovery to manage machine to machine
        interaction and do not have a TTL. Curl Example ' curl
        https://console.qovery.com/organization -H "Authorization: Token
        $qovery_token" '

````

## Related topics

- [Get the build analysis of a job](https://www.qovery.com/docs/api-reference/job-build-analysis/get-the-build-analysis-of-a-job.md)
- [Get application status](https://www.qovery.com/docs/api-reference/application-main-calls/get-application-status.md)
- [Get application by ID](https://www.qovery.com/docs/api-reference/application-main-calls/get-application-by-id.md)
- [Get cluster analysis](https://www.qovery.com/docs/api-reference/clusters/get-cluster-analysis.md)
- [Deploy Your First Application](https://www.qovery.com/docs/getting-started/guides/getting-started/deploy-your-first-application.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.