{
  "openapi": "3.0.3",
  "info": {
    "title": "Biky CDP API",
    "version": "1.0.0",
    "description": "The customer data platform of Biky: people and businesses (contacts), their notes, activities and touches, tasks, documents, and the statuses and segments used to organize them. Each resource group is served from its own host; the operation shows which one."
  },
  "servers": [
    {
      "url": "https://crm-contacts.keybeapi.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Contacts",
      "description": "People in your CDP: create, find (by phone, email, uuid or text), update and delete."
    },
    {
      "name": "Businesses",
      "description": "Companies in your CDP. Create and update them with the Contacts operations using `typeEntity: \"business\"`."
    },
    {
      "name": "Notes",
      "description": "Plain-text notes attached to a contact."
    },
    {
      "name": "Activities",
      "description": "The contact's timeline: calls, emails, meetings and other activities, including touches. Host: crm-activities."
    },
    {
      "name": "Tasks",
      "description": "Tasks (reminders) linked to a contact and assigned to a user. Host: crm-tasks."
    },
    {
      "name": "Statuses",
      "description": "The lifecycle statuses a contact can be in. Host: crm-status."
    },
    {
      "name": "Documents",
      "description": "Files and folders attached to a contact. Host: crm-documents."
    },
    {
      "name": "Segments",
      "description": "Named lists of contacts, static or defined by a filter. Host: crm-segments."
    }
  ],
  "paths": {
    "/{appUUID}/contacts/people": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "operationId": "listContacts",
        "summary": "List contacts",
        "description": "Returns the contacts of the app, newest first by default, as `{ data, paginator }`. Pagination is page-based: `offset` is the page number starting at 1 (`0` is treated as `1`) and `limit` the page size (default 10, no maximum). If the credential's user has the *agent* role in the app, only records where that user is the responsible are returned.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10. No maximum is enforced.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 10
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive partial match on full name, phone, email, document and uuid. Characters other than letters, digits, `_` and spaces are removed before matching (so `laura@example.com` is searched as `lauraexamplecom`; use the get-by-email operation for emails).",
            "schema": {
              "type": "string"
            },
            "example": "Gómez"
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sort order. Prefix `-` for descending.",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "-createdAt",
                "updatedAt",
                "-updatedAt"
              ],
              "default": "-createdAt"
            },
            "example": "-createdAt"
          },
          {
            "name": "filters[tags][]",
            "in": "query",
            "required": false,
            "description": "Only contacts with any of these tags. Repeat the parameter for several values (the `[]` is required, also for a single value).",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "example": [
              "vip"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[status][]",
            "in": "query",
            "required": false,
            "description": "Only contacts in any of these statuses (ids from List statuses).",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "example": [
              "665f1c2e8a4b3d0012ab34cf"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[segment]",
            "in": "query",
            "required": false,
            "description": "Only contacts that belong to this segment id.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34d0"
          },
          {
            "name": "filters[responsible][]",
            "in": "query",
            "required": false,
            "description": "Only contacts whose responsible is any of these user uuids. Use `null` to get contacts without a responsible.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "example": [
              "usr_3k9x2m"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[registerChannel][]",
            "in": "query",
            "required": false,
            "description": "Only contacts registered through any of these channels.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "instagram",
                  "gmail",
                  "linkedin",
                  "spotify",
                  "facebook",
                  "whatsapp",
                  "google",
                  "other",
                  "api",
                  "form",
                  "auth",
                  "email",
                  "phone",
                  "events",
                  "triggers",
                  "social",
                  "apple",
                  "facebookMessenger",
                  "facebookAdds",
                  "chatWeb",
                  "import",
                  "vtex",
                  "salesforce",
                  "outlook",
                  "yahoo",
                  "twitter",
                  "dashboard",
                  "wizard",
                  "rdStation",
                  "web",
                  "shopify",
                  "sms",
                  "simulator",
                  "hubspot",
                  "tiktok",
                  "callhub"
                ]
              }
            },
            "example": [
              "whatsapp"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[habeasDataStatus]",
            "in": "query",
            "required": false,
            "description": "Only contacts with this consent status.",
            "schema": {
              "type": "string",
              "enum": [
                "Confirmed",
                "Unconfirmed",
                "OnlyLegals",
                "Blacklist"
              ]
            },
            "example": "Confirmed"
          },
          {
            "name": "filters[createdAt][init]",
            "in": "query",
            "required": false,
            "description": "Created on or after this date (`YYYY-MM-DD`). Send it together with `filters[createdAt][end]`.",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-08-01"
          },
          {
            "name": "filters[createdAt][end]",
            "in": "query",
            "required": false,
            "description": "Created up to this date (`YYYY-MM-DD`). Without `filters[timezone]` the bound is 00:00 UTC of that day, so the day itself is excluded; with `filters[timezone]` the whole day is included.",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-08-31"
          },
          {
            "name": "filters[timezone]",
            "in": "query",
            "required": false,
            "description": "IANA time zone used to turn `filters[createdAt]` dates into whole days in that zone.",
            "schema": {
              "type": "string"
            },
            "example": "America/Bogota"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of contacts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "uuid": "4n8b2v6clq3k8r2x",
                      "app": "app_7f3k2m9x1q",
                      "typeEntity": "people",
                      "name": "Laura",
                      "surname": "Gómez",
                      "fullname": "Laura Gómez",
                      "documentType": "identification_card",
                      "document": "1020304050",
                      "phone": [
                        {
                          "value": "573001234567",
                          "countryCode": "57",
                          "country": "CO",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "email": [
                        {
                          "value": "laura@example.com",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "registerChannel": [
                        {
                          "channel": "api"
                        }
                      ],
                      "status": {
                        "_id": "665f1c2e8a4b3d0012ab34cf",
                        "name": "Lead",
                        "color": "#3B82F6"
                      },
                      "statusAt": "2026-08-14T15:32:10.000Z",
                      "tags": [
                        "vip"
                      ],
                      "segments": [
                        {
                          "id": "665f1c2e8a4b3d0012ab34d0",
                          "name": "Clientes recurrentes"
                        }
                      ],
                      "responsible": {
                        "uuid": "usr_3k9x2m",
                        "name": "Andrés Pérez",
                        "email": "andres@example.com",
                        "phone": "573001112233"
                      },
                      "extraData": [
                        {
                          "field": "color_favorito",
                          "value": "azul"
                        }
                      ],
                      "habeasData": {
                        "habeasDataStatus": "Confirmed",
                        "habeasDataAccepted": true
                      },
                      "country": "Colombia",
                      "timeZone": "America/Bogota",
                      "nationality": "Colombiana",
                      "allowReceiveMessageForChat": true,
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-15T09:05:41.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 1,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/contacts/people/elastic/filter": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "operationId": "searchContacts",
        "summary": "Search contacts",
        "description": "Full-text search for contacts (typo-tolerant, prefix matching on name, surname, phone and email; also uuid and document). Returns `{ data, total }`, best match first. **Pagination differs from the list operation:** here `offset` is a **0-based** page index (`0` = first page, `1` = second page). The search index is updated asynchronously, so a just-created record can take a few seconds to show up. If the credential's user has the *agent* role in the app, only records where that user is the responsible are returned.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "search",
            "in": "query",
            "required": true,
            "description": "Text to search. Required; an empty value returns 400.",
            "schema": {
              "type": "string"
            },
            "example": "laura gom"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page index, **0-based** (`0` = first page).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 0
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10. No maximum is enforced.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 10
          }
        ],
        "responses": {
          "200": {
            "description": "Matching records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSearchResult"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "uuid": "4n8b2v6clq3k8r2x",
                      "app": "app_7f3k2m9x1q",
                      "typeEntity": "people",
                      "name": "Laura",
                      "surname": "Gómez",
                      "fullname": "Laura Gómez",
                      "documentType": "identification_card",
                      "document": "1020304050",
                      "phone": [
                        {
                          "value": "573001234567",
                          "countryCode": "57",
                          "country": "CO",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "email": [
                        {
                          "value": "laura@example.com",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "registerChannel": [
                        {
                          "channel": "api"
                        }
                      ],
                      "statusAt": "2026-08-14T15:32:10.000Z",
                      "tags": [
                        "vip"
                      ],
                      "segments": [
                        {
                          "id": "665f1c2e8a4b3d0012ab34d0",
                          "name": "Clientes recurrentes"
                        }
                      ],
                      "responsible": {
                        "uuid": "usr_3k9x2m",
                        "name": "Andrés Pérez",
                        "email": "andres@example.com",
                        "phone": "573001112233"
                      },
                      "extraData": [
                        {
                          "field": "color_favorito",
                          "value": "azul"
                        }
                      ],
                      "habeasData": {
                        "habeasDataStatus": "Confirmed",
                        "habeasDataAccepted": true
                      },
                      "country": "Colombia",
                      "timeZone": "America/Bogota",
                      "nationality": "Colombiana",
                      "allowReceiveMessageForChat": true,
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-15T09:05:41.000Z"
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/contacts/people/phone/{phone}": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "operationId": "getContactByPhone",
        "summary": "Get a contact by phone",
        "description": "Returns the contact that has this phone number. The lookup is an **exact match** against the stored number, which the API saves as country code + national number, digits only (`+` and spaces are removed on write). So send `573001234567`: not `+573001234567`, not the number with spaces and not the national number alone. Mexican mobiles match with or without the legacy `1` after `52` (`5215512345678` and `525512345678` find the same contact).",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "phone",
            "in": "path",
            "required": true,
            "description": "Phone with country code, digits only, no `+`.",
            "schema": {
              "type": "string"
            },
            "example": "573001234567"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Laura",
                  "surname": "Gómez",
                  "fullname": "Laura Gómez",
                  "documentType": "identification_card",
                  "document": "1020304050",
                  "phone": [
                    {
                      "value": "573001234567",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "laura@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "status": {
                    "_id": "665f1c2e8a4b3d0012ab34cf",
                    "name": "Lead",
                    "color": "#3B82F6"
                  },
                  "statusAt": "2026-08-14T15:32:10.000Z",
                  "tags": [
                    "vip"
                  ],
                  "segments": [
                    {
                      "id": "665f1c2e8a4b3d0012ab34d0",
                      "name": "Clientes recurrentes"
                    }
                  ],
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "extraData": [
                    {
                      "field": "color_favorito",
                      "value": "azul"
                    }
                  ],
                  "habeasData": {
                    "habeasDataStatus": "Confirmed",
                    "habeasDataAccepted": true
                  },
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "nationality": "Colombiana",
                  "allowReceiveMessageForChat": true,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/contacts/people/email/{email}": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "operationId": "getContactByEmail",
        "summary": "Get a contact by email",
        "description": "Returns the contact that has this email. The match is exact and case-sensitive; emails are stored in lowercase, so send it in lowercase.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "email",
            "in": "path",
            "required": true,
            "description": "Email address (must be a valid email, otherwise 400).",
            "schema": {
              "type": "string",
              "format": "email"
            },
            "example": "laura@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Laura",
                  "surname": "Gómez",
                  "fullname": "Laura Gómez",
                  "documentType": "identification_card",
                  "document": "1020304050",
                  "phone": [
                    {
                      "value": "573001234567",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "laura@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "status": {
                    "_id": "665f1c2e8a4b3d0012ab34cf",
                    "name": "Lead",
                    "color": "#3B82F6"
                  },
                  "statusAt": "2026-08-14T15:32:10.000Z",
                  "tags": [
                    "vip"
                  ],
                  "segments": [
                    {
                      "id": "665f1c2e8a4b3d0012ab34d0",
                      "name": "Clientes recurrentes"
                    }
                  ],
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "extraData": [
                    {
                      "field": "color_favorito",
                      "value": "azul"
                    }
                  ],
                  "habeasData": {
                    "habeasDataStatus": "Confirmed",
                    "habeasDataAccepted": true
                  },
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "nationality": "Colombiana",
                  "allowReceiveMessageForChat": true,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/contacts/people/{uuid}": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "operationId": "getContact",
        "summary": "Get a contact",
        "description": "Returns one contact by its `uuid`, with `status` expanded.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "The contact's `uuid` (not its `_id`).",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Laura",
                  "surname": "Gómez",
                  "fullname": "Laura Gómez",
                  "documentType": "identification_card",
                  "document": "1020304050",
                  "phone": [
                    {
                      "value": "573001234567",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "laura@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "status": {
                    "_id": "665f1c2e8a4b3d0012ab34cf",
                    "name": "Lead",
                    "color": "#3B82F6"
                  },
                  "statusAt": "2026-08-14T15:32:10.000Z",
                  "tags": [
                    "vip"
                  ],
                  "segments": [
                    {
                      "id": "665f1c2e8a4b3d0012ab34d0",
                      "name": "Clientes recurrentes"
                    }
                  ],
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "extraData": [
                    {
                      "field": "color_favorito",
                      "value": "azul"
                    }
                  ],
                  "habeasData": {
                    "habeasDataStatus": "Confirmed",
                    "habeasDataAccepted": true
                  },
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "nationality": "Colombiana",
                  "allowReceiveMessageForChat": true,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Contacts"
        ],
        "operationId": "deleteContact",
        "summary": "Delete a contact",
        "description": "Deletes the contact and returns it as it was. The record is removed from the CDP (an archived copy is kept internally). This cannot be undone through the API.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "The contact's `uuid` (not its `_id`).",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Laura",
                  "surname": "Gómez",
                  "fullname": "Laura Gómez",
                  "documentType": "identification_card",
                  "document": "1020304050",
                  "phone": [
                    {
                      "value": "573001234567",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "laura@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "status": {
                    "_id": "665f1c2e8a4b3d0012ab34cf",
                    "name": "Lead",
                    "color": "#3B82F6"
                  },
                  "statusAt": "2026-08-14T15:32:10.000Z",
                  "tags": [
                    "vip"
                  ],
                  "segments": [
                    {
                      "id": "665f1c2e8a4b3d0012ab34d0",
                      "name": "Clientes recurrentes"
                    }
                  ],
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "extraData": [
                    {
                      "field": "color_favorito",
                      "value": "azul"
                    }
                  ],
                  "habeasData": {
                    "habeasDataStatus": "Confirmed",
                    "habeasDataAccepted": true
                  },
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "nationality": "Colombiana",
                  "allowReceiveMessageForChat": true,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/contacts": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "createContact",
        "summary": "Create a contact or business",
        "description": "Creates a person (`typeEntity: \"people\"`) or a company (`typeEntity: \"business\"`) and returns it. `typeEntity`, `registerChannel`, `name` and at least one `phone` or `email` are required. Each phone must include its country code and pass number validation. Duplicates are rejected with 400 (`ERROR_CONTACT_EXIST_PHONE`, `ERROR_CONTACT_EXIST_EMAIL`) when another record of the same type in the app has one of the phones or emails; businesses also need a unique `name` and, if sent, a unique `document`. When a phone is sent, `country`, `timeZone` and `nationality` are set from its country code.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactCreate"
              },
              "examples": {
                "person": {
                  "summary": "Person",
                  "value": {
                    "typeEntity": "people",
                    "registerChannel": [
                      {
                        "channel": "api"
                      }
                    ],
                    "name": "Laura",
                    "surname": "Gómez",
                    "documentType": "identification_card",
                    "document": "1020304050",
                    "phone": [
                      {
                        "value": "573001234567",
                        "countryCode": "57",
                        "isPrimary": true,
                        "verify": false
                      }
                    ],
                    "email": [
                      {
                        "value": "laura@example.com",
                        "isPrimary": true,
                        "verify": false
                      }
                    ],
                    "tags": [
                      "vip"
                    ],
                    "responsible": {
                      "uuid": "usr_3k9x2m",
                      "name": "Andrés Pérez",
                      "email": "andres@example.com",
                      "phone": "573001112233"
                    },
                    "habeasData": {
                      "habeasDataStatus": "Confirmed",
                      "habeasDataAccepted": true
                    }
                  }
                },
                "business": {
                  "summary": "Business",
                  "value": {
                    "typeEntity": "business",
                    "registerChannel": [
                      {
                        "channel": "api"
                      }
                    ],
                    "name": "Ejemplo Logística S.A.S.",
                    "documentType": "nit",
                    "document": "900123456",
                    "businessType": "Logistics",
                    "phone": [
                      {
                        "value": "576015550123",
                        "countryCode": "57",
                        "isPrimary": true,
                        "verify": false
                      }
                    ],
                    "email": [
                      {
                        "value": "compras@example.com",
                        "isPrimary": true,
                        "verify": false
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Laura",
                  "surname": "Gómez",
                  "fullname": "Laura Gómez",
                  "documentType": "identification_card",
                  "document": "1020304050",
                  "phone": [
                    {
                      "value": "573001234567",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "laura@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "status": {
                    "_id": "665f1c2e8a4b3d0012ab34cf",
                    "name": "Lead",
                    "color": "#3B82F6"
                  },
                  "statusAt": "2026-08-14T15:32:10.000Z",
                  "tags": [
                    "vip"
                  ],
                  "segments": [
                    {
                      "id": "665f1c2e8a4b3d0012ab34d0",
                      "name": "Clientes recurrentes"
                    }
                  ],
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "extraData": [
                    {
                      "field": "color_favorito",
                      "value": "azul"
                    }
                  ],
                  "habeasData": {
                    "habeasDataStatus": "Confirmed",
                    "habeasDataAccepted": true
                  },
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "nationality": "Colombiana",
                  "allowReceiveMessageForChat": true,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/contacts/{uuid}": {
      "patch": {
        "tags": [
          "Contacts"
        ],
        "operationId": "updateContact",
        "summary": "Update a contact or business",
        "description": "Updates a person or a business and returns it. Send `typeEntity` (it must match the record) plus the fields to change. Arrays replace the stored list unless `isPushData` is `true`; `extraData` and `extendedData` are always merged by `field`. If a new phone or email already belongs to another record, the API answers 400, unless `ignorePhoneOrEmailError=true`, in which case those phones or emails are dropped and the rest is saved.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "The contact's `uuid` (not its `_id`).",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "ignorePhoneOrEmailError",
            "in": "query",
            "required": false,
            "description": "When `true`, phones or emails that already belong to another record are skipped instead of failing the request.",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "example": false
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactUpdate"
              },
              "example": {
                "typeEntity": "people",
                "isPushData": true,
                "tags": [
                  "recompra"
                ],
                "extraData": [
                  {
                    "field": "color_favorito",
                    "value": "verde"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Laura",
                  "surname": "Gómez",
                  "fullname": "Laura Gómez",
                  "documentType": "identification_card",
                  "document": "1020304050",
                  "phone": [
                    {
                      "value": "573001234567",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "laura@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "status": {
                    "_id": "665f1c2e8a4b3d0012ab34cf",
                    "name": "Lead",
                    "color": "#3B82F6"
                  },
                  "statusAt": "2026-08-14T15:32:10.000Z",
                  "tags": [
                    "vip",
                    "recompra"
                  ],
                  "segments": [
                    {
                      "id": "665f1c2e8a4b3d0012ab34d0",
                      "name": "Clientes recurrentes"
                    }
                  ],
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "extraData": [
                    {
                      "field": "color_favorito",
                      "value": "azul"
                    }
                  ],
                  "habeasData": {
                    "habeasDataStatus": "Confirmed",
                    "habeasDataAccepted": true
                  },
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "nationality": "Colombiana",
                  "allowReceiveMessageForChat": true,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/contacts/business": {
      "get": {
        "tags": [
          "Businesses"
        ],
        "operationId": "listBusinesses",
        "summary": "List businesses",
        "description": "Returns the businesses of the app, newest first by default, as `{ data, paginator }`. Pagination is page-based: `offset` is the page number starting at 1 (`0` is treated as `1`) and `limit` the page size (default 10, no maximum). If the credential's user has the *agent* role in the app, only records where that user is the responsible are returned.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10. No maximum is enforced.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 10
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive partial match on full name, phone, email, document and uuid. Characters other than letters, digits, `_` and spaces are removed before matching (so `laura@example.com` is searched as `lauraexamplecom`; use the get-by-email operation for emails).",
            "schema": {
              "type": "string"
            },
            "example": "Logística"
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sort order. Prefix `-` for descending.",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "-createdAt",
                "updatedAt",
                "-updatedAt"
              ],
              "default": "-createdAt"
            },
            "example": "-createdAt"
          },
          {
            "name": "filters[tags][]",
            "in": "query",
            "required": false,
            "description": "Only contacts with any of these tags. Repeat the parameter for several values (the `[]` is required, also for a single value).",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "example": [
              "vip"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[status][]",
            "in": "query",
            "required": false,
            "description": "Only contacts in any of these statuses (ids from List statuses).",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "example": [
              "665f1c2e8a4b3d0012ab34cf"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[segment]",
            "in": "query",
            "required": false,
            "description": "Only contacts that belong to this segment id.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34d0"
          },
          {
            "name": "filters[responsible][]",
            "in": "query",
            "required": false,
            "description": "Only contacts whose responsible is any of these user uuids. Use `null` to get contacts without a responsible.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "example": [
              "usr_3k9x2m"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[registerChannel][]",
            "in": "query",
            "required": false,
            "description": "Only contacts registered through any of these channels.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "instagram",
                  "gmail",
                  "linkedin",
                  "spotify",
                  "facebook",
                  "whatsapp",
                  "google",
                  "other",
                  "api",
                  "form",
                  "auth",
                  "email",
                  "phone",
                  "events",
                  "triggers",
                  "social",
                  "apple",
                  "facebookMessenger",
                  "facebookAdds",
                  "chatWeb",
                  "import",
                  "vtex",
                  "salesforce",
                  "outlook",
                  "yahoo",
                  "twitter",
                  "dashboard",
                  "wizard",
                  "rdStation",
                  "web",
                  "shopify",
                  "sms",
                  "simulator",
                  "hubspot",
                  "tiktok",
                  "callhub"
                ]
              }
            },
            "example": [
              "whatsapp"
            ],
            "style": "form",
            "explode": true
          },
          {
            "name": "filters[habeasDataStatus]",
            "in": "query",
            "required": false,
            "description": "Only contacts with this consent status.",
            "schema": {
              "type": "string",
              "enum": [
                "Confirmed",
                "Unconfirmed",
                "OnlyLegals",
                "Blacklist"
              ]
            },
            "example": "Confirmed"
          },
          {
            "name": "filters[createdAt][init]",
            "in": "query",
            "required": false,
            "description": "Created on or after this date (`YYYY-MM-DD`). Send it together with `filters[createdAt][end]`.",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-08-01"
          },
          {
            "name": "filters[createdAt][end]",
            "in": "query",
            "required": false,
            "description": "Created up to this date (`YYYY-MM-DD`). Without `filters[timezone]` the bound is 00:00 UTC of that day, so the day itself is excluded; with `filters[timezone]` the whole day is included.",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-08-31"
          },
          {
            "name": "filters[timezone]",
            "in": "query",
            "required": false,
            "description": "IANA time zone used to turn `filters[createdAt]` dates into whole days in that zone.",
            "schema": {
              "type": "string"
            },
            "example": "America/Bogota"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of businesses.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34ce",
                      "uuid": "9t2w5k1mlq3k8s7d",
                      "app": "app_7f3k2m9x1q",
                      "typeEntity": "business",
                      "name": "Ejemplo Logística S.A.S.",
                      "fullname": "Ejemplo Logística S.A.S.",
                      "documentType": "nit",
                      "document": "900123456",
                      "phone": [
                        {
                          "value": "576015550123",
                          "countryCode": "57",
                          "country": "CO",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "email": [
                        {
                          "value": "compras@example.com",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "registerChannel": [
                        {
                          "channel": "api"
                        }
                      ],
                      "businessType": "Logistics",
                      "tags": [
                        "mayorista"
                      ],
                      "country": "Colombia",
                      "timeZone": "America/Bogota",
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-15T09:05:41.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 1,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/contacts/business/elastic/filter": {
      "get": {
        "tags": [
          "Businesses"
        ],
        "operationId": "searchBusinesses",
        "summary": "Search businesses",
        "description": "Full-text search for businesses (typo-tolerant, prefix matching on name, phone and email; also uuid and document). Returns `{ data, total }`, best match first. **Pagination differs from the list operation:** here `offset` is a **0-based** page index (`0` = first page, `1` = second page). The search index is updated asynchronously, so a just-created record can take a few seconds to show up. If the credential's user has the *agent* role in the app, only records where that user is the responsible are returned.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "search",
            "in": "query",
            "required": true,
            "description": "Text to search. Required; an empty value returns 400.",
            "schema": {
              "type": "string"
            },
            "example": "logistica"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page index, **0-based** (`0` = first page).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 0
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10. No maximum is enforced.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 10
          }
        ],
        "responses": {
          "200": {
            "description": "Matching records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSearchResult"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34ce",
                      "uuid": "9t2w5k1mlq3k8s7d",
                      "app": "app_7f3k2m9x1q",
                      "typeEntity": "business",
                      "name": "Ejemplo Logística S.A.S.",
                      "fullname": "Ejemplo Logística S.A.S.",
                      "documentType": "nit",
                      "document": "900123456",
                      "phone": [
                        {
                          "value": "576015550123",
                          "countryCode": "57",
                          "country": "CO",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "email": [
                        {
                          "value": "compras@example.com",
                          "isPrimary": true,
                          "verify": false
                        }
                      ],
                      "registerChannel": [
                        {
                          "channel": "api"
                        }
                      ],
                      "businessType": "Logistics",
                      "tags": [
                        "mayorista"
                      ],
                      "country": "Colombia",
                      "timeZone": "America/Bogota",
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-15T09:05:41.000Z"
                    }
                  ],
                  "total": 1
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/contacts/business/phone/{phone}": {
      "get": {
        "tags": [
          "Businesses"
        ],
        "operationId": "getBusinessByPhone",
        "summary": "Get a business by phone",
        "description": "Returns the business that has this phone number. The lookup is an **exact match** against the stored number, which the API saves as country code + national number, digits only (`+` and spaces are removed on write). So send `576015550123`: not `+576015550123`, not the number with spaces and not the national number alone. Mexican mobiles match with or without the legacy `1` after `52` (`5215512345678` and `525512345678` find the same business).",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "phone",
            "in": "path",
            "required": true,
            "description": "Phone with country code, digits only, no `+`.",
            "schema": {
              "type": "string"
            },
            "example": "576015550123"
          }
        ],
        "responses": {
          "200": {
            "description": "The business.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34ce",
                  "uuid": "9t2w5k1mlq3k8s7d",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "business",
                  "name": "Ejemplo Logística S.A.S.",
                  "fullname": "Ejemplo Logística S.A.S.",
                  "documentType": "nit",
                  "document": "900123456",
                  "phone": [
                    {
                      "value": "576015550123",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "compras@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "businessType": "Logistics",
                  "tags": [
                    "mayorista"
                  ],
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/contacts/business/email/{email}": {
      "get": {
        "tags": [
          "Businesses"
        ],
        "operationId": "getBusinessByEmail",
        "summary": "Get a business by email",
        "description": "Returns the business that has this email. The match is exact and case-sensitive; emails are stored in lowercase, so send it in lowercase.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "email",
            "in": "path",
            "required": true,
            "description": "Email address (must be a valid email, otherwise 400).",
            "schema": {
              "type": "string",
              "format": "email"
            },
            "example": "compras@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "The business.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34ce",
                  "uuid": "9t2w5k1mlq3k8s7d",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "business",
                  "name": "Ejemplo Logística S.A.S.",
                  "fullname": "Ejemplo Logística S.A.S.",
                  "documentType": "nit",
                  "document": "900123456",
                  "phone": [
                    {
                      "value": "576015550123",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "compras@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "businessType": "Logistics",
                  "tags": [
                    "mayorista"
                  ],
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/contacts/business/{uuid}": {
      "get": {
        "tags": [
          "Businesses"
        ],
        "operationId": "getBusiness",
        "summary": "Get a business",
        "description": "Returns one business by its `uuid`, with `status` expanded.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "The business's `uuid` (not its `_id`).",
            "schema": {
              "type": "string"
            },
            "example": "9t2w5k1mlq3k8s7d"
          }
        ],
        "responses": {
          "200": {
            "description": "The business.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34ce",
                  "uuid": "9t2w5k1mlq3k8s7d",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "business",
                  "name": "Ejemplo Logística S.A.S.",
                  "fullname": "Ejemplo Logística S.A.S.",
                  "documentType": "nit",
                  "document": "900123456",
                  "phone": [
                    {
                      "value": "576015550123",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "compras@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "businessType": "Logistics",
                  "tags": [
                    "mayorista"
                  ],
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Businesses"
        ],
        "operationId": "deleteBusiness",
        "summary": "Delete a business",
        "description": "Deletes the business and returns it as it was. The record is removed from the CDP (an archived copy is kept internally). This cannot be undone through the API.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "The business's `uuid` (not its `_id`).",
            "schema": {
              "type": "string"
            },
            "example": "9t2w5k1mlq3k8s7d"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted business.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34ce",
                  "uuid": "9t2w5k1mlq3k8s7d",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "business",
                  "name": "Ejemplo Logística S.A.S.",
                  "fullname": "Ejemplo Logística S.A.S.",
                  "documentType": "nit",
                  "document": "900123456",
                  "phone": [
                    {
                      "value": "576015550123",
                      "countryCode": "57",
                      "country": "CO",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "email": [
                    {
                      "value": "compras@example.com",
                      "isPrimary": true,
                      "verify": false
                    }
                  ],
                  "registerChannel": [
                    {
                      "channel": "api"
                    }
                  ],
                  "businessType": "Logistics",
                  "tags": [
                    "mayorista"
                  ],
                  "country": "Colombia",
                  "timeZone": "America/Bogota",
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-15T09:05:41.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/notes/{contactUUID}": {
      "get": {
        "tags": [
          "Notes"
        ],
        "operationId": "listNotes",
        "summary": "List a contact's notes",
        "description": "Returns the notes of a contact, newest first, as `{ data, paginator }`. `offset` is the page number starting at 1 (`0` is treated as `1`).",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact. It is not checked: notes are simply stored under this value.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10. No maximum is enforced.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 10
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive partial match on the note text.",
            "schema": {
              "type": "string"
            },
            "example": "cotización"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "app": "app_7f3k2m9x1q",
                      "uuid": "4n8b2v6clq3k8r2x",
                      "text": "Pidió cotización del plan anual.",
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 1,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "Notes"
        ],
        "operationId": "createNote",
        "summary": "Add a note to a contact",
        "description": "Creates a plain-text note on the contact. The author (`createdBy`) is taken from the credential.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact. It is not checked: notes are simply stored under this value.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Pidió cotización del plan anual."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "text": "Pidió cotización del plan anual.",
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/notes/{contactUUID}/{noteId}": {
      "get": {
        "tags": [
          "Notes"
        ],
        "operationId": "getNote",
        "summary": "Get a note",
        "description": "Returns one note of the contact. `noteId` must be a valid 24-hex id.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact. It is not checked: notes are simply stored under this value.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "noteId",
            "in": "path",
            "required": true,
            "description": "Note id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          }
        ],
        "responses": {
          "200": {
            "description": "The note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "uuid": "4n8b2v6clq3k8r2x",
                  "text": "Pidió cotización del plan anual.",
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Notes"
        ],
        "operationId": "deleteNote",
        "summary": "Delete a note",
        "description": "Permanently deletes the note. Answers 200 even if no note matched; check `deletedCount`.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact. It is not checked: notes are simply stored under this value.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "noteId",
            "in": "path",
            "required": true,
            "description": "Note id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          }
        ],
        "responses": {
          "200": {
            "description": "Deletion result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteDeleteResult"
                },
                "example": {
                  "success": true,
                  "deletedCount": 1
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/{typeEntity}/all/{contactUUID}": {
      "servers": [
        {
          "url": "https://crm-activities.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Activities"
        ],
        "operationId": "listActivities",
        "summary": "List a contact's activities",
        "description": "Returns the activity timeline of a contact inside the envelope `{ status, message, data: { activities, paginator }, statusCode }`, newest first by default. `offset` is the page number starting at 1 (`0` is treated as `1`); `limit` is at most 100. `paginator.totalDocs` counts up to 10000.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "typeEntity",
            "in": "path",
            "required": true,
            "description": "Type of the contact.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "business"
              ]
            },
            "example": "people"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 20, maximum 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "example": 20
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "description": "Sort field; prefix `-` for descending.",
            "schema": {
              "type": "string",
              "enum": [
                "-createdAt",
                "createdAt",
                "-dateStart",
                "dateStart",
                "-updatedAt",
                "updatedAt"
              ],
              "default": "-createdAt"
            },
            "example": "-createdAt"
          },
          {
            "name": "isTouch",
            "in": "query",
            "required": false,
            "description": "`true` returns only touches; `false` returns everything that is not a touch.",
            "schema": {
              "type": "boolean"
            },
            "example": true
          },
          {
            "name": "typeActivity",
            "in": "query",
            "required": false,
            "description": "Only this kind of activity.",
            "schema": {
              "type": "string",
              "enum": [
                "call",
                "email",
                "whatsapp",
                "sms",
                "meeting",
                "note",
                "campaign_sms",
                "campaign_email",
                "campaign_whatsapp",
                "chat_start",
                "chat_conversation",
                "chat_end",
                "other",
                "person_created",
                "person_updated",
                "changed_journey",
                "crm_task",
                "pipeline_opportunity_created",
                "pipeline_opportunity_step_changed",
                "funnel_card_created",
                "funnel_card_stepchanged",
                "integrations_abandoned_cart",
                "integrations_order_confirm",
                "integrations_aircall"
              ]
            },
            "example": "call"
          },
          {
            "name": "cardId",
            "in": "query",
            "required": false,
            "description": "Only activities linked to this SalesCard.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34ce"
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "description": "Only activities with this origin (e.g. `RestAPI` for the ones created through this API).",
            "schema": {
              "type": "string"
            },
            "example": "RestAPI"
          },
          {
            "name": "createdAt[from]",
            "in": "query",
            "required": false,
            "description": "Created from this date (ISO 8601). Taken from 00:00:00 of that day, server time (UTC).",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-08-01"
          },
          {
            "name": "createdAt[to]",
            "in": "query",
            "required": false,
            "description": "Created up to this date (ISO 8601). Taken until 23:59:59.999 of that day, server time (UTC).",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-08-31"
          },
          {
            "name": "uuid",
            "in": "query",
            "required": false,
            "description": "Another contact `uuid` whose activities are merged into the same list.",
            "schema": {
              "type": "string"
            },
            "example": "7k2m9x1qlq3k8r5z"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of activities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityListResponse"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "activities": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab34cd",
                        "appUUID": "app_7f3k2m9x1q",
                        "typeEntity": "people",
                        "entityId": "4n8b2v6clq3k8r2x",
                        "name": "Llamada de seguimiento",
                        "typeActivity": "call",
                        "body": "Confirmó interés en la cotización.",
                        "dateStart": "2026-08-14T15:32:10.000Z",
                        "properties": {
                          "duration": "180",
                          "call_direction": "outbound"
                        },
                        "propertyData": [
                          {
                            "property": "phone",
                            "value": "573001234567"
                          }
                        ],
                        "isTouch": true,
                        "cardId": "665f1c2e8a4b3d0012ab34ce",
                        "source": "RestAPI",
                        "createdByUser": {
                          "id": "1024",
                          "uuid": "usr_3k9x2m",
                          "userId": "u_8f2k1m",
                          "name": "Andrés",
                          "lastName": "Pérez",
                          "email": "andres@example.com"
                        },
                        "createdAt": "2026-08-14T15:32:10.000Z",
                        "updatedAt": "2026-08-14T15:32:10.000Z"
                      }
                    ],
                    "paginator": {
                      "totalDocs": 1,
                      "limit": 20,
                      "page": 1,
                      "totalPages": 1,
                      "pagingCounter": 1,
                      "hasPrevPage": false,
                      "hasNextPage": false,
                      "prevPage": null,
                      "nextPage": null
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/ActivityError"
          }
        }
      }
    },
    "/{appUUID}/{typeEntity}/{contactUUID}": {
      "servers": [
        {
          "url": "https://crm-activities.keybeapi.com",
          "description": "Production"
        }
      ],
      "post": {
        "tags": [
          "Activities"
        ],
        "operationId": "createActivity",
        "summary": "Log an activity",
        "description": "Records an activity (call, email, meeting, note...) on a contact's timeline and returns it in the envelope `{ status, data: { activity }, statusCode }` with **HTTP 200** (not 201). The author is taken from the credential. To log a **touch** (a direct contact with the person) set `isTouch: true`; it is only allowed for `call`, `email`, `whatsapp`, `sms`, `meeting`, `note` and each type requires: `call`: non-empty `body`, numeric `properties.duration` (seconds) and a `phone` entry in `propertyData`; `email`: `body` and `name` (subject); `whatsapp`, `sms`, `meeting`, `note`: `body`. For touches `dateStart` defaults to now and `dateEnd` is ignored.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "typeEntity",
            "in": "path",
            "required": true,
            "description": "Type of the contact.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "business"
              ]
            },
            "example": "people"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivityCreate"
              },
              "examples": {
                "callTouch": {
                  "summary": "Call touch",
                  "value": {
                    "name": "Llamada de seguimiento",
                    "typeActivity": "call",
                    "isTouch": true,
                    "body": "Confirmó interés en la cotización.",
                    "properties": {
                      "duration": "180",
                      "call_direction": "outbound"
                    },
                    "propertyData": [
                      {
                        "property": "phone",
                        "value": "573001234567"
                      }
                    ],
                    "cardId": "665f1c2e8a4b3d0012ab34ce"
                  }
                },
                "meeting": {
                  "summary": "Meeting (not a touch)",
                  "value": {
                    "name": "Visita a la sede",
                    "typeActivity": "meeting",
                    "body": "Prueba de manejo agendada.",
                    "dateStart": "2026-08-20T15:00:00.000Z",
                    "dateEnd": "2026-08-20T16:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityResponse"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "activity": {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "appUUID": "app_7f3k2m9x1q",
                      "typeEntity": "people",
                      "entityId": "4n8b2v6clq3k8r2x",
                      "name": "Llamada de seguimiento",
                      "typeActivity": "call",
                      "body": "Confirmó interés en la cotización.",
                      "dateStart": "2026-08-14T15:32:10.000Z",
                      "properties": {
                        "duration": "180",
                        "call_direction": "outbound"
                      },
                      "propertyData": [
                        {
                          "property": "phone",
                          "value": "573001234567"
                        }
                      ],
                      "isTouch": true,
                      "cardId": "665f1c2e8a4b3d0012ab34ce",
                      "source": "RestAPI",
                      "createdByUser": {
                        "id": "1024",
                        "uuid": "usr_3k9x2m",
                        "userId": "u_8f2k1m",
                        "name": "Andrés",
                        "lastName": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/ActivityError"
          }
        }
      }
    },
    "/{appUUID}/activity/{activityId}": {
      "servers": [
        {
          "url": "https://crm-activities.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Activities"
        ],
        "operationId": "getActivity",
        "summary": "Get an activity",
        "description": "Returns one activity by id inside the envelope `{ status, data: { activity }, statusCode }`. A malformed id returns 400 and an unknown id 404, both in the envelope format.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "activityId",
            "in": "path",
            "required": true,
            "description": "Activity id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          }
        ],
        "responses": {
          "200": {
            "description": "The activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityResponse"
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "activity": {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "appUUID": "app_7f3k2m9x1q",
                      "typeEntity": "people",
                      "entityId": "4n8b2v6clq3k8r2x",
                      "name": "Llamada de seguimiento",
                      "typeActivity": "call",
                      "body": "Confirmó interés en la cotización.",
                      "dateStart": "2026-08-14T15:32:10.000Z",
                      "properties": {
                        "duration": "180",
                        "call_direction": "outbound"
                      },
                      "propertyData": [
                        {
                          "property": "phone",
                          "value": "573001234567"
                        }
                      ],
                      "isTouch": true,
                      "cardId": "665f1c2e8a4b3d0012ab34ce",
                      "source": "RestAPI",
                      "createdByUser": {
                        "id": "1024",
                        "uuid": "usr_3k9x2m",
                        "userId": "u_8f2k1m",
                        "name": "Andrés",
                        "lastName": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ActivityError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/ActivityError"
          }
        }
      }
    },
    "/{appUUID}/tasks": {
      "servers": [
        {
          "url": "https://crm-tasks.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Tasks"
        ],
        "operationId": "listTasks",
        "summary": "List tasks",
        "description": "Returns the tasks (reminders) of the app as `{ data, paginator }`. `offset` is the page number starting at 1 (`0` is treated as `1`). Deleted tasks are not returned. No specific sort order is applied.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10. No maximum is enforced.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 10
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive partial match on title or description.",
            "schema": {
              "type": "string"
            },
            "example": "visita"
          },
          {
            "name": "contact",
            "in": "query",
            "required": false,
            "description": "Only tasks of this contact `uuid`.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "responsible",
            "in": "query",
            "required": false,
            "description": "Only tasks of this responsible user uuid. `N-A` returns tasks without a responsible.",
            "schema": {
              "type": "string"
            },
            "example": "usr_3k9x2m"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only tasks in this status.",
            "schema": {
              "type": "string",
              "enum": [
                "created",
                "process",
                "done",
                "expired"
              ]
            },
            "example": "created"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "app": "app_7f3k2m9x1q",
                      "title": "Llamar para confirmar la visita",
                      "description": "Confirmar hora y sede.",
                      "contact": {
                        "uuid": "4n8b2v6clq3k8r2x",
                        "name": "Laura Gómez"
                      },
                      "responsible": {
                        "uuid": "usr_3k9x2m",
                        "name": "Andrés Pérez",
                        "email": "andres@example.com",
                        "phone": "573001112233"
                      },
                      "date": "2026-08-20T20:00:00.000Z",
                      "priority": "high",
                      "status": "created",
                      "extraData": [],
                      "inactive": false,
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 1,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "Tasks"
        ],
        "operationId": "createTask",
        "summary": "Create a task",
        "description": "Creates a task (reminder) linked to a contact and returns it with `status: created`. The responsible is notified at `date` by email and/or SMS (when `responsible.email` / `responsible.phone` are set), with reminders 24 h and 1 h before when there is still time. Changing `date` later does not reschedule those notifications.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCreate"
              },
              "example": {
                "title": "Llamar para confirmar la visita",
                "description": "Confirmar hora y sede.",
                "contact": {
                  "uuid": "4n8b2v6clq3k8r2x",
                  "name": "Laura Gómez"
                },
                "responsible": {
                  "uuid": "usr_3k9x2m",
                  "name": "Andrés Pérez",
                  "email": "andres@example.com",
                  "phone": "573001112233"
                },
                "date": "2026-08-20T15:00:00-05:00",
                "priority": "high"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "title": "Llamar para confirmar la visita",
                  "description": "Confirmar hora y sede.",
                  "contact": {
                    "uuid": "4n8b2v6clq3k8r2x",
                    "name": "Laura Gómez"
                  },
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "date": "2026-08-20T20:00:00.000Z",
                  "priority": "high",
                  "status": "created",
                  "extraData": [],
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/tasks/{taskId}": {
      "servers": [
        {
          "url": "https://crm-tasks.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Tasks"
        ],
        "operationId": "getTask",
        "summary": "Get a task",
        "description": "Returns one task by id.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "Task id (24-hex; otherwise 400).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          }
        ],
        "responses": {
          "200": {
            "description": "The task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "title": "Llamar para confirmar la visita",
                  "description": "Confirmar hora y sede.",
                  "contact": {
                    "uuid": "4n8b2v6clq3k8r2x",
                    "name": "Laura Gómez"
                  },
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "date": "2026-08-20T20:00:00.000Z",
                  "priority": "high",
                  "status": "created",
                  "extraData": [],
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "Tasks"
        ],
        "operationId": "updateTask",
        "summary": "Update a task",
        "description": "Changes any field of a task, including `status`. A task in `done` status cannot be changed (400). Setting `done` or `expired` cancels its pending notifications.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "Task id (24-hex; otherwise 400).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskUpdate"
              },
              "example": {
                "status": "done"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "title": "Llamar para confirmar la visita",
                  "description": "Confirmar hora y sede.",
                  "contact": {
                    "uuid": "4n8b2v6clq3k8r2x",
                    "name": "Laura Gómez"
                  },
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "date": "2026-08-20T20:00:00.000Z",
                  "priority": "high",
                  "status": "done",
                  "extraData": [],
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Tasks"
        ],
        "operationId": "deleteTask",
        "summary": "Delete a task",
        "description": "Deletes the task (soft delete: it disappears from the API) and cancels its pending notifications. Returns the deleted task.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "description": "Task id (24-hex; otherwise 400).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "title": "Llamar para confirmar la visita",
                  "description": "Confirmar hora y sede.",
                  "contact": {
                    "uuid": "4n8b2v6clq3k8r2x",
                    "name": "Laura Gómez"
                  },
                  "responsible": {
                    "uuid": "usr_3k9x2m",
                    "name": "Andrés Pérez",
                    "email": "andres@example.com",
                    "phone": "573001112233"
                  },
                  "date": "2026-08-20T20:00:00.000Z",
                  "priority": "high",
                  "status": "created",
                  "extraData": [],
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/status": {
      "servers": [
        {
          "url": "https://crm-status.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Statuses"
        ],
        "operationId": "listStatuses",
        "summary": "List statuses",
        "description": "Returns the contact statuses of the app, sorted by name, as `{ data, paginator }`. `offset` is the page number starting at 1 (`0` is treated as `1`); `limit` defaults to 10. Deleted statuses are not returned.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 50
          },
          {
            "name": "showFilter",
            "in": "query",
            "required": false,
            "description": "`1` returns only statuses shown as filters; any other value returns only the ones that are not.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "0"
              ]
            },
            "example": "1"
          },
          {
            "name": "dependence",
            "in": "query",
            "required": false,
            "description": "Only statuses that depend on this status id.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34ce"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of statuses.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cf",
                      "app": "app_7f3k2m9x1q",
                      "name": "Lead",
                      "color": "#3B82F6",
                      "defaultRegister": true,
                      "showFilter": true,
                      "inactive": false,
                      "dependencies": [],
                      "extradata": [],
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 1,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "Statuses"
        ],
        "operationId": "createStatus",
        "summary": "Create a status",
        "description": "Creates a contact status. The name must be unique in the app (400). If `defaultRegister` is `true`, it becomes the status new contacts get by default and the previous default is unset.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusCreate"
              },
              "example": {
                "name": "Lead",
                "color": "#3B82F6",
                "defaultRegister": true,
                "showFilter": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cf",
                  "app": "app_7f3k2m9x1q",
                  "name": "Lead",
                  "color": "#3B82F6",
                  "defaultRegister": true,
                  "showFilter": true,
                  "inactive": false,
                  "dependencies": [],
                  "extradata": [],
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/status/{statusId}": {
      "servers": [
        {
          "url": "https://crm-status.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Statuses"
        ],
        "operationId": "getStatus",
        "summary": "Get a status",
        "description": "Returns one status with its dependencies expanded.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "statusId",
            "in": "path",
            "required": true,
            "description": "Status id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cf"
          }
        ],
        "responses": {
          "200": {
            "description": "The status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cf",
                  "app": "app_7f3k2m9x1q",
                  "name": "Lead",
                  "color": "#3B82F6",
                  "defaultRegister": true,
                  "showFilter": true,
                  "inactive": false,
                  "dependencies": [],
                  "extradata": [],
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "Statuses"
        ],
        "operationId": "updateStatus",
        "summary": "Update a status",
        "description": "Changes any field of a status. A status cannot depend on itself (400) and every dependency must exist (404).",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "statusId",
            "in": "path",
            "required": true,
            "description": "Status id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusUpdate"
              },
              "example": {
                "color": "#10B981"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cf",
                  "app": "app_7f3k2m9x1q",
                  "name": "Lead",
                  "color": "#10B981",
                  "defaultRegister": true,
                  "showFilter": true,
                  "inactive": false,
                  "dependencies": [],
                  "extradata": [],
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Statuses"
        ],
        "operationId": "deleteStatus",
        "summary": "Delete a status",
        "description": "Deletes a status. If contacts are in it, you must pass `migrateTo` with another status id: the contacts are moved there first. Without `migrateTo` the API answers 409 `STATUS_HAS_CONTACTS` with the number of affected contacts. The response includes `migrated`, the number of contacts moved.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "statusId",
            "in": "path",
            "required": true,
            "description": "Status id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cf"
          },
          {
            "name": "migrateTo",
            "in": "query",
            "required": false,
            "description": "Id of the status that receives the contacts of the deleted one. Required when the status has contacts.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34ce"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted status.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Status"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "migrated": {
                          "type": "integer",
                          "description": "Contacts moved to `migrateTo`."
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cf",
                  "app": "app_7f3k2m9x1q",
                  "name": "Lead",
                  "color": "#3B82F6",
                  "defaultRegister": true,
                  "showFilter": true,
                  "inactive": false,
                  "dependencies": [],
                  "extradata": [],
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z",
                  "migrated": 42
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/{appUUID}/status/{statusId}/contacts/count": {
      "servers": [
        {
          "url": "https://crm-status.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Statuses"
        ],
        "operationId": "countStatusContacts",
        "summary": "Count contacts in a status",
        "description": "Returns how many contacts of the app are in this status. Useful before deleting it.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "statusId",
            "in": "path",
            "required": true,
            "description": "Status id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cf"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact count.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "count": 42
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/documents/{contactUUID}": {
      "servers": [
        {
          "url": "https://crm-documents.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Documents"
        ],
        "operationId": "listDocuments",
        "summary": "List a contact's documents",
        "description": "Returns the files and folders of a contact at one folder level, folders first and then newest first, as `{ data, paginator }`. Without `parentId` it lists the root level; pass a folder id to list its content. `offset` is the page number starting at 1 (`0` is treated as `1`).",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact that owns the documents.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10. No maximum is enforced.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 10
          },
          {
            "name": "parentId",
            "in": "query",
            "required": false,
            "description": "Folder id (24-hex) whose content you want. Omit for the root level.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34ce"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive partial match on name or description.",
            "schema": {
              "type": "string"
            },
            "example": "contrato"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of documents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34ce",
                      "app": "app_7f3k2m9x1q",
                      "userId": "4n8b2v6clq3k8r2x",
                      "parentId": null,
                      "isFolder": true,
                      "name": "Contratos",
                      "access": "private",
                      "versions": [],
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    },
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "app": "app_7f3k2m9x1q",
                      "userId": "4n8b2v6clq3k8r2x",
                      "parentId": "665f1c2e8a4b3d0012ab34ce",
                      "isFolder": false,
                      "name": "contrato-2026.pdf",
                      "tags": [
                        "contrato"
                      ],
                      "access": "private",
                      "storage": {
                        "provider": "aws",
                        "url": "https://files.example.com/crm/documents/app_7f3k2m9x1q/4n8b2v6clq3k8r2x/contrato-2026.pdf",
                        "bucket": "example-bucket",
                        "folder": "crm/documents/app_7f3k2m9x1q/4n8b2v6clq3k8r2x"
                      },
                      "file": {
                        "name": "contrato-2026.pdf",
                        "internalName": "contrato-2026.pdf",
                        "ext": "pdf",
                        "size": 182044,
                        "mimetype": "application/pdf"
                      },
                      "versions": [],
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 2,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/documents/{contactUUID}/folder": {
      "servers": [
        {
          "url": "https://crm-documents.keybeapi.com",
          "description": "Production"
        }
      ],
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "createFolder",
        "summary": "Create a folder",
        "description": "Creates a folder in the contact's documents, at root level or inside `parentId`.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact that owns the documents.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FolderCreate"
              },
              "example": {
                "name": "Contratos"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created folder.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34ce",
                  "app": "app_7f3k2m9x1q",
                  "userId": "4n8b2v6clq3k8r2x",
                  "parentId": null,
                  "isFolder": true,
                  "name": "Contratos",
                  "access": "private",
                  "versions": [],
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/documents/{contactUUID}/upload": {
      "servers": [
        {
          "url": "https://crm-documents.keybeapi.com",
          "description": "Production"
        }
      ],
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "uploadDocument",
        "summary": "Upload a file",
        "description": "Uploads a file (multipart/form-data, field `file`, maximum 50 MB) to the contact's documents. If the contact already has a document with the same `name` (in any folder), that document is updated with the new file and the previous file is kept in `versions`.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact that owns the documents.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FileUpload"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The stored document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "userId": "4n8b2v6clq3k8r2x",
                  "parentId": "665f1c2e8a4b3d0012ab34ce",
                  "isFolder": false,
                  "name": "contrato-2026.pdf",
                  "tags": [
                    "contrato"
                  ],
                  "access": "private",
                  "storage": {
                    "provider": "aws",
                    "url": "https://files.example.com/crm/documents/app_7f3k2m9x1q/4n8b2v6clq3k8r2x/contrato-2026.pdf",
                    "bucket": "example-bucket",
                    "folder": "crm/documents/app_7f3k2m9x1q/4n8b2v6clq3k8r2x"
                  },
                  "file": {
                    "name": "contrato-2026.pdf",
                    "internalName": "contrato-2026.pdf",
                    "ext": "pdf",
                    "size": 182044,
                    "mimetype": "application/pdf"
                  },
                  "versions": [],
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/documents/{contactUUID}/{documentId}": {
      "servers": [
        {
          "url": "https://crm-documents.keybeapi.com",
          "description": "Production"
        }
      ],
      "delete": {
        "tags": [
          "Documents"
        ],
        "operationId": "deleteDocument",
        "summary": "Delete a document",
        "description": "Deletes a file or folder (soft delete: it disappears from the API). Deleting a folder does not delete its content. Returns the deleted document.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "contactUUID",
            "in": "path",
            "required": true,
            "description": "`uuid` of the contact that owns the documents.",
            "schema": {
              "type": "string"
            },
            "example": "4n8b2v6clq3k8r2x"
          },
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "description": "Document id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34cd",
                  "app": "app_7f3k2m9x1q",
                  "userId": "4n8b2v6clq3k8r2x",
                  "parentId": "665f1c2e8a4b3d0012ab34ce",
                  "isFolder": false,
                  "name": "contrato-2026.pdf",
                  "tags": [
                    "contrato"
                  ],
                  "access": "private",
                  "storage": {
                    "provider": "aws",
                    "url": "https://files.example.com/crm/documents/app_7f3k2m9x1q/4n8b2v6clq3k8r2x/contrato-2026.pdf",
                    "bucket": "example-bucket",
                    "folder": "crm/documents/app_7f3k2m9x1q/4n8b2v6clq3k8r2x"
                  },
                  "file": {
                    "name": "contrato-2026.pdf",
                    "internalName": "contrato-2026.pdf",
                    "ext": "pdf",
                    "size": 182044,
                    "mimetype": "application/pdf"
                  },
                  "versions": [],
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/segments/people": {
      "servers": [
        {
          "url": "https://crm-segments.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Segments"
        ],
        "operationId": "listSegments",
        "summary": "List segments",
        "description": "Returns the segments (contact lists) of people of the app, newest first, as `{ data, paginator }`. `offset` is the page number starting at 1 (`0` is treated as `1`); `limit` defaults to 10. For segments of businesses use List business segments.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 20
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive partial match on the name. Characters other than letters, digits, `_` and spaces are ignored.",
            "schema": {
              "type": "string"
            },
            "example": "clientes"
          },
          {
            "name": "inactive",
            "in": "query",
            "required": false,
            "description": "`true` returns only inactive segments, `false` only active ones; omit for both.",
            "schema": {
              "type": "boolean"
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "A page of segments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34d0",
                      "app": "app_7f3k2m9x1q",
                      "typeEntity": "people",
                      "name": "Clientes recurrentes",
                      "type": "static",
                      "totalContacts": 128,
                      "inactive": false,
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    },
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cf",
                      "app": "app_7f3k2m9x1q",
                      "typeEntity": "people",
                      "name": "Leads de WhatsApp",
                      "type": "dynamic",
                      "filter": {
                        "registerChannel": [
                          "whatsapp"
                        ],
                        "status": [
                          "665f1c2e8a4b3d0012ab34cf"
                        ]
                      },
                      "totalContacts": 0,
                      "inactive": false,
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 2,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/segments/business": {
      "servers": [
        {
          "url": "https://crm-segments.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Segments"
        ],
        "operationId": "listBusinessSegments",
        "summary": "List business segments",
        "description": "Same as List segments, for segments whose `typeEntity` is `business`.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Page number, **1-based**. `0` (the default) and `1` both return the first page; `2` returns the second page. ",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 1
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size. Default 10.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 10
            },
            "example": 20
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Case-insensitive partial match on the name. Characters other than letters, digits, `_` and spaces are ignored.",
            "schema": {
              "type": "string"
            },
            "example": "clientes"
          },
          {
            "name": "inactive",
            "in": "query",
            "required": false,
            "description": "`true` returns only inactive segments, `false` only active ones; omit for both.",
            "schema": {
              "type": "boolean"
            },
            "example": false
          }
        ],
        "responses": {
          "200": {
            "description": "A page of segments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentList"
                },
                "example": {
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34d0",
                      "app": "app_7f3k2m9x1q",
                      "typeEntity": "business",
                      "name": "Mayoristas",
                      "type": "static",
                      "totalContacts": 12,
                      "inactive": false,
                      "createdBy": {
                        "userId": "u_8f2k1m",
                        "type": "admin",
                        "name": "Andrés",
                        "lastname": "Pérez",
                        "email": "andres@example.com"
                      },
                      "createdAt": "2026-08-14T15:32:10.000Z",
                      "updatedAt": "2026-08-14T15:32:10.000Z"
                    }
                  ],
                  "paginator": {
                    "totalDocs": 1,
                    "limit": 10,
                    "page": 1,
                    "totalPages": 1,
                    "pagingCounter": 1,
                    "hasPrevPage": false,
                    "hasNextPage": false,
                    "prevPage": null,
                    "nextPage": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/segments/{typeEntity}/{segmentId}": {
      "servers": [
        {
          "url": "https://crm-segments.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Segments"
        ],
        "operationId": "getSegment",
        "summary": "Get a segment",
        "description": "Returns one segment by id.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "typeEntity",
            "in": "path",
            "required": true,
            "description": "Kind of contacts the segment groups.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "business"
              ]
            },
            "example": "people"
          },
          {
            "name": "segmentId",
            "in": "path",
            "required": true,
            "description": "Segment id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34d0"
          }
        ],
        "responses": {
          "200": {
            "description": "The segment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34d0",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Clientes recurrentes",
                  "type": "static",
                  "totalContacts": 128,
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Segments"
        ],
        "operationId": "deleteSegment",
        "summary": "Delete a segment",
        "description": "Deletes the segment (soft delete: it disappears from the API) and returns it as it was before the deletion.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "typeEntity",
            "in": "path",
            "required": true,
            "description": "Kind of contacts the segment groups.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "business"
              ]
            },
            "example": "people"
          },
          {
            "name": "segmentId",
            "in": "path",
            "required": true,
            "description": "Segment id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34d0"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted segment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34d0",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Clientes recurrentes",
                  "type": "static",
                  "totalContacts": 128,
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/segments/{typeEntity}/name/{name}": {
      "servers": [
        {
          "url": "https://crm-segments.keybeapi.com",
          "description": "Production"
        }
      ],
      "get": {
        "tags": [
          "Segments"
        ],
        "operationId": "getSegmentByName",
        "summary": "Get a segment by name",
        "description": "Returns the segment with exactly this name (case-sensitive).",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "typeEntity",
            "in": "path",
            "required": true,
            "description": "Kind of contacts the segment groups.",
            "schema": {
              "type": "string",
              "enum": [
                "people",
                "business"
              ]
            },
            "example": "people"
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Segment name, URL-encoded.",
            "schema": {
              "type": "string"
            },
            "example": "Clientes recurrentes"
          }
        ],
        "responses": {
          "200": {
            "description": "The segment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34d0",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Clientes recurrentes",
                  "type": "static",
                  "totalContacts": 128,
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/{appUUID}/segments": {
      "servers": [
        {
          "url": "https://crm-segments.keybeapi.com",
          "description": "Production"
        }
      ],
      "post": {
        "tags": [
          "Segments"
        ],
        "operationId": "createSegment",
        "summary": "Create a segment",
        "description": "Creates a segment. Its name must be unique per app and `typeEntity` (400). For a `static` segment, add contacts by setting the segment in the contact's `segments` (Update a contact or business). For a `dynamic` segment, store the criteria in `filter`.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SegmentCreate"
              },
              "examples": {
                "static": {
                  "summary": "Static segment",
                  "value": {
                    "typeEntity": "people",
                    "name": "Clientes recurrentes",
                    "type": "static"
                  }
                },
                "dynamic": {
                  "summary": "Dynamic segment",
                  "value": {
                    "typeEntity": "people",
                    "name": "Leads de WhatsApp",
                    "type": "dynamic",
                    "filter": {
                      "registerChannel": [
                        "whatsapp"
                      ],
                      "status": [
                        "665f1c2e8a4b3d0012ab34cf"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created segment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34d0",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Clientes recurrentes",
                  "type": "static",
                  "totalContacts": 128,
                  "inactive": false,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/{appUUID}/segments/{segmentId}": {
      "servers": [
        {
          "url": "https://crm-segments.keybeapi.com",
          "description": "Production"
        }
      ],
      "patch": {
        "tags": [
          "Segments"
        ],
        "operationId": "updateSegment",
        "summary": "Update a segment",
        "description": "Changes any field of a segment and returns it.",
        "parameters": [
          {
            "name": "appUUID",
            "in": "path",
            "required": true,
            "description": "Your app id (the App ID shown in Settings → API keys).",
            "schema": {
              "type": "string"
            },
            "example": "app_7f3k2m9x1q"
          },
          {
            "name": "segmentId",
            "in": "path",
            "required": true,
            "description": "Segment id (24-hex).",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34d0"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SegmentUpdate"
              },
              "example": {
                "inactive": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated segment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                },
                "example": {
                  "_id": "665f1c2e8a4b3d0012ab34d0",
                  "app": "app_7f3k2m9x1q",
                  "typeEntity": "people",
                  "name": "Clientes recurrentes",
                  "type": "static",
                  "totalContacts": 128,
                  "inactive": true,
                  "createdBy": {
                    "userId": "u_8f2k1m",
                    "type": "admin",
                    "name": "Andrés",
                    "lastname": "Pérez",
                    "email": "andres@example.com"
                  },
                  "createdAt": "2026-08-14T15:32:10.000Z",
                  "updatedAt": "2026-08-14T15:32:10.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your app's API key (Settings → API keys) or an Identity access token."
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid input. `message` says which field failed.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "statusCode": 400,
              "message": [
                "phone.0.verify must be a boolean value"
              ],
              "error": "Bad Request"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing, invalid, expired or revoked credential.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "statusCode": 401,
              "message": "Invalid token",
              "error": "Unauthorized"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The credential is valid but not enough: its owner's role lacks the permission, or the account in the path isn't one of theirs.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "statusCode": 403,
              "message": "No tiene permiso para esta app app_7f3k2m9x1q",
              "error": "Forbidden"
            }
          }
        }
      },
      "NotFound": {
        "description": "The record does not exist in this app.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "statusCode": 404,
              "message": "people Contact 4n8b2v6clq3k8r2x not found",
              "error": "Not Found"
            }
          }
        }
      },
      "Conflict": {
        "description": "The status still has contacts and no `migrateTo` was given. `data.count` is the number of contacts in it.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              ]
            },
            "example": {
              "statusCode": 409,
              "message": "STATUS_HAS_CONTACTS",
              "data": {
                "count": 42
              }
            }
          }
        }
      },
      "ActivityError": {
        "description": "The activity operation failed (malformed id, activity not found or a storage error) and the error comes inside the activities envelope. The HTTP status equals `statusCode`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ActivityError"
            },
            "example": {
              "status": "ERROR",
              "message": "Activity not found",
              "data": {},
              "statusCode": 404
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Error body. Contacts and notes (crm-contacts) also include `timestamp` and `path`.",
        "properties": {
          "statusCode": {
            "type": "integer",
            "description": "HTTP status code.",
            "example": 400
          },
          "message": {
            "description": "What went wrong. Validation errors return one message per failed field.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "error": {
            "type": "string",
            "description": "HTTP status name.",
            "example": "Bad Request"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Only in crm-contacts responses."
          },
          "path": {
            "type": "string",
            "description": "Only in crm-contacts responses."
          }
        }
      },
      "Paginator": {
        "type": "object",
        "description": "Page metadata. `page` is 1-based.",
        "properties": {
          "totalDocs": {
            "type": "integer",
            "description": "Total matching records."
          },
          "limit": {
            "type": "integer",
            "description": "Page size used."
          },
          "page": {
            "type": "integer",
            "description": "Current page (1-based)."
          },
          "totalPages": {
            "type": "integer",
            "description": "Number of pages."
          },
          "pagingCounter": {
            "type": "integer",
            "description": "Position of the first record of this page (1-based)."
          },
          "hasPrevPage": {
            "type": "boolean"
          },
          "hasNextPage": {
            "type": "boolean"
          },
          "prevPage": {
            "type": "integer",
            "nullable": true
          },
          "nextPage": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "UserRef": {
        "type": "object",
        "description": "User (or API key owner) that performed the action, taken from the credential.",
        "properties": {
          "userId": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "lastname": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string"
          }
        }
      },
      "Responsible": {
        "type": "object",
        "description": "User of your app in charge of the record.",
        "required": [
          "uuid",
          "name"
        ],
        "properties": {
          "uuid": {
            "type": "string",
            "description": "User uuid (see the Identity API, team members)."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Optional. Must be a valid email."
          },
          "phone": {
            "type": "string",
            "description": "Optional. Digits with country code, e.g. `573001112233`."
          }
        }
      },
      "Phone": {
        "type": "object",
        "required": [
          "value",
          "countryCode",
          "isPrimary",
          "verify"
        ],
        "properties": {
          "value": {
            "type": "string",
            "description": "Full international number: country code + national number, digits only, e.g. `573001234567`. A leading `+` and spaces are accepted and removed before storing; any other character is stored as sent, so send digits only. A national number without country code (e.g. `3001234567`) is rejected with 400."
          },
          "countryCode": {
            "type": "string",
            "description": "Country calling code without `+`, e.g. `57`. Required (not derived from `value`)."
          },
          "country": {
            "type": "string",
            "readOnly": true,
            "description": "ISO 3166-1 alpha-2 country, set by the API from `value`."
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether this is the contact's main phone."
          },
          "verify": {
            "type": "boolean",
            "description": "Whether the number is verified. Required by validation; send `false` if unknown."
          }
        }
      },
      "Email": {
        "type": "object",
        "required": [
          "value",
          "isPrimary",
          "verify"
        ],
        "properties": {
          "value": {
            "type": "string",
            "format": "email",
            "description": "Email address. Trimmed and stored in lowercase."
          },
          "isPrimary": {
            "type": "boolean",
            "description": "Whether this is the contact's main email."
          },
          "verify": {
            "type": "boolean",
            "description": "Whether the email is verified. Required by validation; send `false` if unknown."
          }
        }
      },
      "RegisterChannel": {
        "type": "object",
        "required": [
          "channel"
        ],
        "properties": {
          "channel": {
            "type": "string",
            "enum": [
              "instagram",
              "gmail",
              "linkedin",
              "spotify",
              "facebook",
              "whatsapp",
              "google",
              "other",
              "api",
              "form",
              "auth",
              "email",
              "phone",
              "events",
              "triggers",
              "social",
              "apple",
              "facebookMessenger",
              "facebookAdds",
              "chatWeb",
              "import",
              "vtex",
              "salesforce",
              "outlook",
              "yahoo",
              "twitter",
              "dashboard",
              "wizard",
              "rdStation",
              "web",
              "shopify",
              "sms",
              "simulator",
              "hubspot",
              "tiktok",
              "callhub"
            ],
            "description": "Channel the contact came from. Use `api` for integrations."
          },
          "data": {
            "type": "string",
            "description": "Optional free text about the origin (e.g. the form or campaign)."
          }
        }
      },
      "ExtraData": {
        "type": "object",
        "required": [
          "field",
          "value"
        ],
        "description": "Value of a custom field. `field` must be the slug of a custom field already configured in the app for this entity type; unknown slugs are rejected with 400.",
        "properties": {
          "field": {
            "type": "string",
            "description": "Custom field slug."
          },
          "value": {
            "type": "string",
            "description": "Value, always as a string."
          }
        }
      },
      "ExtendedData": {
        "type": "object",
        "required": [
          "category",
          "field"
        ],
        "description": "Value of an extended (catalog) field. The `category` + `field` pair must exist in the app's extended fields; otherwise 400.",
        "properties": {
          "category": {
            "type": "string",
            "description": "Extended field category."
          },
          "field": {
            "type": "string",
            "description": "Extended field name."
          },
          "value": {
            "type": "string",
            "description": "Single value."
          },
          "valueArray": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Multiple simple values."
          },
          "valueMultiple": {
            "type": "array",
            "description": "Groups of sub-field values; each sub-`field` must be a child of the extended field.",
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ExtraData"
              }
            }
          }
        }
      },
      "SegmentRef": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Segment id (24-hex)."
          },
          "name": {
            "type": "string",
            "description": "Segment name."
          }
        }
      },
      "StatusRef": {
        "type": "object",
        "description": "Contact status, expanded.",
        "properties": {
          "_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        }
      },
      "BusinessRef": {
        "type": "object",
        "required": [
          "uuid"
        ],
        "properties": {
          "uuid": {
            "type": "string",
            "description": "`uuid` of an existing business of the app."
          },
          "name": {
            "type": "string",
            "description": "Ignored on write: the API copies the business's current name."
          }
        }
      },
      "Address": {
        "type": "object",
        "properties": {
          "typeAddress": {
            "type": "string",
            "description": "Address type (defaults to home)."
          },
          "value": {
            "type": "string",
            "description": "Street address."
          },
          "description": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "zone": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "isPrimary": {
            "type": "boolean"
          }
        }
      },
      "HabeasData": {
        "type": "object",
        "description": "Personal-data consent (habeas data) of the contact.",
        "properties": {
          "habeasDataStatus": {
            "type": "string",
            "enum": [
              "Confirmed",
              "Unconfirmed",
              "OnlyLegals",
              "Blacklist"
            ],
            "default": "Unconfirmed",
            "description": "Consent status. `Blacklist` contacts are excluded from exports and campaigns."
          },
          "habeasDataAccepted": {
            "type": "boolean",
            "default": false,
            "description": "Whether the contact accepted the terms."
          },
          "habeasDataTermsMessage": {
            "type": "string",
            "description": "Text of the terms the contact accepted."
          },
          "habeasDataAcceptedEmail": {
            "type": "boolean",
            "default": true,
            "description": "Accepts email messages."
          },
          "habeasDataAcceptedSms": {
            "type": "boolean",
            "default": true,
            "description": "Accepts SMS."
          },
          "habeasDataAcceptedWhatsapp": {
            "type": "boolean",
            "default": true,
            "description": "Accepts WhatsApp messages."
          },
          "habeasDataAcceptedPhone": {
            "type": "boolean",
            "default": true,
            "description": "Accepts phone calls."
          },
          "habeasDataAcceptedMail": {
            "type": "boolean",
            "default": true,
            "description": "Accepts postal mail."
          },
          "habeasDataDate": {
            "type": "string",
            "format": "date-time",
            "description": "When the consent was given."
          },
          "habeasDataIp": {
            "type": "string",
            "description": "IP the consent was given from."
          },
          "habeasDataCountry": {
            "type": "string",
            "description": "Country the consent was given from."
          }
        }
      },
      "ExternalId": {
        "type": "object",
        "properties": {
          "systemName": {
            "type": "string",
            "description": "Name of the external system (e.g. your ERP)."
          },
          "value": {
            "type": "string",
            "description": "Id of the contact in that system."
          }
        }
      },
      "Source": {
        "type": "object",
        "description": "Marketing origin of the contact.",
        "properties": {
          "utmSource": {
            "type": "string"
          },
          "utmMedium": {
            "type": "string"
          },
          "utmCampaign": {
            "type": "string"
          },
          "utmTerm": {
            "type": "string"
          },
          "utmContent": {
            "type": "string"
          },
          "utmPartner": {
            "type": "string"
          },
          "utmKam": {
            "type": "string"
          },
          "utmCloser": {
            "type": "string"
          },
          "channel": {
            "type": "string"
          },
          "channelOther": {
            "type": "string"
          }
        }
      },
      "ContactCreate": {
        "type": "object",
        "required": [
          "typeEntity",
          "registerChannel",
          "name"
        ],
        "description": "Fields to create a person or a business. At least one `phone` or one `email` is required. Only the most common fields are listed; more profile fields exist.",
        "properties": {
          "typeEntity": {
            "type": "string",
            "enum": [
              "people",
              "business"
            ],
            "description": "**Required discriminator.** `people` creates a person, `business` creates a company. It decides which list the contact appears in and which paths you use to read it."
          },
          "registerChannel": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/RegisterChannel"
            },
            "description": "How the contact was acquired. Set once on create; it cannot be changed by update."
          },
          "name": {
            "type": "string",
            "description": "First name (people) or company name (business). For people, characters other than letters, accented letters, `ñ` and spaces are removed; if nothing is left it becomes `Not defined`."
          },
          "midname": {
            "type": "string",
            "description": "Middle name (people)."
          },
          "surname": {
            "type": "string",
            "description": "Last name (people)."
          },
          "phone": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Phone"
            },
            "description": "Phones. No other contact of the same type in the app may already have one of these numbers (400)."
          },
          "email": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            },
            "description": "Emails. No other contact of the same type in the app may already have one of these emails (400)."
          },
          "documentType": {
            "type": "string",
            "enum": [
              "passport",
              "citizen_card",
              "identification_card",
              "snn",
              "nit",
              "ein",
              "dni",
              "foreigner_id",
              "curp",
              "civil_registry",
              "special_work_permit",
              "temporary_protection_permit",
              "drivers_license",
              "diplomatic_id_card",
              "military_service_card",
              "permanent_resident_visa",
              "temporary_work_permit",
              "labor_identification_code",
              "rut",
              "itin",
              "permanent_resident_card",
              "ead",
              "temporary_stay_permit",
              "citizenship_card"
            ],
            "description": "Identity document type."
          },
          "document": {
            "type": "string",
            "description": "Identity document number. For businesses it must be unique in the app."
          },
          "gender": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "non-binary",
              "transgender male",
              "transgender female",
              "gender queer",
              "gender fluid",
              "intersex",
              "agender",
              "bigender",
              "androgynous",
              "prefer not to say"
            ]
          },
          "birthDate": {
            "type": "string",
            "format": "date-time",
            "description": "Birth date (ISO 8601)."
          },
          "photo": {
            "type": "string",
            "description": "URL of the contact's photo."
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Free-form tags."
          },
          "status": {
            "type": "string",
            "description": "Status id (24-hex) from List statuses. On create, if omitted, the app's default status (if any) is applied."
          },
          "responsible": {
            "$ref": "#/components/schemas/Responsible"
          },
          "segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SegmentRef"
            },
            "description": "Static segments the contact belongs to. Replaces the whole list."
          },
          "extraData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            },
            "description": "Custom field values. On update, values are merged by `field` (fields you don't send are kept)."
          },
          "extendedData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtendedData"
            },
            "description": "Extended field values. On update, merged by `field`."
          },
          "address": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "country": {
            "type": "string",
            "description": "Country name. On create it is overwritten from the first phone's country code when a phone is sent."
          },
          "province": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "timeZone": {
            "type": "string",
            "description": "IANA time zone. On create it is set from the first phone's country when a phone is sent."
          },
          "business": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessRef"
            },
            "description": "People only: businesses the person belongs to. Every `uuid` must be an existing business of the app (400 otherwise)."
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "externalIds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalId"
            },
            "description": "Ids of the contact in your other systems."
          },
          "habeasData": {
            "$ref": "#/components/schemas/HabeasData"
          },
          "allowReceiveMessageForChat": {
            "type": "boolean",
            "description": "Whether the contact can receive chat messages. Defaults to `true`."
          },
          "businessType": {
            "type": "string",
            "description": "Business only: type or industry of the company."
          },
          "duns": {
            "type": "string",
            "description": "Business only: D-U-N-S number."
          }
        }
      },
      "ContactUpdate": {
        "type": "object",
        "required": [
          "typeEntity"
        ],
        "description": "Any subset of the contact fields. Arrays (`phone`, `email`, `tags`, `address`, `segments`...) replace the stored list unless `isPushData` is `true`. `registerChannel` is ignored. If the contact's identity was verified, `name`, `midname`, `surname`, `document`, `documentType`, `gender` and `birthDate` are silently ignored.",
        "properties": {
          "typeEntity": {
            "type": "string",
            "enum": [
              "people",
              "business"
            ],
            "description": "**Required.** Type of the contact being updated; it must match the stored contact or the API answers 404."
          },
          "isPushData": {
            "type": "boolean",
            "default": false,
            "description": "When `true`, `phone`, `email`, `tags`, `address`, `business` and `externalIds` are added to the existing values (deduplicated) instead of replacing them."
          },
          "name": {
            "type": "string",
            "description": "First name (people) or company name (business). For people, characters other than letters, accented letters, `ñ` and spaces are removed; if nothing is left it becomes `Not defined`."
          },
          "midname": {
            "type": "string",
            "description": "Middle name (people)."
          },
          "surname": {
            "type": "string",
            "description": "Last name (people)."
          },
          "phone": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Phone"
            },
            "description": "Phones. No other contact of the same type in the app may already have one of these numbers (400)."
          },
          "email": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            },
            "description": "Emails. No other contact of the same type in the app may already have one of these emails (400)."
          },
          "documentType": {
            "type": "string",
            "enum": [
              "passport",
              "citizen_card",
              "identification_card",
              "snn",
              "nit",
              "ein",
              "dni",
              "foreigner_id",
              "curp",
              "civil_registry",
              "special_work_permit",
              "temporary_protection_permit",
              "drivers_license",
              "diplomatic_id_card",
              "military_service_card",
              "permanent_resident_visa",
              "temporary_work_permit",
              "labor_identification_code",
              "rut",
              "itin",
              "permanent_resident_card",
              "ead",
              "temporary_stay_permit",
              "citizenship_card"
            ],
            "description": "Identity document type."
          },
          "document": {
            "type": "string",
            "description": "Identity document number. For businesses it must be unique in the app."
          },
          "gender": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "non-binary",
              "transgender male",
              "transgender female",
              "gender queer",
              "gender fluid",
              "intersex",
              "agender",
              "bigender",
              "androgynous",
              "prefer not to say"
            ]
          },
          "birthDate": {
            "type": "string",
            "format": "date-time",
            "description": "Birth date (ISO 8601)."
          },
          "photo": {
            "type": "string",
            "description": "URL of the contact's photo."
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Free-form tags."
          },
          "status": {
            "type": "string",
            "description": "Status id (24-hex) from List statuses. On create, if omitted, the app's default status (if any) is applied."
          },
          "responsible": {
            "$ref": "#/components/schemas/Responsible"
          },
          "segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SegmentRef"
            },
            "description": "Static segments the contact belongs to. Replaces the whole list."
          },
          "extraData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            },
            "description": "Custom field values. On update, values are merged by `field` (fields you don't send are kept)."
          },
          "extendedData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtendedData"
            },
            "description": "Extended field values. On update, merged by `field`."
          },
          "address": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "country": {
            "type": "string",
            "description": "Country name. On create it is overwritten from the first phone's country code when a phone is sent."
          },
          "province": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "timeZone": {
            "type": "string",
            "description": "IANA time zone. On create it is set from the first phone's country when a phone is sent."
          },
          "business": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessRef"
            },
            "description": "People only: businesses the person belongs to. Every `uuid` must be an existing business of the app (400 otherwise)."
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "externalIds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalId"
            },
            "description": "Ids of the contact in your other systems."
          },
          "habeasData": {
            "$ref": "#/components/schemas/HabeasData"
          },
          "allowReceiveMessageForChat": {
            "type": "boolean",
            "description": "Whether the contact can receive chat messages. Defaults to `true`."
          },
          "businessType": {
            "type": "string",
            "description": "Business only: type or industry of the company."
          },
          "duns": {
            "type": "string",
            "description": "Business only: D-U-N-S number."
          }
        }
      },
      "Contact": {
        "type": "object",
        "description": "A person or business in the CDP. Only the most used fields are listed; contacts can carry more profile fields.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Internal id. Use `uuid` to address the contact in the API."
          },
          "uuid": {
            "type": "string",
            "description": "Contact identifier used in every path."
          },
          "app": {
            "type": "string",
            "description": "App the contact belongs to."
          },
          "typeEntity": {
            "type": "string",
            "enum": [
              "people",
              "business"
            ]
          },
          "name": {
            "type": "string"
          },
          "midname": {
            "type": "string"
          },
          "surname": {
            "type": "string"
          },
          "fullname": {
            "type": "string",
            "description": "Computed: name + midname + surname (people) or name (business)."
          },
          "documentType": {
            "type": "string"
          },
          "document": {
            "type": "string"
          },
          "phone": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Phone"
            }
          },
          "email": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Email"
            }
          },
          "registerChannel": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegisterChannel"
            }
          },
          "status": {
            "$ref": "#/components/schemas/StatusRef"
          },
          "statusAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the status last changed."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SegmentRef"
            }
          },
          "responsible": {
            "$ref": "#/components/schemas/Responsible"
          },
          "extraData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            }
          },
          "extendedData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtendedData"
            }
          },
          "business": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessRef"
            }
          },
          "address": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "gender": {
            "type": "string"
          },
          "birthDate": {
            "type": "string",
            "format": "date-time"
          },
          "country": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "timeZone": {
            "type": "string"
          },
          "nationality": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "externalIds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExternalId"
            }
          },
          "habeasData": {
            "$ref": "#/components/schemas/HabeasData"
          },
          "allowReceiveMessageForChat": {
            "type": "boolean"
          },
          "businessType": {
            "type": "string",
            "description": "Business only."
          },
          "duns": {
            "type": "string",
            "description": "Business only."
          },
          "createdBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ContactList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "paginator": {
            "$ref": "#/components/schemas/Paginator"
          }
        }
      },
      "ContactSearchResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            },
            "description": "Matching contacts, best match first. `status` is the raw status id here, not expanded."
          },
          "total": {
            "type": "integer",
            "description": "Total number of matches."
          }
        }
      },
      "Note": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Note id."
          },
          "app": {
            "type": "string"
          },
          "uuid": {
            "type": "string",
            "description": "`uuid` of the contact the note belongs to."
          },
          "text": {
            "type": "string"
          },
          "createdBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "NoteList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Note"
            }
          },
          "paginator": {
            "$ref": "#/components/schemas/Paginator"
          }
        }
      },
      "NoteCreate": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "description": "Note content (plain text)."
          }
        }
      },
      "NoteDeleteResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Always `true` when the request is valid."
          },
          "deletedCount": {
            "type": "integer",
            "description": "`1` if the note was deleted, `0` if no note matched."
          }
        }
      },
      "ActivityProperty": {
        "type": "object",
        "properties": {
          "property": {
            "type": "string",
            "description": "Key."
          },
          "value": {
            "type": "string",
            "description": "Value."
          }
        }
      },
      "ActivityCreate": {
        "type": "object",
        "required": [
          "name",
          "typeActivity"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Title of the activity. For an email touch, the subject."
          },
          "typeActivity": {
            "type": "string",
            "enum": [
              "call",
              "email",
              "whatsapp",
              "sms",
              "meeting",
              "note",
              "campaign_sms",
              "campaign_email",
              "campaign_whatsapp",
              "chat_start",
              "chat_conversation",
              "chat_end",
              "other",
              "person_created",
              "person_updated",
              "changed_journey",
              "crm_task",
              "pipeline_opportunity_created",
              "pipeline_opportunity_step_changed",
              "funnel_card_created",
              "funnel_card_stepchanged",
              "integrations_abandoned_cart",
              "integrations_order_confirm",
              "integrations_aircall"
            ],
            "description": "Kind of activity."
          },
          "body": {
            "type": "string",
            "description": "Content or summary. Required (non-empty) for touches."
          },
          "result": {
            "type": "string",
            "description": "Outcome of the activity."
          },
          "dateStart": {
            "type": "string",
            "format": "date-time",
            "description": "When it started. For touches, when it happened (defaults to now)."
          },
          "dateEnd": {
            "type": "string",
            "format": "date-time",
            "description": "When it ended. Ignored for touches."
          },
          "properties": {
            "type": "object",
            "description": "Call details.",
            "properties": {
              "duration": {
                "type": "string",
                "description": "Call duration in seconds, as a numeric string. Required for `call` touches."
              },
              "call_direction": {
                "type": "string",
                "description": "Call direction (e.g. inbound, outbound)."
              }
            }
          },
          "propertyData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityProperty"
            },
            "description": "Extra key/value data. A `call` touch requires an entry with `property: \"phone\"`."
          },
          "isTouch": {
            "type": "boolean",
            "default": false,
            "description": "Marks the activity as a direct touch with the contact. Only allowed for `typeActivity` `call`, `email`, `whatsapp`, `sms`, `meeting`, `note`; each touch type has required fields (see the operation description)."
          },
          "cardId": {
            "type": "string",
            "description": "Id of the SalesCard (opportunity) the activity relates to."
          }
        }
      },
      "Activity": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Activity id."
          },
          "appUUID": {
            "type": "string"
          },
          "typeEntity": {
            "type": "string",
            "enum": [
              "people",
              "business"
            ]
          },
          "entityId": {
            "type": "string",
            "description": "`uuid` of the contact."
          },
          "name": {
            "type": "string"
          },
          "typeActivity": {
            "type": "string",
            "enum": [
              "call",
              "email",
              "whatsapp",
              "sms",
              "meeting",
              "note",
              "campaign_sms",
              "campaign_email",
              "campaign_whatsapp",
              "chat_start",
              "chat_conversation",
              "chat_end",
              "other",
              "person_created",
              "person_updated",
              "changed_journey",
              "crm_task",
              "pipeline_opportunity_created",
              "pipeline_opportunity_step_changed",
              "funnel_card_created",
              "funnel_card_stepchanged",
              "integrations_abandoned_cart",
              "integrations_order_confirm",
              "integrations_aircall"
            ]
          },
          "body": {
            "type": "string"
          },
          "result": {
            "type": "string"
          },
          "dateStart": {
            "type": "string",
            "format": "date-time"
          },
          "dateEnd": {
            "type": "string",
            "format": "date-time"
          },
          "properties": {
            "type": "object",
            "properties": {
              "duration": {
                "type": "string"
              },
              "call_direction": {
                "type": "string"
              }
            }
          },
          "propertyData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityProperty"
            }
          },
          "isTouch": {
            "type": "boolean"
          },
          "cardId": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "Where the activity was created: `RestAPI` for API calls; other values come from Biky's own processes."
          },
          "createdByUser": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "uuid": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "lastName": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ActivityResponse": {
        "type": "object",
        "description": "Activities response envelope.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "ERROR"
            ]
          },
          "message": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {
              "activity": {
                "$ref": "#/components/schemas/Activity"
              }
            }
          },
          "statusCode": {
            "type": "integer"
          }
        }
      },
      "ActivityListResponse": {
        "type": "object",
        "description": "Activities response envelope. `paginator.totalDocs` is capped at 10000.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "ERROR"
            ]
          },
          "message": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {
              "activities": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Activity"
                }
              },
              "paginator": {
                "$ref": "#/components/schemas/Paginator"
              }
            }
          },
          "statusCode": {
            "type": "integer"
          }
        }
      },
      "ActivityError": {
        "type": "object",
        "description": "Error envelope returned by the Activities operations (the HTTP status equals `statusCode`).",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ERROR"
            ]
          },
          "message": {
            "type": "string"
          },
          "data": {
            "type": "object"
          },
          "statusCode": {
            "type": "integer"
          }
        }
      },
      "ContactRef": {
        "type": "object",
        "required": [
          "uuid",
          "name"
        ],
        "properties": {
          "uuid": {
            "type": "string",
            "description": "Contact `uuid`."
          },
          "name": {
            "type": "string",
            "description": "Contact name to display."
          }
        }
      },
      "TaskCreate": {
        "type": "object",
        "required": [
          "title",
          "contact",
          "date"
        ],
        "properties": {
          "title": {
            "type": "string",
            "description": "What has to be done."
          },
          "description": {
            "type": "string"
          },
          "contact": {
            "$ref": "#/components/schemas/ContactRef"
          },
          "responsible": {
            "$ref": "#/components/schemas/Responsible"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Due date and time, ISO 8601 with offset (e.g. `2026-08-20T15:00:00-05:00`)."
          },
          "priority": {
            "type": "string",
            "enum": [
              "emergency",
              "lowest",
              "low",
              "medium",
              "high",
              "highest"
            ],
            "default": "medium"
          },
          "extraData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            },
            "description": "Free key/value data. On update, merged by `field`."
          },
          "inactive": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "TaskUpdate": {
        "type": "object",
        "description": "Any subset of the task fields, plus `status`.",
        "properties": {
          "title": {
            "type": "string",
            "description": "What has to be done."
          },
          "description": {
            "type": "string"
          },
          "contact": {
            "$ref": "#/components/schemas/ContactRef"
          },
          "responsible": {
            "$ref": "#/components/schemas/Responsible"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Due date and time, ISO 8601 with offset (e.g. `2026-08-20T15:00:00-05:00`)."
          },
          "priority": {
            "type": "string",
            "enum": [
              "emergency",
              "lowest",
              "low",
              "medium",
              "high",
              "highest"
            ],
            "default": "medium"
          },
          "extraData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            },
            "description": "Free key/value data. On update, merged by `field`."
          },
          "inactive": {
            "type": "boolean",
            "default": false
          },
          "status": {
            "type": "string",
            "enum": [
              "created",
              "process",
              "done",
              "expired"
            ],
            "description": "Task status. Once a task is `done` it can no longer be changed."
          }
        }
      },
      "Task": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Task id."
          },
          "app": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "contact": {
            "$ref": "#/components/schemas/ContactRef"
          },
          "responsible": {
            "$ref": "#/components/schemas/Responsible"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "priority": {
            "type": "string",
            "enum": [
              "emergency",
              "lowest",
              "low",
              "medium",
              "high",
              "highest"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "created",
              "process",
              "done",
              "expired"
            ]
          },
          "extraData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            }
          },
          "inactive": {
            "type": "boolean"
          },
          "createdBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TaskList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Task"
            }
          },
          "paginator": {
            "$ref": "#/components/schemas/Paginator"
          }
        }
      },
      "StatusCreate": {
        "type": "object",
        "required": [
          "name",
          "color"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Status name, unique in the app."
          },
          "color": {
            "type": "string",
            "description": "Display color, e.g. `#3B82F6`."
          },
          "defaultRegister": {
            "type": "boolean",
            "default": false,
            "description": "If `true`, new contacts created without a status get this one. Only one status can be the default: setting it unsets the previous one."
          },
          "showFilter": {
            "type": "boolean",
            "default": false,
            "description": "Whether the status is offered as a filter in the platform."
          },
          "inactive": {
            "type": "boolean",
            "default": false
          },
          "prompt": {
            "type": "string",
            "description": "Instructions for Biky's AI about when a contact belongs in this status."
          },
          "dependencies": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ids of statuses this one depends on. All must exist (404 otherwise)."
          },
          "extradata": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            },
            "description": "Free key/value data. On update, merged by `field`."
          }
        }
      },
      "StatusUpdate": {
        "type": "object",
        "description": "Any subset of the status fields.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Status name, unique in the app."
          },
          "color": {
            "type": "string",
            "description": "Display color, e.g. `#3B82F6`."
          },
          "defaultRegister": {
            "type": "boolean",
            "default": false,
            "description": "If `true`, new contacts created without a status get this one. Only one status can be the default: setting it unsets the previous one."
          },
          "showFilter": {
            "type": "boolean",
            "default": false,
            "description": "Whether the status is offered as a filter in the platform."
          },
          "inactive": {
            "type": "boolean",
            "default": false
          },
          "prompt": {
            "type": "string",
            "description": "Instructions for Biky's AI about when a contact belongs in this status."
          },
          "dependencies": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ids of statuses this one depends on. All must exist (404 otherwise)."
          },
          "extradata": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            },
            "description": "Free key/value data. On update, merged by `field`."
          }
        }
      },
      "Status": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Status id."
          },
          "app": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "defaultRegister": {
            "type": "boolean"
          },
          "showFilter": {
            "type": "boolean"
          },
          "inactive": {
            "type": "boolean"
          },
          "prompt": {
            "type": "string"
          },
          "dependencies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusRef"
            },
            "description": "Expanded dependencies."
          },
          "extradata": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExtraData"
            }
          },
          "createdBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "StatusList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Status"
            }
          },
          "paginator": {
            "$ref": "#/components/schemas/Paginator"
          }
        }
      },
      "StorageInfo": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "description": "Storage provider (`aws`)."
          },
          "url": {
            "type": "string",
            "description": "URL of the stored file."
          },
          "bucket": {
            "type": "string"
          },
          "folder": {
            "type": "string"
          },
          "uri": {
            "type": "string"
          }
        }
      },
      "FileInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Original file name."
          },
          "internalName": {
            "type": "string",
            "description": "Stored file name."
          },
          "ext": {
            "type": "string"
          },
          "size": {
            "type": "number",
            "description": "Size in bytes."
          },
          "mimetype": {
            "type": "string"
          }
        }
      },
      "Document": {
        "type": "object",
        "description": "A file or folder attached to a contact.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Document id."
          },
          "app": {
            "type": "string"
          },
          "userId": {
            "type": "string",
            "description": "`uuid` of the contact that owns the document."
          },
          "parentId": {
            "type": "string",
            "nullable": true,
            "description": "Id of the containing folder; `null` at root level."
          },
          "isFolder": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "favorite": {
            "type": "boolean"
          },
          "access": {
            "type": "string",
            "enum": [
              "private",
              "public",
              "keybe"
            ]
          },
          "storage": {
            "$ref": "#/components/schemas/StorageInfo"
          },
          "file": {
            "$ref": "#/components/schemas/FileInfo"
          },
          "versions": {
            "type": "array",
            "description": "Previous versions, added when a file with the same name is uploaded again.",
            "items": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "integer"
                },
                "storage": {
                  "$ref": "#/components/schemas/StorageInfo"
                },
                "file": {
                  "$ref": "#/components/schemas/FileInfo"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "createdBy": {
                  "$ref": "#/components/schemas/UserRef"
                }
              }
            }
          },
          "createdBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DocumentList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Document"
            }
          },
          "paginator": {
            "$ref": "#/components/schemas/Paginator"
          }
        }
      },
      "FolderCreate": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Folder name."
          },
          "parentId": {
            "type": "string",
            "description": "Id of the parent folder; omit to create it at root level."
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "favorite": {
            "type": "boolean"
          }
        }
      },
      "FileUpload": {
        "type": "object",
        "required": [
          "file"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "The file. Maximum 50 MB."
          },
          "name": {
            "type": "string",
            "description": "Display name. Defaults to the file name.",
            "example": "contrato-2026.pdf"
          },
          "parentId": {
            "type": "string",
            "description": "Id of the folder to put the file in; omit for root level.",
            "example": "665f1c2e8a4b3d0012ab34ce"
          },
          "description": {
            "type": "string",
            "example": "Contrato firmado"
          },
          "tags": {
            "type": "string",
            "description": "One tag, or a JSON array of tags as a string (e.g. `[\"contrato\",\"2026\"]`).",
            "example": "contrato"
          }
        }
      },
      "ContactFilter": {
        "type": "object",
        "description": "Saved contact filter. Same fields as the `filters[...]` parameters of List contacts (only the common ones are listed).",
        "properties": {
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Status ids."
          },
          "responsible": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Responsible user uuids."
          },
          "registerChannel": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "instagram",
                "gmail",
                "linkedin",
                "spotify",
                "facebook",
                "whatsapp",
                "google",
                "other",
                "api",
                "form",
                "auth",
                "email",
                "phone",
                "events",
                "triggers",
                "social",
                "apple",
                "facebookMessenger",
                "facebookAdds",
                "chatWeb",
                "import",
                "vtex",
                "salesforce",
                "outlook",
                "yahoo",
                "twitter",
                "dashboard",
                "wizard",
                "rdStation",
                "web",
                "shopify",
                "sms",
                "simulator",
                "hubspot",
                "tiktok",
                "callhub"
              ]
            }
          },
          "habeasDataStatus": {
            "type": "string",
            "enum": [
              "Confirmed",
              "Unconfirmed",
              "OnlyLegals",
              "Blacklist"
            ]
          },
          "gender": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "non-binary",
              "transgender male",
              "transgender female",
              "gender queer",
              "gender fluid",
              "intersex",
              "agender",
              "bigender",
              "androgynous",
              "prefer not to say"
            ]
          },
          "city": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "createdAt": {
            "type": "object",
            "properties": {
              "init": {
                "type": "string",
                "description": "YYYY-MM-DD"
              },
              "end": {
                "type": "string",
                "description": "YYYY-MM-DD"
              }
            }
          }
        }
      },
      "SegmentCreate": {
        "type": "object",
        "required": [
          "typeEntity",
          "name",
          "type"
        ],
        "properties": {
          "typeEntity": {
            "type": "string",
            "enum": [
              "people",
              "business"
            ],
            "description": "Kind of contacts the segment groups."
          },
          "name": {
            "type": "string",
            "description": "Segment name, unique per app and `typeEntity`."
          },
          "type": {
            "type": "string",
            "enum": [
              "static",
              "dynamic"
            ],
            "description": "`static`: membership is stored on each contact (`segments` of the contact). `dynamic`: the segment is defined by `filter`."
          },
          "filter": {
            "$ref": "#/components/schemas/ContactFilter"
          },
          "inactive": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "SegmentUpdate": {
        "type": "object",
        "description": "Any subset of the segment fields.",
        "properties": {
          "typeEntity": {
            "type": "string",
            "enum": [
              "people",
              "business"
            ],
            "description": "Kind of contacts the segment groups."
          },
          "name": {
            "type": "string",
            "description": "Segment name, unique per app and `typeEntity`."
          },
          "type": {
            "type": "string",
            "enum": [
              "static",
              "dynamic"
            ],
            "description": "`static`: membership is stored on each contact (`segments` of the contact). `dynamic`: the segment is defined by `filter`."
          },
          "filter": {
            "$ref": "#/components/schemas/ContactFilter"
          },
          "inactive": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "Segment": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Segment id."
          },
          "app": {
            "type": "string"
          },
          "typeEntity": {
            "type": "string",
            "enum": [
              "people",
              "business"
            ]
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "static",
              "dynamic",
              "dinamic"
            ],
            "description": "`dinamic` is a legacy spelling of `dynamic` kept on old records."
          },
          "filter": {
            "$ref": "#/components/schemas/ContactFilter"
          },
          "totalContacts": {
            "type": "integer",
            "description": "Number of contacts in the segment, updated asynchronously."
          },
          "inactive": {
            "type": "boolean"
          },
          "createdBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/UserRef"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SegmentList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Segment"
            }
          },
          "paginator": {
            "$ref": "#/components/schemas/Paginator"
          }
        }
      }
    }
  }
}
