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

# Create setup link

> Generate a setup link for customer WhatsApp onboarding.
Creating a new link automatically revokes any existing active links.
Links expire after 30 days.




## OpenAPI

````yaml api/legacy/openapi-platform.yaml post /customers/{customer_id}/setup_links
openapi: 3.0.3
info:
  title: Kapso Platform API
  description: >-
    Build WhatsApp automation into your SaaS. Let your customers connect their
    own WhatsApp Business accounts.
  version: 1.0.0
  contact:
    name: Kapso Support
servers:
  - url: https://app.kapso.ai/api/v1
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /customers/{customer_id}/setup_links:
    post:
      tags:
        - Setup Links
      summary: Create setup link
      description: |
        Generate a setup link for customer WhatsApp onboarding.
        Creating a new link automatically revokes any existing active links.
        Links expire after 30 days.
      operationId: createPlatformSetupLink
      parameters:
        - name: customer_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                setup_link:
                  type: object
                  properties:
                    success_redirect_url:
                      type: string
                      format: uri
                      example: https://your-app.com/whatsapp/success
                      description: Where to redirect after successful setup
                    failure_redirect_url:
                      type: string
                      format: uri
                      example: https://your-app.com/whatsapp/failed
                      description: Where to redirect if setup fails
                    allowed_connection_types:
                      type: array
                      items:
                        type: string
                        enum:
                          - coexistence
                          - dedicated
                      example:
                        - coexistence
                        - dedicated
                      description: >
                        Connection types to show:

                        - coexistence: Keep using WhatsApp Business app (5
                        msg/sec)

                        - dedicated: API-only access (up to 1000 msg/sec)
                    provision_phone_number:
                      type: boolean
                      example: true
                      description: Whether to provision a new phone number for the customer
                    phone_number_area_code:
                      type: string
                      example: '415'
                      description: >-
                        Area code for provisioned phone number (if
                        provision_phone_number is true)
                    phone_number_country_isos:
                      type: array
                      items:
                        type: string
                      example:
                        - US
                      description: >-
                        Array of supported ISO country codes for phone number
                        provisioning. Defaults to ["US"] if not specified. Empty
                        array means no restriction. Non-US countries require
                        custom Twilio credentials.
                    theme_config:
                      type: object
                      description: Customize setup page colors (all colors in hex format)
                      properties:
                        primary_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#3b82f6'
                          description: Primary buttons and accents
                        primary_foreground_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#ffffff'
                          description: Text on primary buttons
                        background_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#ffffff'
                          description: Page background
                        text_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#0f172a'
                          description: Main text
                        muted_text_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#64748b'
                          description: Secondary text
                        card_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#f8fafc'
                          description: Card backgrounds
                        muted_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#f1f5f9'
                          description: Muted backgrounds
                        border_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#e2e8f0'
                          description: Borders
                        secondary_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#f1f5f9'
                          description: Secondary buttons
                        secondary_foreground_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#0f172a'
                          description: Text on secondary buttons
                        destructive_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#ef4444'
                          description: Error states
                        destructive_foreground_color:
                          type: string
                          pattern: ^#[0-9A-Fa-f]{6}$
                          example: '#fef2f2'
                          description: Text on error backgrounds
            examples:
              minimal:
                summary: Minimal setup
                value: {}
              with_redirects:
                summary: With redirect URLs
                value:
                  setup_link:
                    success_redirect_url: https://your-app.com/whatsapp/success
                    failure_redirect_url: https://your-app.com/whatsapp/failed
              coexistence_only:
                summary: Coexistence only
                value:
                  setup_link:
                    allowed_connection_types:
                      - coexistence
              fully_customized:
                summary: Fully customized
                value:
                  setup_link:
                    success_redirect_url: https://your-app.com/whatsapp/success
                    failure_redirect_url: https://your-app.com/whatsapp/failed
                    allowed_connection_types:
                      - dedicated
                    theme_config:
                      primary_color: '#3b82f6'
                      background_color: '#ffffff'
                      text_color: '#0f172a'
              with_phone_provisioning:
                summary: With phone number provisioning
                value:
                  setup_link:
                    success_redirect_url: https://your-app.com/whatsapp/success
                    failure_redirect_url: https://your-app.com/whatsapp/failed
                    provision_phone_number: true
                    phone_number_area_code: '415'
                    phone_number_country_isos:
                      - US
      responses:
        '201':
          description: Setup link created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/SetupLink'
              examples:
                created:
                  summary: Setup link created
                  value:
                    data:
                      id: 7f8a9b1c-2d3e-4f5a-6b7c-8d9e0f1a2b3c
                      status: active
                      expires_at: '2024-03-15T10:00:00Z'
                      url: https://app.kapso.ai/whatsapp/setup/aBcD123xyz456def789
                      success_redirect_url: https://your-app.com/whatsapp/success
                      failure_redirect_url: https://your-app.com/whatsapp/failed
                      allowed_connection_types:
                        - coexistence
                        - dedicated
                      theme_config: {}
                      created_at: '2024-02-15T10:00:00Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SetupLink:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 7f8a9b1c-2d3e-4f5a-6b7c-8d9e0f1a2b3c
        status:
          type: string
          enum:
            - active
            - used
            - expired
            - revoked
          example: active
        expires_at:
          type: string
          format: date-time
          description: Link expires after 30 days
        url:
          type: string
          format: uri
          example: https://app.kapso.ai/whatsapp/setup/aBcD123...
          description: Setup URL for your customer
        success_redirect_url:
          type: string
          format: uri
          example: https://your-app.com/whatsapp/success
          nullable: true
        failure_redirect_url:
          type: string
          format: uri
          example: https://your-app.com/whatsapp/failed
          nullable: true
        allowed_connection_types:
          type: array
          items:
            type: string
            enum:
              - coexistence
              - dedicated
          example:
            - coexistence
            - dedicated
          description: Connection types shown to customer. Single option auto-selects.
          default:
            - coexistence
            - dedicated
        provision_phone_number:
          type: boolean
          example: false
          description: Whether to provision a new phone number for the customer
        phone_number_area_code:
          type: string
          example: '415'
          nullable: true
          description: >-
            Area code for provisioned phone number (if provision_phone_number is
            true)
        phone_number_country_isos:
          type: array
          items:
            type: string
          example:
            - US
          description: >-
            Array of supported ISO country codes for phone number provisioning.
            Defaults to ["US"] if not specified. Non-US countries require custom
            Twilio credentials.
        provisioned_phone_number:
          type: object
          nullable: true
          description: Details of the provisioned phone number (if applicable)
          properties:
            id:
              type: string
              format: uuid
            phone_number:
              type: string
              example: '+14155551234'
            area_code:
              type: string
              example: '415'
            status:
              type: string
              enum:
                - active
                - released
        theme_config:
          type: object
          description: Customize the setup page appearance
          properties:
            primary_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#3b82f6'
              description: Primary buttons and accents
            primary_foreground_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#ffffff'
              description: Text on primary buttons
            background_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#ffffff'
              description: Page background
            text_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#0f172a'
              description: Main text
            muted_text_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#64748b'
              description: Secondary text
            card_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#f8fafc'
              description: Card backgrounds
            muted_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#f1f5f9'
              description: Muted backgrounds
            border_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#e2e8f0'
              description: Borders
            secondary_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#f1f5f9'
              description: Secondary buttons
            secondary_foreground_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#0f172a'
              description: Text on secondary buttons
            destructive_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#ef4444'
              description: Error states
            destructive_foreground_color:
              type: string
              pattern: ^#[0-9A-Fa-f]{6}$
              example: '#fef2f2'
              description: Text on error backgrounds
          nullable: true
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          example: Resource not found
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your project API key

````