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

# Attach an existing data endpoint function

> Attach a deployed function from the same project and register the flow's
Kapso data endpoint with Meta. Multiple flows can share one function.
Requires a WhatsApp phone number and flows encryption to be configured.
Does not create or deploy a function. Replaces any previous association
without deleting the previous function or rotating the endpoint secret.
Updating or deploying a shared function affects every flow using it.
Published flows are automatically republished; a republish failure returns
HTTP 200 with data.warning and leaves the new association in place.




## OpenAPI

````yaml /api/platform/v1/openapi-platform.yaml patch /whatsapp/flows/{flow_id}/data_endpoint
openapi: 3.1.0
info:
  title: Kapso Platform API
  version: 0.2.0
  description: >
    Build WhatsApp messaging into your product. Manage customers, connect phone
    numbers, send broadcasts, and handle conversations.
servers:
  - url: https://api.kapso.ai/platform/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Customers
    description: Manage customer accounts
  - name: Setup Links
    description: WhatsApp onboarding via embedded signup
  - name: Phone Numbers
    description: Connect and manage WhatsApp numbers
  - name: Webhooks
    description: Subscribe to WhatsApp events
  - name: Display Names
    description: Update WhatsApp business display names
  - name: Broadcasts
    description: |
      Send template messages at scale

      **Alpha**: This API is in alpha and subject to change
  - name: Conversations
    description: Manage conversation state
  - name: Media
    description: Upload media files for WhatsApp messaging
  - name: Users
    description: Manage project team members
  - name: Inbox Embeds
    description: Create and manage embeddable inbox access links
  - name: Webhook Deliveries
    description: View webhook delivery attempts and their status
  - name: External API Logs
    description: View logs of external API calls made by the project
  - name: Log Search
    description: Search log events across API, Meta, workflow, and webhook sources
  - name: Events
    description: Emit and query project-scoped events
  - name: Provider Models
    description: List available AI provider models
  - name: WhatsApp Flows
    description: Build interactive WhatsApp Flows for surveys and forms
  - name: Contacts
    description: Manage WhatsApp contacts
  - name: Findings
    description: Detect recurring problems in conversations and investigate them with AI
  - name: Notifications
    description: >-
      Route project alerts to shared inboxes and Slack channels connected from
      the Kapso app
  - name: WhatsApp Funding
    description: >-
      Read Kapso funding status and recorded messaging and calling usage, and
      stop portfolio funding
paths:
  /whatsapp/flows/{flow_id}/data_endpoint:
    parameters:
      - name: flow_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    patch:
      tags:
        - WhatsApp Flows
      summary: Attach an existing data endpoint function
      description: >
        Attach a deployed function from the same project and register the flow's

        Kapso data endpoint with Meta. Multiple flows can share one function.

        Requires a WhatsApp phone number and flows encryption to be configured.

        Does not create or deploy a function. Replaces any previous association

        without deleting the previous function or rotating the endpoint secret.

        Updating or deploying a shared function affects every flow using it.

        Published flows are automatically republished; a republish failure
        returns

        HTTP 200 with data.warning and leaves the new association in place.
      operationId: updateWhatsappFlowDataEndpoint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - function_id
              properties:
                function_id:
                  type: string
                  format: uuid
                  description: >-
                    UUID of an existing deployed function in this project. Null
                    or empty values are rejected.
      responses:
        '200':
          description: >-
            Function attached and endpoint registered. Check data.warning for
            republish failures.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsappFlowDataEndpointRegisterResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Flow or function not found in this project.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Function is not deployed, phone number or encryption is missing, or
            Meta rejected the endpoint update.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    WhatsappFlowDataEndpointRegisterResponse:
      type: object
      required:
        - data
      properties:
        data:
          allOf:
            - $ref: '#/components/schemas/WhatsappFlowDataEndpoint'
            - type: object
              properties:
                flow_id:
                  type: string
                  format: uuid
                flow_data_endpoint_function_id:
                  type: string
                  format: uuid
                flow_has_encryption:
                  type: boolean
                warning:
                  type:
                    - string
                    - 'null'
                  description: The endpoint was updated but automatic republishing failed.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
    WhatsappFlowDataEndpoint:
      type: object
      required:
        - function_id
        - function_name
        - status
      properties:
        function_id:
          type: string
          format: uuid
        function_name:
          type: string
        endpoint_url:
          type:
            - string
            - 'null'
          format: uri
        status:
          type: string
          enum:
            - draft
            - deployed
            - error
        last_deployed_at:
          type:
            - string
            - 'null'
          format: date-time
        code:
          type: string
          description: Function source code
  responses:
    ValidationError:
      description: Request validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnauthorizedError:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````