> ## 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.

# Open pull request

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

Opens a GitHub pull request from one of the app's branches into the branch the app was imported from. This works on apps imported from GitHub, and on apps connected to GitHub whose main branch protection GitHub manages.

Send the branch as `branch_id`. Any uncommitted changes on the branch are committed and pushed first, like [Commit branch changes](/api-reference/commit-branch-changes), and the request waits for that. `title` defaults to a name based on the branch. Base44 adds a short footer to `body` that links the pull request back to the app.

If the branch already has a pull request, the call returns it right away and commits nothing, so you can retry safely. To add later changes to that pull request, call Commit branch changes. The call is refused with `no_changes` when the branch changes no files.

This endpoint is limited to 10 requests per minute per user, shared with Commit branch changes, Discard branch changes, Revert branch file changes and Update pull request, 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 post /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:
    post:
      summary: Open pull request
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Opens a GitHub pull request from one of the app's branches into the
        branch the app was imported from. This works on apps imported from
        GitHub, and on apps connected to GitHub whose main branch protection
        GitHub manages.


        Send the branch as `branch_id`. Any uncommitted changes on the branch
        are committed and pushed first, like [Commit branch
        changes](/api-reference/commit-branch-changes), and the request waits
        for that. `title` defaults to a name based on the branch. Base44 adds a
        short footer to `body` that links the pull request back to the app.


        If the branch already has a pull request, the call returns it right away
        and commits nothing, so you can retry safely. To add later changes to
        that pull request, call Commit branch changes. The call is refused with
        `no_changes` when the branch changes no files.


        This endpoint is limited to 10 requests per minute per user, shared with
        Commit branch changes, Discard branch changes, Revert branch file
        changes and Update pull request, 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: open_pull_request_api_apps__app_id__imported_git_pull_request_post
      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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PullRequestRequest'
      responses:
        '200':
          description: The opened pull request, or the branch's existing one.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequest'
              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
        '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: >-
            `branch_required`: `branch_id` is missing. `branch_scope_read_only`:
            The branch is merged or closed. `pull_request_failed`: The pull
            request couldn't be changed, for example because your GitHub account
            can't push to the repository or GitHub refused the request;
            `message` says why. `pull_request_permission_missing` or
            `github_app_suspended`: Base44's GitHub App can't open pull requests
            on the repository; `details.recovery_url` links to where an owner
            fixes it. `no_changes`: The branch changes no files compared with
            the branch it merges into. `commit_review_required`: Some
            uncommitted changes need a description first, as in Commit branch
            changes. `github_<status>`: GitHub refused the pull request with
            that 4xx HTTP status.
          content:
            application/json:
              examples:
                branch_required:
                  summary: branch_required
                  value:
                    error:
                      code: branch_required
                      message: Select a feature branch.
                      details: {}
                pull_request_failed:
                  summary: pull_request_failed
                  value:
                    error:
                      code: pull_request_failed
                      message: >-
                        Your GitHub account does not have push access to this
                        repository
                      details:
                        reason: pull_request_failed
                no_changes:
                  summary: no_changes
                  value:
                    error:
                      code: no_changes
                      message: >-
                        There's nothing to open a pull request for:
                        feature/checkout changes no files compared with main.
                      details:
                        reason: no_changes
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '422':
          description: >-
            `invalid_request`: The body has a field that isn't `title` or
            `body`, or a value isn't a string.
          content:
            application/json:
              examples:
                invalid_request:
                  summary: invalid_request
                  value:
                    error:
                      code: invalid_request
                      message: Invalid request
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '429':
          description: >-
            `rate_limited`: More than 10 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 reach GitHub. Try again.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
      security:
        - PersonalAccessTokenAuth:
            - full_access
components:
  schemas:
    PullRequestRequest:
      properties:
        title:
          type: string
          title: Title
          description: >-
            Title of the pull request. Longer than 256 characters, it's cut
            short. Defaults to one naming the branch.
          default: ''
          example: Add checkout flow
        body:
          type: string
          title: Body
          description: Description of the pull request, in Markdown.
          default: ''
          example: Adds a checkout page.
      additionalProperties: false
      type: object
      title: PullRequestRequest
    PullRequest:
      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.
      type: object
      required:
        - number
        - title
        - body
        - state
        - merged
        - draft
        - html_url
        - changed_files
        - additions
        - deletions
        - head
        - base
      title: PullRequest
    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.
    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
    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
  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.