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

> ## Agent Instructions
> Internal links on these pages omit the .md extension. Append .md to a docs page URL, or send an Accept: text/markdown header, to get that page as markdown.

# Delete branch

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

Deletes an active branch and discards its changes. Its code, its preview, and the entity and backend function changes made on it are removed, along with comments left on its preview. A deleted branch can't be restored.

After deletion, [List branches](/api-reference/list-branches) no longer returns the branch, but [Get branch](/api-reference/get-branch) still does, with `status` set to `deleted`. Its name is free to use again. Merged and already deleted branches can't be deleted.

This endpoint is limited to 30 requests per minute, shared with Create branch, Delete branch and Merge branch.

<Tip>A 409 response carries an `extra_data.reason` code that says why the request was refused.</Tip>

<Note>This endpoint accepts a personal API key belonging to a user with editor access to the app. A read-only key is refused, and workspace API keys are not accepted.</Note>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json delete /api/apps/{app_id}/branches/{branch_id}
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}/branches/{branch_id}:
    delete:
      summary: Delete branch
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Deletes an active branch and discards its changes. Its code, its
        preview, and the entity and backend function changes made on it are
        removed, along with comments left on its preview. A deleted branch can't
        be restored.


        After deletion, [List branches](/api-reference/list-branches) no longer
        returns the branch, but [Get branch](/api-reference/get-branch) still
        does, with `status` set to `deleted`. Its name is free to use again.
        Merged and already deleted branches can't be deleted.


        This endpoint is limited to 30 requests per minute, shared with Create
        branch, Delete branch and Merge branch.


        <Tip>A 409 response carries an `extra_data.reason` code that says why
        the request was refused.</Tip>


        <Note>This endpoint accepts a personal API key belonging to a user with
        editor access to the app. A read-only key is refused, and workspace API
        keys are not accepted.</Note>
      operationId: delete_branch_api_apps__app_id__branches__branch_id__delete
      parameters:
        - name: branch_id
          in: path
          required: true
          schema:
            type: string
            description: >-
              ID of the branch, as returned by [List
              branches](/api-reference/list-branches).
            title: Branch Id
          description: >-
            ID of the branch, as returned by [List
            branches](/api-reference/list-branches).
          example: 68f1a2b3c4d5e6f708192a3b
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app the branch belongs to.
            title: App Id
          description: ID of the app the branch belongs to.
          example: 6820f3a4e7b91d003c45a1f2
      responses:
        '200':
          description: The branch was deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletedBranch'
        '400':
          description: 'The branch isn''t active: it was already merged or deleted.'
        '401':
          description: Missing or invalid credentials.
        '403':
          description: >-
            You don't have editor access to this app, the app is blocked, your
            API key is read-only, or you used a workspace API key.
        '404':
          description: App not found, or the app has no branch with this ID.
        '409':
          description: >-
            The AI is working on the branch, the branch is being updated from
            main, or its latest changes are still being saved.
        '429':
          description: >-
            Rate limit exceeded. The base limit is 30 requests per minute. See
            [Rate
            limits](/developers/references/apps-api/get-started/rate-limits) for
            the multiplier your plan gets.
components:
  schemas:
    DeletedBranch:
      properties:
        success:
          type: boolean
          title: Success
          description: Always `true`.
          example: true
      type: object
      required:
        - success
      title: DeletedBranch
      description: Confirms the deletion.
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: 'Personal access token, sent as `Authorization: Bearer <token>`.'

````

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