openapi: 3.0.1
info:
  title: Voice Accounts API
  version: v1
servers:
- url: https://api.cm.com
paths:
  /voice-accountsapi/v1/organization/{organizationId}:
    post:
      tags:
      - Voice Accounts
      summary: Create Voice Accounts
      description: "As a Voice Reseller, you can use this endpoint to create up to 10 Voice Accounts per request.\n\r\n\r**Please note:** This endpoint is only available for Voice Resellers. If you're not a Voice Reseller, you can create Voice Accounts in the [Voice Management App](https://www.cm.com/app/voice-management/)."
      parameters:
      - name: organizationId
        in: path
        description: The unique identifier of your organization. You can find this value on the Reseller API Settings page in the Voice Management App.
        required: true
        schema:
          type: integer
          format: int32
        example: 1234
      requestBody:
        description: CM.Voice.VoiceAccountsApi.Models.Api.ApiLogicalAccount
        content:
          application/json-patch+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ApiLogicalAccount'
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ApiLogicalAccount'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ApiLogicalAccount'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ApiLogicalAccount'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiVoiceAccount'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorCollection'
components:
  schemas:
    ApiLogicalAccount:
      title: Logical Account
      required:
      - billingType
      - name
      type: object
      properties:
        name:
          minLength: 3
          type: string
          description: Name of the new Voice Account.
          example: My new Voice Account
        billingType:
          $ref: '#/components/schemas/BillingTypeId'
      additionalProperties: false
      description: Logical Account that's used for requesting new Voice Accounts.
    ApiVoiceAccount:
      title: Voice Account
      type: object
      properties:
        createdOn:
          type: string
          description: Date and time on which the Voice Account was created.
          format: date-time
        guid:
          type: string
          description: The unique identifier of the Voice Account.
          nullable: true
        name:
          type: string
          description: The name of the Voice Account.
          nullable: true
        externalId:
          type: string
          description: Optional external ID of the Voice Account that can be set by the customer for external references outside of the CM.com Platform.
          nullable: true
        externalName:
          type: string
          description: Optional external name of the Voice Account that can be set by the customer for external references outside of the CM.com Platform.
          nullable: true
        prepaidInfo:
          $ref: '#/components/schemas/PrepaidInfo'
        apiKey:
          type: string
          description: "The API key for authentication when making Voice application requests.\r\nThis will only be returned ONCE, please make sure to store it securely and handle it responsibly."
          nullable: true
        isActive:
          type: boolean
          description: Whether or not the Voice Account is set to Active.
      additionalProperties: false
      description: A Voice Account is the central account for all things Voice related. Among others, phone numbers and SIP trunks will be linked to a certain Voice Account. **Please note** that a Voice Account is different from a Logical Account. You will be able to create multiple Voice Accounts with one Logical Account.
    BillingTypeId:
      title: Billing Type Id
      enum:
      - Prepaid
      - Postpaid
      - Demo
      type: string
      description: Billing type, can be either Postpaid or Prepaid.
    Error:
      title: Error
      type: object
      properties:
        code:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        source:
          type: string
          nullable: true
      additionalProperties: false
    ErrorCollection:
      type: object
      properties:
        requestId:
          type: string
          nullable: true
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
          nullable: true
      additionalProperties: false
    PrepaidInfo:
      title: Prepaid Info
      type: object
      properties:
        amount:
          type: number
          description: The amount of prepaid credit currently in the wallet.
          format: double
        currency:
          type: string
          description: The currency of the credit.
          nullable: true
      additionalProperties: false
      description: The prepaid credit of the Voice Account. Only returned if the the given Voice Account billing type is set to prepaid.
  securitySchemes:
    X-CM-PRODUCTTOKEN:
      type: apiKey
      description: Your producttoken
      name: X-CM-PRODUCTTOKEN
      in: header
security:
- X-CM-PRODUCTTOKEN: []
x-readme:
  explorer-enabled: true
  proxy-enabled: true
