Fuente: https://crm.begraffic.com/docs/api
Índice para agentes: [llms.txt](https://crm.begraffic.com/llms.txt)

# POST /api/v1/activities

URL base: https://crm.begraffic.com. Autenticación: Authorization: Bearer <CLAVE_V1_bcrm_...>.

Definición OpenAPI de la operación (los bloques schema son esquemas, no cuerpos de ejemplo):

```json
{
  "operationId": "activities.create",
  "summary": "Crear nota, tarea, llamada o reunión registrada",
  "description": "Mismo cuerpo que el panel (`type`: note, task, call, meeting). Una tarea necesita `assignedToEmail`. Con `Idempotency-Key`, el documento tiene id determinista (un reintento responde 200 con `alreadyExisted`). Con `dealId` y los negocios apagados: 403 `feature_disabled`.",
  "tags": [
    "Actividades y tareas"
  ],
  "x-scope": "activities:write",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "Idempotency-Key",
      "in": "header",
      "required": false,
      "description": "Clave única por operación (≤ 255 caracteres). Repetir la misma petición devuelve la misma respuesta durante 24 h; con otro cuerpo, 422.",
      "schema": {
        "type": "string",
        "maxLength": 255
      }
    }
  ],
  "responses": {
    "201": {
      "description": "Correcto.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "note",
                      "task",
                      "call",
                      "meeting"
                    ]
                  },
                  "store": {
                    "type": "string",
                    "description": "Dónde vive: `activities`, `notes` (del contacto) o `reminders`."
                  },
                  "leadId": {
                    "type": "string"
                  },
                  "nextStepTaskId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "alreadyExisted": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "store",
                  "leadId",
                  "nextStepTaskId",
                  "alreadyExisted"
                ]
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "`invalid_request`: Petición inválida (cuerpo, parámetros o consulta).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "`unauthorized`: Falta la clave, no existe, está revocada o caducó.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "`insufficient_scope`: La clave no tiene el alcance que exige la ruta. `feature_disabled`: La función está desactivada en el workspace.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "`not_found`: No existe (o no es de este workspace).",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "`idempotency_in_progress`: Otra petición con la misma Idempotency-Key se está procesando.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "422": {
      "description": "`idempotency_key_reused`: La Idempotency-Key ya se usó con otra petición.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "429": {
      "description": "`rate_limited`: Demasiadas llamadas (límite por clave y minuto). Ver `Retry-After`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "`internal`: Error interno.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  },
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "leadId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "dealId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string",
                  "maxLength": 200
                },
                "body": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 10000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "type": {
                  "type": "string",
                  "const": "note"
                },
                "pinned": {
                  "type": "boolean"
                }
              },
              "required": [
                "leadId",
                "type"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "leadId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "dealId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "body": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 10000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "type": {
                  "type": "string",
                  "const": "task"
                },
                "dueAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "assignedToEmail": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "priority": {
                  "type": "string",
                  "enum": [
                    "high",
                    "medium",
                    "low",
                    "none"
                  ]
                },
                "reminderType": {
                  "type": "string",
                  "enum": [
                    "call",
                    "email",
                    "whatsapp",
                    "meeting",
                    "task"
                  ]
                }
              },
              "required": [
                "leadId",
                "title",
                "type"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "leadId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "dealId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string",
                  "maxLength": 200
                },
                "body": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 10000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "type": {
                  "type": "string",
                  "const": "call"
                },
                "occurredAt": {
                  "type": "string"
                },
                "call": {
                  "type": "object",
                  "properties": {
                    "direction": {
                      "type": "string",
                      "enum": [
                        "outbound",
                        "inbound"
                      ]
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "connected",
                        "no_answer",
                        "voicemail",
                        "busy",
                        "wrong_number"
                      ]
                    },
                    "durationSec": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 86400
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "direction",
                    "outcome"
                  ],
                  "additionalProperties": false
                },
                "nextStep": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "dueAt": {
                      "type": "string"
                    },
                    "assignedToEmail": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "title",
                    "dueAt"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "leadId",
                "type",
                "call"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "leadId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "dealId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string",
                  "maxLength": 200
                },
                "body": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 10000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "type": {
                  "type": "string",
                  "const": "meeting"
                },
                "meeting": {
                  "type": "object",
                  "properties": {
                    "startAt": {
                      "type": "string"
                    },
                    "endAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "location": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 200
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "held",
                        "no_show",
                        "rescheduled",
                        "canceled"
                      ]
                    }
                  },
                  "required": [
                    "startAt",
                    "outcome"
                  ],
                  "additionalProperties": false
                },
                "nextStep": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "dueAt": {
                      "type": "string"
                    },
                    "assignedToEmail": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "title",
                    "dueAt"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "leadId",
                "type",
                "meeting"
              ],
              "additionalProperties": false
            }
          ]
        }
      }
    }
  }
}
```
