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

# PATCH /v1/crm/notes/:id

> Edit a note's text or interaction type.

Updates a note in place. Only `content` and `type` can change — a note cannot be moved to a different contact or ticket after creation.

## Endpoint

```
PATCH https://api.keebai.com/v1/crm/notes/{id}
```

## Required scope

`crm:notes:write`

## Headers

| Header          | Required | Value                    |
| --------------- | -------- | ------------------------ |
| `Authorization` | Yes      | `Bearer kbai_pk_<token>` |
| `Content-Type`  | Yes      | `application/json`       |

## Path parameters

| Field | Type     | Required | Description             |
| ----- | -------- | -------- | ----------------------- |
| `id`  | `string` | Yes      | `ObjectId` of the note. |

## Body

All fields optional. Send only what changes.

| Field     | Type     | Description                                |
| --------- | -------- | ------------------------------------------ |
| `content` | `string` | The note text. Up to 5000 characters.      |
| `type`    | `string` | One of `note`, `call`, `email`, `meeting`. |

## Example request

<CodeGroup>
  ```bash curl theme={null}
  curl -X PATCH https://api.keebai.com/v1/crm/notes/65a1f2b3c4d5e6f7a8b9c0d1 \
    -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
    -H "Content-Type: application/json" \
    -d '{
      "content": "Llamé al cliente, confirmó el plan anual.",
      "type": "call"
    }'
  ```

  ```js JavaScript theme={null}
  const response = await fetch(`https://api.keebai.com/v1/crm/notes/${noteId}`, {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ content: "Llamé al cliente, confirmó el plan anual." }),
  });
  const { note } = await response.json();
  ```

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

  resp = requests.patch(
      f"https://api.keebai.com/v1/crm/notes/{note_id}",
      headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
      json={"content": "Llamé al cliente, confirmó el plan anual."},
      timeout=10,
  )
  resp.raise_for_status()
  note = resp.json()["note"]
  ```
</CodeGroup>

## Response

### 200 OK

Returns the updated note, same shape as [`GET /v1/crm/notes/:id`](/dev/endpoints/crm-note-get).

### 400 Bad Request

Empty `content`, content longer than 5000 characters, a `type` outside the allowed set, or a property the endpoint does not accept — including `chat_user` and `ticket_id`, which are immutable after creation.

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `crm:notes:write` scope.

### 404 Not Found

No note with that id, or the note belongs to a different company.

## Operational notes

* **`created_by` does not change on edit.** The note keeps its original author even when a different token rewrites the text, so an edited note can misattribute who said what. Post a new note instead of rewriting someone else's.
* **Attachment is fixed.** To move a note to another ticket, delete it and create a new one.


## OpenAPI

````yaml PATCH /v1/crm/notes/{id}
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/crm/notes/{id}:
    patch:
      tags:
        - crm-notes
      summary: Actualizar una nota
      operationId: PublicNotesController_update
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicNoteUpdateDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicNoteEnvelopeDto'
      security:
        - PAT: []
components:
  schemas:
    PublicNoteUpdateDto:
      type: object
      properties:
        content:
          type: string
        type:
          type: string
          enum:
            - note
            - call
            - email
            - meeting
    PublicNoteEnvelopeDto:
      type: object
      properties:
        note:
          $ref: '#/components/schemas/PublicNoteResponseDto'
      required:
        - note
    PublicNoteResponseDto:
      type: object
      properties:
        _id:
          type: string
          description: ObjectId de la nota
        content:
          type: string
        type:
          type: string
          enum:
            - note
            - call
            - email
            - meeting
        chat_user:
          type: string
          description: ObjectId del chat user (contacto)
        ticket_id:
          type: string
          description: ObjectId del ticket asociado
        created_by:
          type: string
          description: ObjectId del usuario que creó la nota
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - _id
        - content
        - type
        - created_by
        - created_at
        - updated_at
  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`.

````