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

# DELETE /v1/assistants/{id}/blocks/{blockId}

> Detach a block from an assistant. The block itself stays in the catalogue.

Removes one block from the assistant's prompt. The block is untouched: it stays in [the project catalogue](/dev/endpoints/blocks-list) with its full history, and any other assistant referencing it keeps using it.

This is the counterpart to [attaching](/dev/endpoints/assistants-block-attach). To get rid of the block itself, [archive it](/dev/endpoints/blocks-archive) as well.

## Endpoint

```
DELETE https://api.keebai.com/v1/assistants/{id}/blocks/{blockId}
```

## Required scope

`assistants:write`

## Headers

| Header          | Required | Value                    |
| --------------- | -------- | ------------------------ |
| `Authorization` | Yes      | `Bearer kbai_pk_<token>` |

## Path parameters

| Parameter | Type     | Description                        |
| --------- | -------- | ---------------------------------- |
| `id`      | `string` | `ObjectId` of the assistant.       |
| `blockId` | `string` | `ObjectId` of the block to detach. |

## Example request

<CodeGroup>
  ```bash curl theme={null}
  curl -X DELETE \
    https://api.keebai.com/v1/assistants/6650a1b2c3d4e5f6a7b8c9d0/blocks/6650bbbb2222cccc3333ffff \
    -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ```

  ```js JavaScript theme={null}
  const resp = await fetch(
    "https://api.keebai.com/v1/assistants/6650a1b2c3d4e5f6a7b8c9d0/blocks/6650bbbb2222cccc3333ffff",
    {
      method: "DELETE",
      headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` },
    },
  );
  const { assistant } = await resp.json();
  ```

  ```python Python theme={null}
  import os, requests

  resp = requests.delete(
      "https://api.keebai.com/v1/assistants/6650a1b2c3d4e5f6a7b8c9d0"
      "/blocks/6650bbbb2222cccc3333ffff",
      headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
      timeout=10,
  )
  resp.raise_for_status()
  assistant = resp.json()["assistant"]
  ```
</CodeGroup>

## Response

### 200 OK

The full assistant, same shape as [`GET /v1/assistants/{id}`](/dev/endpoints/assistants-get), without the block.

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `assistants:write` scope.

### 404 Not Found

No assistant with that id in the token's company and project.

### 502 Bad Gateway

The assistant service is unreachable.

## Operational notes

* **Detaching an identity block leaves the assistant without one.** Nothing prevents removing the `personification`, and the assistant will keep answering with whatever identity remains, which may be none. Attach a replacement in the same flow.
* **Detaching does not archive and does not delete.** The block stays in the catalogue. If it was only used here, [archive it](/dev/endpoints/blocks-archive) too or it lingers.
* **Detaching the same block twice returns the assistant unchanged**, so a retry is safe.
* **This removes every reference to that block id**, which matters if the block was attached twice by repeated [attach](/dev/endpoints/assistants-block-attach) calls.


## OpenAPI

````yaml DELETE /v1/assistants/{id}/blocks/{blockId}
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/assistants/{id}/blocks/{blockId}:
    delete:
      tags:
        - assistants
      summary: Desadjuntar un bloque de un asistente
      description: >-
        Saca el bloque del prompt del asistente. El bloque no se toca y sigue en
        el catalogo.
      operationId: PublicAssistantsController_detachBlock
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: blockId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicAssistantEnvelopeDto'
      security:
        - PAT: []
components:
  schemas:
    PublicAssistantEnvelopeDto:
      type: object
      properties:
        assistant:
          $ref: '#/components/schemas/PublicAssistantDto'
      required:
        - assistant
    PublicAssistantDto:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        avatar_url:
          type: string
        model:
          type: string
        voice_response_enabled:
          type: boolean
          description: Indica si la respuesta de voz está habilitada.
        created_at:
          type: string
      required:
        - id
        - name
        - model
        - voice_response_enabled
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````