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

# Get branch pull request

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Returns the GitHub pull request for one of the app's branches, with whether it's ready to merge: its CI checks, reviews and conflicts.

Send the branch as `branch_id`. Without it, or when the branch has no pull request, the response is `null`. Each call refreshes the pull request from GitHub, which can take a few seconds. This works on apps imported from GitHub, and on apps connected to GitHub whose main branch protection GitHub manages.

This endpoint is limited to 60 requests per minute per user, shared with List pull request files and List branch file changes, and reported in the `X-RateLimit-*` headers.

<Note>This endpoint accepts a personal API key or personal access token belonging to a user with editor access to the app. A read-only key is refused, and workspace API keys are not accepted. Send credentials in a header: an `api_key` query parameter is refused.</Note>

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time.</Warning>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json get /api/apps/{app_id}/imported/git/pull-request
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/apps/{app_id}/imported/git/pull-request:
    get:
      summary: Get branch pull request
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Returns the GitHub pull request for one of the app's branches, with
        whether it's ready to merge: its CI checks, reviews and conflicts.


        Send the branch as `branch_id`. Without it, or when the branch has no
        pull request, the response is `null`. Each call refreshes the pull
        request from GitHub, which can take a few seconds. This works on apps
        imported from GitHub, and on apps connected to GitHub whose main branch
        protection GitHub manages.


        This endpoint is limited to 60 requests per minute per user, shared with
        List pull request files and List branch file changes, and reported in
        the `X-RateLimit-*` headers.


        <Note>This endpoint accepts a personal API key or personal access token
        belonging to a user with editor access to the app. A read-only key is
        refused, and workspace API keys are not accepted. Send credentials in a
        header: an `api_key` query parameter is refused.</Note>


        <Warning>The response includes fields beyond the ones documented here.
        Don't rely on undocumented response fields, as they can change at any
        time.</Warning>
      operationId: get_pull_request_api_apps__app_id__imported_git_pull_request_get
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app.
            title: App Id
          description: ID of the app.
          example: 6820f3a4e7b91d003c45a1f2
        - name: branch_id
          in: query
          required: false
          schema:
            type: string
            description: >-
              ID of the branch to work on, as returned by [List
              branches](/api-reference/list-branches). Omit it to work on the
              app's main branch.
            title: Branch Id
          description: >-
            ID of the branch to work on, as returned by [List
            branches](/api-reference/list-branches). Omit it to work on the
            app's main branch.
          example: 68f1a2b3c4d5e6f708192a3b
      responses:
        '200':
          description: The branch's pull request, or `null`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BranchPullRequestOrNull'
              example:
                number: 42
                title: Add checkout flow
                body: Adds a checkout page.
                state: open
                merged: false
                draft: false
                html_url: https://github.com/acme/shop/pull/42
                changed_files: 3
                additions: 120
                deletions: 8
                head:
                  ref: feature/checkout
                  sha: 9fceb02d0ae598e95dc970b74767f19372d61af8
                base:
                  ref: main
                  sha: 9fceb02d0ae598e95dc970b74767f19372d61af8
                readiness:
                  checks: success
                  review: approved
                  mergeable: mergeable
                  unresolved_thread_count: 0
        '401':
          description: >-
            `unauthenticated`: Missing or invalid credentials, or credentials
            sent as an `api_key` query parameter.
          content:
            application/json:
              examples:
                unauthenticated:
                  summary: unauthenticated
                  value:
                    error:
                      code: unauthenticated
                      message: 'Use Authorization: Bearer credentials.'
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '403':
          description: >-
            `forbidden`: You don't have editor access to this app, your API key
            is read-only, or you used a workspace API key.
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    error:
                      code: forbidden
                      message: You don't have editor access to this app.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '404':
          description: >-
            `not_found`: The app or `branch_id` doesn't exist, or the app isn't
            one of the apps described above.
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    error:
                      code: not_found
                      message: Branch not found.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '409':
          description: >-
            `pull_request_check_busy`: Another request is refreshing this pull
            request. Retry shortly. `pull_request_failed`: The app has no GitHub
            connection or its repository record is missing.
          content:
            application/json:
              examples:
                pull_request_check_busy:
                  summary: pull_request_check_busy
                  value:
                    error:
                      code: pull_request_check_busy
                      message: >-
                        The pull request status check is busy. Try again
                        shortly.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '429':
          description: >-
            `rate_limited`: More than 60 requests in a minute. Retry after
            `Retry-After` seconds.
          content:
            application/json:
              examples:
                rate_limited:
                  summary: rate_limited
                  value:
                    error:
                      code: rate_limited
                      message: Rate limit exceeded.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '502':
          description: '`pull_request_unavailable`: GitHub couldn''t be reached. Retry later.'
          content:
            application/json:
              examples:
                pull_request_unavailable:
                  summary: pull_request_unavailable
                  value:
                    error:
                      code: pull_request_unavailable
                      message: Couldn’t check the pull request. Try again.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
      security:
        - PersonalAccessTokenAuth:
            - full_access
