openapi: 3.0.3
info:
  title: 'WaSaaS API'
  description: 'REST API for WaSaaS -- self-hosted WhatsApp messaging platform. All endpoints require an Authorization: Bearer <key> header unless marked as public.'
  version: 1.0.0
servers:
  -
    url: 'https://wp.hypweb.in'
tags:
  -
    name: Auth
    description: ''
  -
    name: Devices
    description: ''
  -
    name: Templates
    description: ''
  -
    name: Contacts
    description: ''
  -
    name: Groups
    description: ''
  -
    name: Messages
    description: ''
  -
    name: Campaigns
    description: ''
  -
    name: 'Scheduled Messages'
    description: ''
  -
    name: 'Chatbot Rules'
    description: ''
  -
    name: Flows
    description: ''
  -
    name: Blacklist
    description: ''
  -
    name: 'Inbound Events'
    description: ''
  -
    name: Support
    description: ''
  -
    name: Billing
    description: ''
  -
    name: Endpoints
    description: ''
components:
  securitySchemes:
    default:
      type: http
      scheme: bearer
      description: 'Generate your API key from the portal under **Account -> API Key**.'
security:
  -
    default: []
paths:
  /api/auth/register:
    post:
      summary: 'Register a new customer account.'
      operationId: registerANewCustomerAccount
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Registration successful.'
                  api_key: wac_live_...
                  user:
                    id: 1
                    name: Vinayak
                    email: v@example.com
                    api_key_prefix: wac_
                properties:
                  message:
                    type: string
                    example: 'Registration successful.'
                  api_key:
                    type: string
                    example: wac_live_...
                  user:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      name:
                        type: string
                        example: Vinayak
                      email:
                        type: string
                        example: v@example.com
                      api_key_prefix:
                        type: string
                        example: wac_
        422:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'The email has already been taken.'
                  errors:
                    email:
                      - 'The email has already been taken.'
                properties:
                  message:
                    type: string
                    example: 'The email has already been taken.'
                  errors:
                    type: object
                    properties:
                      email:
                        type: array
                        example:
                          - 'The email has already been taken.'
                        items:
                          type: string
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 'Must not be greater than 255 characters.'
                  example: b
                email:
                  type: string
                  description: 'Must be a valid email address.'
                  example: zbailey@example.net
                password:
                  type: string
                  description: 'Must be at least 8 characters.'
                  example: '-0pBNvYgxw'
              required:
                - name
                - email
                - password
  /api/auth/login:
    post:
      summary: 'Log in and receive an API key.'
      operationId: logInAndReceiveAnAPIKey
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Login successful.'
                  api_key_prefix: wac_
                  user:
                    id: 1
                    name: Vinayak
                    email: v@example.com
                properties:
                  message:
                    type: string
                    example: 'Login successful.'
                  api_key_prefix:
                    type: string
                    example: wac_
                  user:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      name:
                        type: string
                        example: Vinayak
                      email:
                        type: string
                        example: v@example.com
        401:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Invalid credentials.'
                properties:
                  error:
                    type: string
                    example: 'Invalid credentials.'
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: 'Must be a valid email address.'
                  example: gbailey@example.net
                password:
                  type: string
                  description: ''
                  example: '|]|{+-'
              required:
                - email
                - password
  /api/auth/regenerate-key:
    post:
      summary: 'Regenerate your API key. The old key is immediately invalidated.'
      operationId: regenerateYourAPIKeyTheOldKeyIsImmediatelyInvalidated
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'API key regenerated.'
                  api_key: wac_live_newkey...
                properties:
                  message:
                    type: string
                    example: 'API key regenerated.'
                  api_key:
                    type: string
                    example: wac_live_newkey...
      tags:
        - Auth
  /api/auth/me:
    get:
      summary: "Get the authenticated user's profile and plan."
      operationId: getTheAuthenticatedUsersProfileAndPlan
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: Vinayak
                  email: v@example.com
                  plan:
                    id: 2
                    name: Pro
                    max_devices: 10
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: Vinayak
                  email:
                    type: string
                    example: v@example.com
                  plan:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 2
                      name:
                        type: string
                        example: Pro
                      max_devices:
                        type: integer
                        example: 10
      tags:
        - Auth
  /api/devices:
    get:
      summary: 'List all devices.'
      operationId: listAllDevices
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      example: 1
                    label:
                      type: string
                      example: 'My Number'
                    phone_number:
                      type: string
                      example: '919876543210'
                    is_connected:
                      type: boolean
                      example: true
                    driver:
                      type: string
                      example: baileys
                example:
                  -
                    id: 1
                    label: 'My Number'
                    phone_number: '919876543210'
                    is_connected: true
                    driver: baileys
      tags:
        - Devices
    post:
      summary: 'Create a new device.'
      operationId: createANewDevice
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  label: 'My Number'
                  session_ref: dev_abc123
                  is_connected: false
                properties:
                  id:
                    type: integer
                    example: 1
                  label:
                    type: string
                    example: 'My Number'
                  session_ref:
                    type: string
                    example: dev_abc123
                  is_connected:
                    type: boolean
                    example: false
        403:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Device limit reached for your plan.'
                properties:
                  error:
                    type: string
                    example: 'Device limit reached for your plan.'
      tags:
        - Devices
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                label:
                  type: string
                  description: 'Must not be greater than 100 characters.'
                  example: b
                webhook_url:
                  type: string
                  description: 'Must be a valid URL. Must not be greater than 500 characters.'
                  example: 'http://bailey.com/'
                  nullable: true
              required:
                - label
  '/api/devices/{id}':
    delete:
      summary: 'Delete a device. Disconnects the WhatsApp session.'
      operationId: deleteADeviceDisconnectsTheWhatsAppSession
      description: ''
      parameters: []
      responses:
        204:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example: {  }
                properties: {  }
      tags:
        - Devices
    get:
      summary: ''
      operationId: getApiDevicesId
      description: ''
      parameters: []
      responses:
        401:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Invalid API key.'
                properties:
                  error:
                    type: string
                    example: 'Invalid API key.'
      tags:
        - Endpoints
    put:
      summary: ''
      operationId: putApiDevicesId
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                label:
                  type: string
                  description: 'Must not be greater than 100 characters.'
                  example: b
                webhook_url:
                  type: string
                  description: 'Must be a valid URL. Must not be greater than 500 characters.'
                  example: 'http://bailey.com/'
                  nullable: true
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the device.'
        example: 100
        required: true
        schema:
          type: integer
  '/api/devices/{device_id}/qr':
    get:
      summary: 'Get a QR code to link a WhatsApp number.'
      operationId: getAQRCodeToLinkAWhatsAppNumber
      description: "Scan the returned QR with WhatsApp on your phone under Linked Devices.\nPoll every 3 seconds until status changes to connected."
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  qr: 'data:image/png;base64,...'
                properties:
                  qr:
                    type: string
                    example: 'data:image/png;base64,...'
        202:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'QR not ready. Retry in 3 seconds.'
                properties:
                  message:
                    type: string
                    example: 'QR not ready. Retry in 3 seconds.'
      tags:
        - Devices
    parameters:
      -
        in: path
        name: device_id
        description: 'The ID of the device.'
        example: 100
        required: true
        schema:
          type: integer
  '/api/devices/{device_id}/status':
    get:
      summary: "Check a device's connection status."
      operationId: checkADevicesConnectionStatus
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: CONNECTED
                  connected: true
                properties:
                  status:
                    type: string
                    example: CONNECTED
                  connected:
                    type: boolean
                    example: true
      tags:
        - Devices
    parameters:
      -
        in: path
        name: device_id
        description: 'The ID of the device.'
        example: 100
        required: true
        schema:
          type: integer
  '/api/devices/{device_id}/reconnect':
    post:
      summary: 'Trigger a reconnection attempt for a disconnected device.'
      operationId: triggerAReconnectionAttemptForADisconnectedDevice
      description: ''
      parameters: []
      responses:
        202:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Reconnect initiated. Retry QR in 3 seconds.'
                properties:
                  message:
                    type: string
                    example: 'Reconnect initiated. Retry QR in 3 seconds.'
      tags:
        - Devices
    parameters:
      -
        in: path
        name: device_id
        description: 'The ID of the device.'
        example: 100
        required: true
        schema:
          type: integer
  /api/templates:
    get:
      summary: 'List message templates.'
      operationId: listMessageTemplates
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      example: 1
                    name:
                      type: string
                      example: Welcome
                    message_type:
                      type: string
                      example: text
                    is_active:
                      type: boolean
                      example: true
                example:
                  -
                    id: 1
                    name: Welcome
                    message_type: text
                    is_active: true
      tags:
        - Templates
    post:
      summary: 'Create a message template.'
      operationId: createAMessageTemplate
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: Welcome
                  message_type: text
                  is_active: true
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: Welcome
                  message_type:
                    type: string
                    example: text
                  is_active:
                    type: boolean
                    example: true
      tags:
        - Templates
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: ''
                  example: Welcome
                message_type:
                  type: string
                  description: 'One of: text, media, location, contact.'
                  example: text
                body:
                  type: object
                  description: 'Message payload.'
                  example:
                    text: 'Hello {{name}}!'
                  properties: {  }
                is_active:
                  type: boolean
                  description: ''
                  example: true
              required:
                - name
                - message_type
                - body
  '/api/templates/{id}':
    get:
      summary: 'Get a single template.'
      operationId: getASingleTemplate
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: Welcome
                  message_type: text
                  body:
                    text: Hello!
                  is_active: true
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: Welcome
                  message_type:
                    type: string
                    example: text
                  body:
                    type: object
                    properties:
                      text:
                        type: string
                        example: Hello!
                  is_active:
                    type: boolean
                    example: true
      tags:
        - Templates
    put:
      summary: 'Update a template.'
      operationId: updateATemplate
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: 'Updated Name'
                  message_type: text
                  is_active: true
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: 'Updated Name'
                  message_type:
                    type: string
                    example: text
                  is_active:
                    type: boolean
                    example: true
      tags:
        - Templates
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 'Must not be greater than 150 characters.'
                  example: b
                message_type:
                  type: string
                  description: ''
                  example: media
                  enum:
                    - text
                    - media
                    - location
                    - contact
                body:
                  type: object
                  description: ''
                  example: null
                  properties: {  }
                is_active:
                  type: boolean
                  description: ''
                  example: false
    delete:
      summary: 'Delete a template.'
      operationId: deleteATemplate
      description: ''
      parameters: []
      responses:
        204:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example: {  }
                properties: {  }
      tags:
        - Templates
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the template.'
        example: 48
        required: true
        schema:
          type: integer
  /api/contacts:
    get:
      summary: 'List contacts.'
      operationId: listContacts
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      name: Vinayak
                      phone: '919876543210'
                      email: v@example.com
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        name: Vinayak
                        phone: '919876543210'
                        email: v@example.com
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        name:
                          type: string
                          example: Vinayak
                        phone:
                          type: string
                          example: '919876543210'
                        email:
                          type: string
                          example: v@example.com
      tags:
        - Contacts
    post:
      summary: 'Create a contact.'
      operationId: createAContact
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  phone: '919876543210'
                  name: Vinayak
                properties:
                  id:
                    type: integer
                    example: 1
                  phone:
                    type: string
                    example: '919876543210'
                  name:
                    type: string
                    example: Vinayak
        403:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Contact limit reached for your plan.'
                properties:
                  error:
                    type: string
                    example: 'Contact limit reached for your plan.'
      tags:
        - Contacts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: optional
                  example: Vinayak
                  nullable: true
                phone:
                  type: string
                  description: ''
                  example: '919876543210'
                email:
                  type: string
                  description: optional
                  example: v@example.com
                  nullable: true
                company:
                  type: string
                  description: 'Must not be greater than 150 characters.'
                  example: v
                  nullable: true
                meta:
                  type: object
                  description: ''
                  example: null
                  properties: {  }
                  nullable: true
              required:
                - phone
  '/api/contacts/{id}':
    get:
      summary: 'Get a single contact.'
      operationId: getASingleContact
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  phone: '919876543210'
                  name: Vinayak
                  email: v@example.com
                properties:
                  id:
                    type: integer
                    example: 1
                  phone:
                    type: string
                    example: '919876543210'
                  name:
                    type: string
                    example: Vinayak
                  email:
                    type: string
                    example: v@example.com
      tags:
        - Contacts
    put:
      summary: 'Update a contact.'
      operationId: updateAContact
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  phone: '919876543210'
                  name: 'Updated Name'
                properties:
                  id:
                    type: integer
                    example: 1
                  phone:
                    type: string
                    example: '919876543210'
                  name:
                    type: string
                    example: 'Updated Name'
      tags:
        - Contacts
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 'Must not be greater than 150 characters.'
                  example: b
                  nullable: true
                phone:
                  type: string
                  description: 'Must not be greater than 30 characters.'
                  example: 'n'
                email:
                  type: string
                  description: 'Must be a valid email address. Must not be greater than 150 characters.'
                  example: ashly64@example.com
                  nullable: true
                company:
                  type: string
                  description: 'Must not be greater than 150 characters.'
                  example: v
                  nullable: true
                meta:
                  type: object
                  description: ''
                  example: null
                  properties: {  }
                  nullable: true
    delete:
      summary: 'Delete a contact.'
      operationId: deleteAContact
      description: ''
      parameters: []
      responses:
        204:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example: {  }
                properties: {  }
      tags:
        - Contacts
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the contact.'
        example: 14
        required: true
        schema:
          type: integer
  /api/contacts/import:
    post:
      summary: 'Bulk import contacts from a JSON array.'
      operationId: bulkImportContactsFromAJSONArray
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Import complete. Created: 47, Skipped (duplicate): 3.'
                  created: 47
                  skipped: 3
                properties:
                  message:
                    type: string
                    example: 'Import complete. Created: 47, Skipped (duplicate): 3.'
                  created:
                    type: integer
                    example: 47
                  skipped:
                    type: integer
                    example: 3
        403:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Contact limit reached for your plan.'
                properties:
                  error:
                    type: string
                    example: 'Contact limit reached for your plan.'
      tags:
        - Contacts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                contacts:
                  type: array
                  description: 'Array of contact objects.'
                  example:
                    - []
                  items:
                    type: object
                    properties:
                      phone:
                        type: string
                        description: ''
                        example: '919876543210'
                      name:
                        type: string
                        description: optional
                        example: Vinayak
                        nullable: true
                      email:
                        type: string
                        description: 'Must be a valid email address. Must not be greater than 150 characters.'
                        example: ashly64@example.com
                        nullable: true
                    required:
                      - phone
              required:
                - contacts
  /api/groups:
    get:
      summary: 'List contact groups.'
      operationId: listContactGroups
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      example: 1
                    name:
                      type: string
                      example: 'VIP Customers'
                    contacts_count:
                      type: integer
                      example: 120
                example:
                  -
                    id: 1
                    name: 'VIP Customers'
                    contacts_count: 120
      tags:
        - Groups
    post:
      summary: 'Create a contact group.'
      operationId: createAContactGroup
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: 'VIP Customers'
                  contacts_count: 0
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: 'VIP Customers'
                  contacts_count:
                    type: integer
                    example: 0
      tags:
        - Groups
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: ''
                  example: 'VIP Customers'
              required:
                - name
  '/api/groups/{id}':
    get:
      summary: 'Get a group with its contacts.'
      operationId: getAGroupWithItsContacts
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: 'VIP Customers'
                  contacts:
                    -
                      id: 1
                      phone: '919876543210'
                      name: Vinayak
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: 'VIP Customers'
                  contacts:
                    type: array
                    example:
                      -
                        id: 1
                        phone: '919876543210'
                        name: Vinayak
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        phone:
                          type: string
                          example: '919876543210'
                        name:
                          type: string
                          example: Vinayak
      tags:
        - Groups
    put:
      summary: 'Update a group name.'
      operationId: updateAGroupName
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: 'Premium Members'
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: 'Premium Members'
      tags:
        - Groups
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: ''
                  example: 'Premium Members'
              required:
                - name
    delete:
      summary: 'Delete a group.'
      operationId: deleteAGroup
      description: ''
      parameters: []
      responses:
        204:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example: {  }
                properties: {  }
      tags:
        - Groups
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the group.'
        example: 16
        required: true
        schema:
          type: integer
  '/api/groups/{group_id}/contacts':
    post:
      summary: 'Add contacts to a group.'
      operationId: addContactsToAGroup
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Contacts added.'
                  count: 3
                properties:
                  message:
                    type: string
                    example: 'Contacts added.'
                  count:
                    type: integer
                    example: 3
      tags:
        - Groups
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                contact_ids:
                  type: array
                  description: 'Array of contact IDs to add.'
                  example:
                    - 1
                    - 2
                    - 3
                  items:
                    type: integer
              required:
                - contact_ids
    parameters:
      -
        in: path
        name: group_id
        description: 'The ID of the group.'
        example: 16
        required: true
        schema:
          type: integer
  '/api/groups/{group_id}/contacts/{contact_id}':
    delete:
      summary: 'Remove a contact from a group.'
      operationId: removeAContactFromAGroup
      description: ''
      parameters: []
      responses:
        204:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example: {  }
                properties: {  }
      tags:
        - Groups
    parameters:
      -
        in: path
        name: group_id
        description: 'The ID of the group.'
        example: 16
        required: true
        schema:
          type: integer
      -
        in: path
        name: contact_id
        description: 'The ID of the contact.'
        example: 14
        required: true
        schema:
          type: integer
  /api/messages/send:
    post:
      summary: 'Send a single WhatsApp message immediately.'
      operationId: sendASingleWhatsAppMessageImmediately
      description: "Supports text, media, location, contact card, button, and menu types.\nThe device must be connected."
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                  message_log_id: 42
                properties:
                  success:
                    type: boolean
                    example: true
                  message_log_id:
                    type: integer
                    example: 42
        403:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Daily message limit reached for your plan.'
                properties:
                  error:
                    type: string
                    example: 'Daily message limit reached for your plan.'
        422:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Device is not connected.'
                properties:
                  error:
                    type: string
                    example: 'Device is not connected.'
      tags:
        - Messages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: integer
                  description: ''
                  example: 16
                template_id:
                  type: integer
                  description: ''
                  example: 16
                phone:
                  type: string
                  description: 'Must not be greater than 30 characters.'
                  example: 'n'
                variables:
                  type: object
                  description: ''
                  example: null
                  properties: {  }
                  nullable: true
              required:
                - device_id
                - template_id
                - phone
  /api/messages:
    get:
      summary: 'List outbound and inbound message logs.'
      operationId: listOutboundAndInboundMessageLogs
      description: ''
      parameters:
        -
          in: query
          name: direction
          description: 'Filter by direction: outbound or inbound.'
          example: outbound
          required: false
          schema:
            type: string
            description: 'Filter by direction: outbound or inbound.'
            example: outbound
        -
          in: query
          name: status
          description: 'Filter by status: sent, failed, received.'
          example: sent
          required: false
          schema:
            type: string
            description: 'Filter by status: sent, failed, received.'
            example: sent
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      phone_number: '919876543210'
                      message_type: text
                      status: sent
                      sent_at: '2026-06-30T10:00:00Z'
                  total: 42
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        phone_number: '919876543210'
                        message_type: text
                        status: sent
                        sent_at: '2026-06-30T10:00:00Z'
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        phone_number:
                          type: string
                          example: '919876543210'
                        message_type:
                          type: string
                          example: text
                        status:
                          type: string
                          example: sent
                        sent_at:
                          type: string
                          example: '2026-06-30T10:00:00Z'
                  total:
                    type: integer
                    example: 42
      tags:
        - Messages
  /api/campaigns:
    get:
      summary: 'List campaigns.'
      operationId: listCampaigns
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      title: 'June Blast'
                      status: completed
                      total_count: 500
                      sent_count: 498
                      failed_count: 2
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        title: 'June Blast'
                        status: completed
                        total_count: 500
                        sent_count: 498
                        failed_count: 2
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        title:
                          type: string
                          example: 'June Blast'
                        status:
                          type: string
                          example: completed
                        total_count:
                          type: integer
                          example: 500
                        sent_count:
                          type: integer
                          example: 498
                        failed_count:
                          type: integer
                          example: 2
      tags:
        - Campaigns
    post:
      summary: 'Create a campaign.'
      operationId: createACampaign
      description: 'Provide either `group_id` or a `phones` array (or both).'
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  title: 'June Blast'
                  status: draft
                  total_count: 500
                properties:
                  id:
                    type: integer
                    example: 1
                  title:
                    type: string
                    example: 'June Blast'
                  status:
                    type: string
                    example: draft
                  total_count:
                    type: integer
                    example: 500
        403:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Campaign limit reached for your plan.'
                properties:
                  error:
                    type: string
                    example: 'Campaign limit reached for your plan.'
      tags:
        - Campaigns
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  description: 'Campaign name.'
                  example: 'June Blast'
                device_id:
                  type: integer
                  description: 'Connected device ID.'
                  example: 1
                template_id:
                  type: integer
                  description: 'Template ID.'
                  example: 3
                delay_seconds:
                  type: integer
                  description: 'Seconds between sends. Default: 5.'
                  example: 10
                scheduled_at:
                  type: string
                  description: 'ISO 8601 datetime to start.'
                  example: '2026-07-01T09:00:00Z'
                  nullable: true
                group_id:
                  type: integer
                  description: 'optional Contact group ID.'
                  example: 2
                  nullable: true
                phones:
                  type: array
                  description: 'optional Array of phone numbers.'
                  example:
                    - '919876543210'
                  items:
                    type: string
              required:
                - title
                - device_id
                - template_id
  '/api/campaigns/{id}':
    get:
      summary: 'Get a campaign with its template, device, and recipient summary.'
      operationId: getACampaignWithItsTemplateDeviceAndRecipientSummary
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  title: 'June Blast'
                  status: completed
                  sent_count: 498
                  failed_count: 2
                  template:
                    name: Welcome
                  device:
                    label: 'My Number'
                properties:
                  id:
                    type: integer
                    example: 1
                  title:
                    type: string
                    example: 'June Blast'
                  status:
                    type: string
                    example: completed
                  sent_count:
                    type: integer
                    example: 498
                  failed_count:
                    type: integer
                    example: 2
                  template:
                    type: object
                    properties:
                      name:
                        type: string
                        example: Welcome
                  device:
                    type: object
                    properties:
                      label:
                        type: string
                        example: 'My Number'
      tags:
        - Campaigns
    put:
      summary: ''
      operationId: putApiCampaignsId
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  description: 'Must not be greater than 200 characters.'
                  example: b
                delay_seconds:
                  type: integer
                  description: 'Must be at least 0. Must not be greater than 60.'
                  example: 22
                scheduled_at:
                  type: string
                  description: 'Must be a valid date. Must be a date after <code>now</code>.'
                  example: '2052-07-23'
                  nullable: true
    delete:
      summary: ''
      operationId: deleteApiCampaignsId
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the campaign.'
        example: 29
        required: true
        schema:
          type: integer
  '/api/campaigns/{campaign_id}/launch':
    post:
      summary: 'Launch a draft campaign. Transitions status from draft to queued.'
      operationId: launchADraftCampaignTransitionsStatusFromDraftToQueued
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Campaign queued.'
                  campaign:
                    status: queued
                properties:
                  message:
                    type: string
                    example: 'Campaign queued.'
                  campaign:
                    type: object
                    properties:
                      status:
                        type: string
                        example: queued
        422:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: "Cannot launch a campaign with status 'completed'."
                properties:
                  error:
                    type: string
                    example: "Cannot launch a campaign with status 'completed'."
      tags:
        - Campaigns
    parameters:
      -
        in: path
        name: campaign_id
        description: 'The ID of the campaign.'
        example: 29
        required: true
        schema:
          type: integer
  '/api/campaigns/{campaign_id}/cancel':
    post:
      summary: 'Cancel a draft or queued campaign.'
      operationId: cancelADraftOrQueuedCampaign
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  status: cancelled
                properties:
                  id:
                    type: integer
                    example: 1
                  status:
                    type: string
                    example: cancelled
        422:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: "Cannot cancel a campaign with status 'completed'."
                properties:
                  error:
                    type: string
                    example: "Cannot cancel a campaign with status 'completed'."
      tags:
        - Campaigns
    parameters:
      -
        in: path
        name: campaign_id
        description: 'The ID of the campaign.'
        example: 29
        required: true
        schema:
          type: integer
  '/api/campaigns/{campaign_id}/recipients':
    get:
      summary: 'List recipients for a campaign with their delivery status.'
      operationId: listRecipientsForACampaignWithTheirDeliveryStatus
      description: ''
      parameters:
        -
          in: query
          name: status
          description: 'Filter by status: pending, sent, failed.'
          example: failed
          required: false
          schema:
            type: string
            description: 'Filter by status: pending, sent, failed.'
            example: failed
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      phone: '919876543210'
                      status: sent
                      sent_at: '2026-06-30T10:00:00Z'
                properties:
                  data:
                    type: array
                    example:
                      -
                        phone: '919876543210'
                        status: sent
                        sent_at: '2026-06-30T10:00:00Z'
                    items:
                      type: object
                      properties:
                        phone:
                          type: string
                          example: '919876543210'
                        status:
                          type: string
                          example: sent
                        sent_at:
                          type: string
                          example: '2026-06-30T10:00:00Z'
      tags:
        - Campaigns
    parameters:
      -
        in: path
        name: campaign_id
        description: 'The ID of the campaign.'
        example: 29
        required: true
        schema:
          type: integer
  /api/scheduled-messages:
    get:
      summary: 'List scheduled messages.'
      operationId: listScheduledMessages
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      phone: '919876543210'
                      message_type: text
                      status: pending
                      scheduled_for: '2026-07-01T09:00:00Z'
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        phone: '919876543210'
                        message_type: text
                        status: pending
                        scheduled_for: '2026-07-01T09:00:00Z'
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        phone:
                          type: string
                          example: '919876543210'
                        message_type:
                          type: string
                          example: text
                        status:
                          type: string
                          example: pending
                        scheduled_for:
                          type: string
                          example: '2026-07-01T09:00:00Z'
      tags:
        - 'Scheduled Messages'
    post:
      summary: 'Schedule a single message for future delivery.'
      operationId: scheduleASingleMessageForFutureDelivery
      description: 'Provide either `template_id` or `message_type` + `payload` for an inline message.'
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  status: pending
                  scheduled_for: '2026-07-01T09:00:00Z'
                properties:
                  id:
                    type: integer
                    example: 1
                  status:
                    type: string
                    example: pending
                  scheduled_for:
                    type: string
                    example: '2026-07-01T09:00:00Z'
      tags:
        - 'Scheduled Messages'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: integer
                  description: ''
                  example: 1
                phone:
                  type: string
                  description: 'E.164 without +.'
                  example: '919876543210'
                template_id:
                  type: integer
                  description: 'optional Saved template ID.'
                  example: 3
                  nullable: true
                message_type:
                  type: string
                  description: 'if no template_id.'
                  example: text
                payload:
                  type: object
                  description: 'if no template_id.'
                  example:
                    text: Hello!
                  properties: {  }
                variables:
                  type: object
                  description: 'optional Template variable values.'
                  example:
                    name: Vinayak
                  properties: {  }
                  nullable: true
                scheduled_for:
                  type: string
                  description: 'ISO 8601 datetime in the future.'
                  example: '2026-07-01T09:00:00Z'
              required:
                - device_id
                - phone
                - message_type
                - payload
                - scheduled_for
  '/api/scheduled-messages/{id}':
    delete:
      summary: 'Cancel a pending scheduled message.'
      operationId: cancelAPendingScheduledMessage
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                properties:
                  success:
                    type: boolean
                    example: true
        422:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Only pending messages can be cancelled.'
                properties:
                  error:
                    type: string
                    example: 'Only pending messages can be cancelled.'
      tags:
        - 'Scheduled Messages'
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the scheduled message.'
        example: architecto
        required: true
        schema:
          type: string
  /api/chatbot-rules:
    get:
      summary: 'List chatbot rules across all devices.'
      operationId: listChatbotRulesAcrossAllDevices
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      example: 1
                    keyword:
                      type: string
                      example: hello
                    match_type:
                      type: string
                      example: contains
                    reply_type:
                      type: string
                      example: text
                    is_active:
                      type: boolean
                      example: true
                example:
                  -
                    id: 1
                    keyword: hello
                    match_type: contains
                    reply_type: text
                    is_active: true
      tags:
        - 'Chatbot Rules'
    post:
      summary: 'Create a chatbot rule.'
      operationId: createAChatbotRule
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  keyword: hello
                  match_type: contains
                  reply_type: text
                  is_active: true
                properties:
                  id:
                    type: integer
                    example: 1
                  keyword:
                    type: string
                    example: hello
                  match_type:
                    type: string
                    example: contains
                  reply_type:
                    type: string
                    example: text
                  is_active:
                    type: boolean
                    example: true
      tags:
        - 'Chatbot Rules'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: integer
                  description: ''
                  example: 1
                keyword:
                  type: string
                  description: ''
                  example: hello
                match_type:
                  type: string
                  description: 'One of: exact, contains, starts_with.'
                  example: contains
                reply_type:
                  type: string
                  description: 'One of: text, media.'
                  example: text
                reply_body:
                  type: object
                  description: 'Reply payload matching the reply_type.'
                  example:
                    text: 'Hi there!'
                  properties: {  }
                is_active:
                  type: boolean
                  description: ''
                  example: true
              required:
                - device_id
                - keyword
                - match_type
                - reply_type
                - reply_body
  '/api/chatbot-rules/{rule_id}':
    get:
      summary: 'Get a single chatbot rule.'
      operationId: getASingleChatbotRule
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  keyword: hello
                  match_type: contains
                  reply_type: text
                  reply_body:
                    text: Hi!
                properties:
                  id:
                    type: integer
                    example: 1
                  keyword:
                    type: string
                    example: hello
                  match_type:
                    type: string
                    example: contains
                  reply_type:
                    type: string
                    example: text
                  reply_body:
                    type: object
                    properties:
                      text:
                        type: string
                        example: Hi!
      tags:
        - 'Chatbot Rules'
    put:
      summary: 'Update a chatbot rule.'
      operationId: updateAChatbotRule
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  keyword: hi
                  match_type: exact
                  reply_type: text
                  is_active: false
                properties:
                  id:
                    type: integer
                    example: 1
                  keyword:
                    type: string
                    example: hi
                  match_type:
                    type: string
                    example: exact
                  reply_type:
                    type: string
                    example: text
                  is_active:
                    type: boolean
                    example: false
      tags:
        - 'Chatbot Rules'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                keyword:
                  type: string
                  description: 'Must not be greater than 200 characters.'
                  example: b
                match_type:
                  type: string
                  description: ''
                  example: exact
                  enum:
                    - exact
                    - contains
                    - starts_with
                reply_type:
                  type: string
                  description: ''
                  example: text
                  enum:
                    - text
                    - media
                reply_body:
                  type: object
                  description: ''
                  example: null
                  properties: {  }
                is_active:
                  type: boolean
                  description: ''
                  example: false
    delete:
      summary: 'Delete a chatbot rule.'
      operationId: deleteAChatbotRule
      description: ''
      parameters: []
      responses:
        204:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example: {  }
                properties: {  }
      tags:
        - 'Chatbot Rules'
    parameters:
      -
        in: path
        name: rule_id
        description: 'The ID of the rule.'
        example: 16
        required: true
        schema:
          type: integer
  '/api/flows/{id}/logs':
    get:
      summary: 'Get execution logs for a flow.'
      operationId: getExecutionLogsForAFlow
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      contact_phone: '919876543210'
                      status: completed
                      triggered_at: '2026-06-30T10:00:00Z'
                properties:
                  data:
                    type: array
                    example:
                      -
                        contact_phone: '919876543210'
                        status: completed
                        triggered_at: '2026-06-30T10:00:00Z'
                    items:
                      type: object
                      properties:
                        contact_phone:
                          type: string
                          example: '919876543210'
                        status:
                          type: string
                          example: completed
                        triggered_at:
                          type: string
                          example: '2026-06-30T10:00:00Z'
      tags:
        - Flows
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the flow.'
        example: architecto
        required: true
        schema:
          type: string
  '/api/flows/{id}/toggle':
    post:
      summary: 'Toggle a flow active/inactive.'
      operationId: toggleAFlowActiveinactive
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  is_active: false
                properties:
                  is_active:
                    type: boolean
                    example: false
      tags:
        - Flows
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the flow.'
        example: architecto
        required: true
        schema:
          type: string
  /api/flows:
    get:
      summary: 'List automation flows.'
      operationId: listAutomationFlows
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      example: 1
                    name:
                      type: string
                      example: 'Welcome flow'
                    trigger_type:
                      type: string
                      example: keyword
                    is_active:
                      type: boolean
                      example: true
                example:
                  -
                    id: 1
                    name: 'Welcome flow'
                    trigger_type: keyword
                    is_active: true
      tags:
        - Flows
    post:
      summary: 'Create a flow.'
      operationId: createAFlow
      description: 'Nodes and edges follow the React Flow JSON schema.'
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  name: 'Welcome flow'
                  trigger_type: keyword
                  is_active: true
                properties:
                  id:
                    type: integer
                    example: 1
                  name:
                    type: string
                    example: 'Welcome flow'
                  trigger_type:
                    type: string
                    example: keyword
                  is_active:
                    type: boolean
                    example: true
      tags:
        - Flows
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: integer
                  description: ''
                  example: 1
                name:
                  type: string
                  description: ''
                  example: 'Welcome flow'
                trigger_type:
                  type: string
                  description: 'One of: any_message, keyword, button_reply.'
                  example: keyword
                trigger_config:
                  type: object
                  description: optional
                  example:
                    keyword: hello
                    match_type: contains
                  properties: {  }
                  nullable: true
                nodes:
                  type: array
                  description: 'Array of React Flow node objects.'
                  example:
                    - []
                  items:
                    type: object
                edges:
                  type: array
                  description: 'Array of React Flow edge objects.'
                  example:
                    - []
                  items:
                    type: object
              required:
                - device_id
                - name
                - trigger_type
                - nodes
                - edges
  /api/blacklist:
    get:
      summary: 'List blacklisted numbers.'
      operationId: listBlacklistedNumbers
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      phone: '919876543210'
                      reason: 'Replied STOP'
                      source: opt_out
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        phone: '919876543210'
                        reason: 'Replied STOP'
                        source: opt_out
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        phone:
                          type: string
                          example: '919876543210'
                        reason:
                          type: string
                          example: 'Replied STOP'
                        source:
                          type: string
                          example: opt_out
      tags:
        - Blacklist
    post:
      summary: 'Add a number to the blacklist.'
      operationId: addANumberToTheBlacklist
      description: 'Numbers on the blacklist are skipped in all campaign sends.'
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  phone: '919876543210'
                  source: manual
                properties:
                  id:
                    type: integer
                    example: 1
                  phone:
                    type: string
                    example: '919876543210'
                  source:
                    type: string
                    example: manual
      tags:
        - Blacklist
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                phone:
                  type: string
                  description: ''
                  example: '919876543210'
                reason:
                  type: string
                  description: optional
                  example: 'Customer requested removal'
                  nullable: true
              required:
                - phone
  '/api/blacklist/{id}':
    delete:
      summary: 'Remove a number from the blacklist.'
      operationId: removeANumberFromTheBlacklist
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                properties:
                  success:
                    type: boolean
                    example: true
      tags:
        - Blacklist
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the blacklist.'
        example: architecto
        required: true
        schema:
          type: string
  /api/inbound-events:
    get:
      summary: 'List inbound events received by your devices.'
      operationId: listInboundEventsReceivedByYourDevices
      description: ''
      parameters:
        -
          in: query
          name: device_id
          description: 'Filter by device.'
          example: 1
          required: false
          schema:
            type: integer
            description: 'Filter by device.'
            example: 1
        -
          in: query
          name: event_type
          description: 'Filter by type, e.g. message_received.'
          example: message_received
          required: false
          schema:
            type: string
            description: 'Filter by type, e.g. message_received.'
            example: message_received
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      event_type: message_received
                      from: '919876543210'
                      payload:
                        text: Hello
                      created_at: '2026-06-30T10:00:00Z'
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        event_type: message_received
                        from: '919876543210'
                        payload:
                          text: Hello
                        created_at: '2026-06-30T10:00:00Z'
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        event_type:
                          type: string
                          example: message_received
                        from:
                          type: string
                          example: '919876543210'
                        payload:
                          type: object
                          properties:
                            text:
                              type: string
                              example: Hello
                        created_at:
                          type: string
                          example: '2026-06-30T10:00:00Z'
      tags:
        - 'Inbound Events'
  /api/support/tickets:
    get:
      summary: 'List support tickets.'
      operationId: listSupportTickets
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      ticket_no: TKT-ABCD1234
                      subject: 'Need help'
                      status: open
                      priority: medium
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        ticket_no: TKT-ABCD1234
                        subject: 'Need help'
                        status: open
                        priority: medium
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        ticket_no:
                          type: string
                          example: TKT-ABCD1234
                        subject:
                          type: string
                          example: 'Need help'
                        status:
                          type: string
                          example: open
                        priority:
                          type: string
                          example: medium
      tags:
        - Support
    post:
      summary: 'Open a new support ticket.'
      operationId: openANewSupportTicket
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  ticket_no: TKT-ABCD1234
                  subject: 'Cannot connect device'
                  status: open
                properties:
                  id:
                    type: integer
                    example: 1
                  ticket_no:
                    type: string
                    example: TKT-ABCD1234
                  subject:
                    type: string
                    example: 'Cannot connect device'
                  status:
                    type: string
                    example: open
      tags:
        - Support
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  type: string
                  description: ''
                  example: 'Cannot connect device'
                priority:
                  type: string
                  description: 'optional One of: low, medium, high. Default: medium.'
                  example: high
                body:
                  type: string
                  description: 'Initial message body.'
                  example: 'My device shows disconnected.'
              required:
                - subject
                - body
  '/api/support/tickets/{id}':
    get:
      summary: 'Get a ticket with its message thread.'
      operationId: getATicketWithItsMessageThread
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  ticket_no: TKT-ABCD1234
                  subject: 'Cannot connect device'
                  messages:
                    -
                      body: 'My device shows disconnected.'
                      is_staff: false
                properties:
                  id:
                    type: integer
                    example: 1
                  ticket_no:
                    type: string
                    example: TKT-ABCD1234
                  subject:
                    type: string
                    example: 'Cannot connect device'
                  messages:
                    type: array
                    example:
                      -
                        body: 'My device shows disconnected.'
                        is_staff: false
                    items:
                      type: object
                      properties:
                        body:
                          type: string
                          example: 'My device shows disconnected.'
                        is_staff:
                          type: boolean
                          example: false
      tags:
        - Support
    put:
      summary: "Update a ticket's status."
      operationId: updateATicketsStatus
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  status: closed
                properties:
                  id:
                    type: integer
                    example: 1
                  status:
                    type: string
                    example: closed
      tags:
        - Support
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  description: 'One of: open, pending, closed.'
                  example: closed
              required:
                - status
    delete:
      summary: 'Close and delete a support ticket.'
      operationId: closeAndDeleteASupportTicket
      description: ''
      parameters: []
      responses:
        204:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example: {  }
                properties: {  }
      tags:
        - Support
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the ticket.'
        example: 16
        required: true
        schema:
          type: integer
  /api/plans:
    get:
      summary: 'List available plans.'
      operationId: listAvailablePlans
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      example: 1
                    name:
                      type: string
                      example: Starter
                    price:
                      type: string
                      example: '9.00'
                    max_devices:
                      type: integer
                      example: 3
                    max_contacts:
                      type: integer
                      example: 1000
                example:
                  -
                    id: 1
                    name: Starter
                    price: '9.00'
                    max_devices: 3
                    max_contacts: 1000
      tags:
        - Billing
  /api/billing/orders:
    post:
      summary: 'Create a billing order for a plan upgrade.'
      operationId: createABillingOrderForAPlanUpgrade
      description: ''
      parameters: []
      responses:
        201:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  id: 1
                  invoice_no: INV-XXXXXXXXXX
                  amount: '9.00'
                  status: pending
                properties:
                  id:
                    type: integer
                    example: 1
                  invoice_no:
                    type: string
                    example: INV-XXXXXXXXXX
                  amount:
                    type: string
                    example: '9.00'
                  status:
                    type: string
                    example: pending
      tags:
        - Billing
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                plan_id:
                  type: integer
                  description: ''
                  example: 2
                gateway_id:
                  type: integer
                  description: ''
                  example: 1
              required:
                - plan_id
                - gateway_id
    get:
      summary: 'List billing orders.'
      operationId: listBillingOrders
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    -
                      id: 1
                      invoice_no: INV-XXXXXXXXXX
                      amount: '9.00'
                      status: completed
                      created_at: '2026-06-30'
                properties:
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        invoice_no: INV-XXXXXXXXXX
                        amount: '9.00'
                        status: completed
                        created_at: '2026-06-30'
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        invoice_no:
                          type: string
                          example: INV-XXXXXXXXXX
                        amount:
                          type: string
                          example: '9.00'
                        status:
                          type: string
                          example: completed
                        created_at:
                          type: string
                          example: '2026-06-30'
      tags:
        - Billing
  /api/billing/quota:
    get:
      summary: 'Get current plan quota usage.'
      operationId: getCurrentPlanQuotaUsage
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  devices:
                    used: 2
                    max: 10
                  contacts:
                    used: 450
                    max: 10000
                  messages_today:
                    used: 120
                    max: 10000
                  active_campaigns:
                    used: 1
                    max: 50
                properties:
                  devices:
                    type: object
                    properties:
                      used:
                        type: integer
                        example: 2
                      max:
                        type: integer
                        example: 10
                  contacts:
                    type: object
                    properties:
                      used:
                        type: integer
                        example: 450
                      max:
                        type: integer
                        example: 10000
                  messages_today:
                    type: object
                    properties:
                      used:
                        type: integer
                        example: 120
                      max:
                        type: integer
                        example: 10000
                  active_campaigns:
                    type: object
                    properties:
                      used:
                        type: integer
                        example: 1
                      max:
                        type: integer
                        example: 50
      tags:
        - Billing
  '/api/flows/{id}':
    get:
      summary: ''
      operationId: getApiFlowsId
      description: ''
      parameters: []
      responses:
        401:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Invalid API key.'
                properties:
                  error:
                    type: string
                    example: 'Invalid API key.'
      tags:
        - Endpoints
    put:
      summary: ''
      operationId: putApiFlowsId
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
    delete:
      summary: ''
      operationId: deleteApiFlowsId
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the flow.'
        example: architecto
        required: true
        schema:
          type: string
  '/api/support/tickets/{ticketId}/messages':
    get:
      summary: ''
      operationId: getApiSupportTicketsTicketIdMessages
      description: ''
      parameters: []
      responses:
        401:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Invalid API key.'
                properties:
                  error:
                    type: string
                    example: 'Invalid API key.'
      tags:
        - Endpoints
    post:
      summary: ''
      operationId: postApiSupportTicketsTicketIdMessages
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                  description: 'Must not be greater than 5000 characters.'
                  example: b
              required:
                - body
    parameters:
      -
        in: path
        name: ticketId
        description: ''
        example: architecto
        required: true
        schema:
          type: string
  '/api/devices/{deviceId}/groups':
    get:
      summary: ''
      operationId: getApiDevicesDeviceIdGroups
      description: ''
      parameters: []
      responses:
        401:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  error: 'Invalid API key.'
                properties:
                  error:
                    type: string
                    example: 'Invalid API key.'
      tags:
        - Endpoints
    parameters:
      -
        in: path
        name: deviceId
        description: ''
        example: 100
        required: true
        schema:
          type: integer
  '/api/devices/{deviceId}/groups/{groupId}/send-text':
    post:
      summary: ''
      operationId: postApiDevicesDeviceIdGroupsGroupIdSendText
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                  description: ''
                  example: architecto
              required:
                - body
    parameters:
      -
        in: path
        name: deviceId
        description: ''
        example: 100
        required: true
        schema:
          type: integer
      -
        in: path
        name: groupId
        description: ''
        example: 16
        required: true
        schema:
          type: integer
  '/api/devices/{deviceId}/groups/{groupId}/send-media':
    post:
      summary: ''
      operationId: postApiDevicesDeviceIdGroupsGroupIdSendMedia
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                media_url:
                  type: string
                  description: 'Must be a valid URL.'
                  example: 'http://www.bailey.biz/quos-velit-et-fugiat-sunt-nihil-accusantium-harum.html'
                type:
                  type: string
                  description: ''
                  example: video
                  enum:
                    - image
                    - video
                    - document
                  nullable: true
                caption:
                  type: string
                  description: ''
                  example: architecto
                  nullable: true
              required:
                - media_url
    parameters:
      -
        in: path
        name: deviceId
        description: ''
        example: 100
        required: true
        schema:
          type: integer
      -
        in: path
        name: groupId
        description: ''
        example: 16
        required: true
        schema:
          type: integer
  /api/billing/checkout:
    post:
      summary: ''
      operationId: postApiBillingCheckout
      description: ''
      parameters: []
      responses: {  }
      tags:
        - Endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                plan_id:
                  type: integer
                  description: 'Must match an existing stored value.'
                  example: 16
                gateway_id:
                  type: integer
                  description: 'Must match an existing stored value.'
                  example: 16
              required:
                - plan_id
                - gateway_id
