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

# Agent Subscribe

> Assign an agent as the default for this number. Drops any subscribed webhook.

Sets the number's default routing to `agent` and assigns the chosen agent
as the active bot. Any webhook subscribed to the number is dropped — call
[`POST /phone-numbers/{number}/subscribe/`](/api-reference/phone-numbers/subscribe)
to route to a webhook instead.

When `applyToExisting` is `true`, the new agent is written onto every
existing conversation on this number and the in-flight session is cleared
so the new agent picks up from scratch. Phone-number routing changes do
**not** dispatch `subscription.activated` / `subscription.revoked` webhook
events.

The agent must already be owned by or shared with the requesting user.

Sandbox numbers scope the change to the requesting user's own conversation:
their `activeAgent` is set to the chosen agent and their conversation
routing is forced to `agent` so the agent flow runs for them. Other users
on the shared sandbox are unaffected.


## OpenAPI

````yaml api-reference/openapi.json POST /api/v1/phone-numbers/{number}/connect-agent/
openapi: 3.0.3
info:
  title: Wassist API
  version: 1.0.0
  description: API for building WhatsApp AI agents
servers:
  - url: https://alpha-plagiocephalic-darrell.ngrok-free.dev
    description: Development
security: []
tags:
  - name: Agents
    description: Create and manage AI agents
  - name: Conversations
    description: Chat conversations and messages
  - name: WhatsApp
    description: WhatsApp Business account management
  - name: Contacts
    description: Contact management
  - name: Integrations
    description: Third-party integrations
paths:
  /api/v1/phone-numbers/{number}/connect-agent/:
    post:
      tags:
        - api
      description: Connect an agent as the default for this number.
      operationId: api_v1_phone_numbers_connect_agent_create
      parameters:
        - in: path
          name: number
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PhoneNumber'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneNumber'
          description: ''
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PhoneNumber:
      type: object
      description: Serializer for WhatsappNumber model.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        number:
          type: string
          maxLength: 15
        whatsappPhoneNumberId:
          type: string
        whatsappBusinessAccount:
          type: string
          readOnly: true
        activeAgent:
          type: string
          readOnly: true
        defaultRouting:
          type: string
          readOnly: true
        defaultWebhook:
          type: string
          readOnly: true
        isSandbox:
          type: boolean
          readOnly: true
      required:
        - activeAgent
        - defaultRouting
        - defaultWebhook
        - id
        - isSandbox
        - number
        - whatsappBusinessAccount
        - whatsappPhoneNumberId
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key authentication. Pass your API key in the X-API-Key header.

````