components:
  schemas:
    BranchPullRequestOrNull:
      anyOf:
        - $ref: '#/components/schemas/BranchPullRequest'
        - type: 'null'
      title: BranchPullRequestOrNull
      description: The branch's pull request, or `null` when it has none.
    StandardErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/StandardError'
          description: What went wrong.
      type: object
      required:
        - error
      title: StandardErrorEnvelope
      description: The error body returned in the standard envelope.
    BranchPullRequest:
      properties:
        number:
          type: integer
          title: Number
          description: Pull request number on GitHub.
          example: 42
        title:
          type: string
          title: Title
          description: Title of the pull request.
          example: Add checkout flow
        body:
          anyOf:
            - type: string
            - type: 'null'
          title: Body
          description: Description of the pull request, or `null`.
          example: Adds a checkout page.
        state:
          type: string
          enum:
            - open
            - closed
          title: State
          description: '`open`, or `closed` once merged or closed.'
          example: open
        merged:
          type: boolean
          title: Merged
          description: Whether it was merged.
          example: false
        draft:
          type: boolean
          title: Draft
          description: Whether it's a draft.
          example: false
        html_url:
          type: string
          title: Html Url
          description: Link to the pull request on GitHub.
          example: https://github.com/acme/shop/pull/42
        changed_files:
          type: integer
          title: Changed Files
          description: Number of files it changes.
          example: 3
        additions:
          type: integer
          title: Additions
          description: Lines added.
          example: 120
        deletions:
          type: integer
          title: Deletions
          description: Lines removed.
          example: 8
        head:
          $ref: '#/components/schemas/GitRef'
          description: The branch the pull request merges from.
        base:
          $ref: '#/components/schemas/GitRef'
          description: The branch it merges into.
        readiness:
          anyOf:
            - $ref: '#/components/schemas/PullRequestReadiness'
            - type: 'null'
          description: >-
            Whether it's ready to merge, or `null` when GitHub hasn't reported
            it yet.
      type: object
      required:
        - number
        - title
        - body
        - state
        - merged
        - draft
        - html_url
        - changed_files
        - additions
        - deletions
        - head
        - base
        - readiness
      title: BranchPullRequest
    StandardError:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable machine-readable cause of the failure. Match on this, not on
            `message`.
          example: not_found
        message:
          type: string
          title: Message
          description: Human-readable explanation. It isn't a stable contract.
          example: App not found
        details:
          additionalProperties: true
          type: object
          title: Details
          description: >-
            Structured context for the failure, or an empty object when there's
            none.
          example: {}
      type: object
      required:
        - code
        - message
      title: StandardError
    GitRef:
      properties:
        ref:
          type: string
          title: Ref
          description: Branch name.
          example: feature/checkout
        sha:
          type: string
          title: Sha
          description: Commit SHA the branch points to.
          example: 9fceb02d0ae598e95dc970b74767f19372d61af8
      type: object
      required:
        - ref
        - sha
      title: GitRef
    PullRequestReadiness:
      properties:
        checks:
          type: string
          enum:
            - success
            - pending
            - failure
            - none
            - unknown
          title: Checks
          description: Combined result of the pull request's CI checks.
          example: success
        review:
          type: string
          enum:
            - approved
            - changes_requested
            - required
            - none
            - unknown
          title: Review
          description: Review status.
          example: approved
        mergeable:
          type: string
          enum:
            - mergeable
            - conflicting
            - unknown
          title: Mergeable
          description: Whether GitHub can merge it without conflicts.
          example: mergeable
        unresolved_thread_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Unresolved Thread Count
          description: Review threads not resolved yet, or `null` when unknown.
          example: 0
      type: object
      required:
        - checks
        - review
        - mergeable
      title: PullRequestReadiness
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.

````

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