openapi: 3.0.1
info:
  title: Documents API
  version: v1
servers:
- url: https://api.cm.com
paths:
  /voice-documentsapi/v1/{accountGuid}/documents:
    post:
      tags:
      - Documents
      summary: Upload Documents
      description: 'Upload one or more documents. Please append the documents using a `FormData` object, with the documents in a form field named `Files`.


        If the upload was successfull, you will receive the the document GUID in the response body, please save this GUID somewhere as you will not be able to use your document inside the Voice platform without it.'
      parameters:
      - name: accountGuid
        in: path
        description: Unique identifier of the Logical Account or Voice Account.
        required: true
        schema:
          type: string
          format: uuid
        example: 00000000-0000-0000-0000-000000000000
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiUploadedDocument'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorCollection'
        '401':
          description: Unauthorized
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorCollection'
  /voice-documentsapi/v1/{accountGuid}/documents/{documentGuid}/metadata:
    get:
      tags:
      - Documents
      summary: Get Document Metadata
      description: Get uploaded document metadata by its unique identifier.
      parameters:
      - name: accountGuid
        in: path
        description: Unique identifier of the Logical Account or Voice Account.
        required: true
        schema:
          type: string
          format: uuid
        example: 00000000-0000-0000-0000-000000000000
      - name: documentGuid
        in: path
        description: Unique identifier of the document.
        required: true
        schema:
          type: string
          format: uuid
        example: 00000000-0000-0000-0000-000000000000
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiDocumentMetadata'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorCollection'
        '401':
          description: Unauthorized
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorCollection'
components:
  schemas:
    ApiDocumentMetadata:
      type: object
      properties:
        fileName:
          type: string
          description: File name of the document.
          nullable: true
        fileType:
          type: string
          description: File type in IANA media type (or MIME type) format.
          nullable: true
        uploadDate:
          type: string
          description: UTC date and time the document was uploaded.
          format: date-time
      additionalProperties: false
      description: Metadata of a document containing information about the document, such as filename and content type.
    ApiUploadedDocument:
      title: Uploaded Document
      type: object
      properties:
        fileName:
          type: string
          description: File name of the document.
          nullable: true
        documentGuid:
          type: string
          description: Unique identifier of the document.
          format: uuid
      additionalProperties: false
      description: Response for a newly uploaded document.
    Error:
      title: Error
      type: object
      properties:
        code:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        source:
          type: string
          nullable: true
      additionalProperties: false
    ErrorCollection:
      title: Error Collection
      type: object
      properties:
        requestId:
          type: string
          nullable: true
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
          nullable: true
      additionalProperties: false
  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
