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

# Create Subscription

> Create a subscription for a connected account.



## OpenAPI

````yaml post /stripe/connect/accounts/{accountId}/subscriptions
openapi: 3.0.1
info:
  title: ChatDash API Documentation
  description: API Documentation for the ChatDash Server
  version: 2.0.0
servers:
  - url: https://api.chat-dash.com/v1/public
security: []
paths:
  /stripe/connect/accounts/{accountId}/subscriptions:
    post:
      tags:
        - Stripe Connect
      summary: Create Subscription
      description: Create a subscription for a connected account.
      parameters:
        - name: Authorization
          in: header
          required: true
          description: >-
            All requests to the ChatDash API must be validated with the agency
            API Key found on your agency profile
          schema:
            type: string
        - name: accountId
          in: path
          required: true
          description: The Stripe connected account ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - data
              properties:
                data:
                  type: object
                  required:
                    - clientId
                    - agentIds
                    - selectedProduct
                  properties:
                    clientId:
                      type: string
                      description: >-
                        The ID of the client (must have an admin member
                        assigned)
                      example: 64abc123def456789012345a
                    agentIds:
                      type: array
                      items:
                        type: string
                      description: Array of agent IDs to assign to this subscription
                      example:
                        - 64abc123def456789012345b
                        - 64abc123def456789012345c
                    selectedProduct:
                      type: object
                      required:
                        - productId
                        - startDate
                        - pricing
                      properties:
                        productId:
                          type: string
                          description: The Stripe product ID to subscribe to
                          example: prod_ABC123XYZ
                        startDate:
                          type: integer
                          description: >-
                            Unix timestamp (seconds) for when the subscription
                            should start
                          example: 1700000000
                        pricing:
                          type: object
                          required:
                            - pricingModel
                          description: Pricing configuration for the product
                          properties:
                            pricingModel:
                              type: string
                              enum:
                                - base
                                - usage
                              description: >-
                                The pricing model type. Required. Note:
                                'oneTime' products cannot be used for
                                subscriptions.
                              example: base
                            metrics:
                              type: string
                              enum:
                                - interactions
                                - minutes
                                - conversations
                                - valueBased
                              description: >-
                                The billing metric type for usage tracking.
                                Required when pricingModel is 'usage' or when
                                pricingModel is 'base' with usageLimit and
                                overage.
                              example: minutes
                            usageLimit:
                              type: number
                              nullable: true
                              description: >-
                                Usage limit for base pricing model. When
                                provided with pricingModel 'base', overage and
                                metrics are required.
                              example: 1000
                            overage:
                              type: number
                              nullable: true
                              description: >-
                                Overage price per unit after usage limit is
                                reached. Required when usageLimit is provided.
                              example: 0.05
                        customAnalysisConfig:
                          type: object
                          description: Required when pricing.metrics is 'valueBased'
                          properties:
                            field:
                              type: string
                              description: The field to analyze for value-based billing
                              example: sentiment
                            targetValue:
                              type: string
                              description: The target value to match
                              example: positive
                    couponId:
                      type: string
                      description: Optional coupon ID to apply to the subscription
                      example: SUMMER20
                    taxSettings:
                      type: object
                      description: Optional tax collection settings
                      properties:
                        enabled:
                          type: boolean
                          description: Whether to enable automatic tax collection
                          example: true
                        country:
                          type: string
                          description: >-
                            Two-letter ISO country code. Required when enabled
                            is true
                          example: US
                        postalCode:
                          type: string
                          description: >-
                            Optional postal code for more accurate tax
                            calculation
                          example: '94102'
            example:
              data:
                clientId: 64abc123def456789012345a
                agentIds:
                  - 64abc123def456789012345b
                selectedProduct:
                  productId: prod_ABC123XYZ
                  startDate: 1700000000
                  pricing:
                    metrics: minutes
                couponId: ''
                taxSettings:
                  enabled: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The subscription schedule ID
                    example: sub_sched_1ABC123DEF456GHI
                  type:
                    type: string
                    example: schedule
                  status:
                    type: string
                    example: not_started
                  customer:
                    type: object
                    properties:
                      id:
                        type: string
                        example: cus_ABC123XYZ
                      email:
                        type: string
                        example: customer@example.com
                  current_period_start:
                    type: integer
                    nullable: true
                    example: 1700000000
                  current_period_end:
                    type: integer
                    nullable: true
                    example: 1702600000
                  startDate:
                    type: integer
                    nullable: true
                    example: 1700000000
                  created:
                    type: integer
                    example: 1700000000
                  collection_method:
                    type: string
                    example: charge_automatically
                  cancel_at_period_end:
                    type: boolean
                    example: false
                  canceled_at:
                    type: integer
                    nullable: true
                    example: null
                  product:
                    type: object
                    properties:
                      id:
                        type: string
                        example: prod_ABC123XYZ
                      name:
                        type: string
                        example: Pro Plan
                  automatic_tax:
                    type: boolean
                    example: false
                  coupon:
                    type: string
                    example: ''
                  priceIds:
                    type: array
                    items:
                      type: string
                    example:
                      - price_ABC123
                      - price_DEF456
                  agents:
                    type: string
                    example: Agent 1
                  cancelAtPeriodEndDisplay:
                    type: string
                    nullable: true
                    example: null
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: An unexpected error occurred

````