openapi: 3.0.0
servers:
  - url: https://api.vonage.com/t/vbc.prod/reports
info:
  contact:
    name: Vonage Business Cloud Support
    url: https://businesssupport.vonage.com/contactus
  description: >
    The Vonage Business Cloud Reports API enables you to retrieve call logs for your account.


    Your application must subscribe to the Reports API suite to use this API.
  termsOfService: https://www.vonage.com/business/legal-policy-center/business-cloud/tos
  title: Reports API
  version: 1.0.1
  x-origin:
    - format: openapi
      url: https://raw.githubusercontent.com/nexmo/api-specification/master/definitions/vonage-business-cloud/reports.yml
      version: "3.0"
  x-providerName: vonage.com
  x-serviceName: reports
paths:
  "/accounts/{account_id}/call-logs":
    get:
      description: Retrieve call logs for your account
      operationId: getCallLogs
      parameters:
        - $ref: "#/components/parameters/AccountID"
        - description: Filter records by start date (greater equal or equal to)
          example: 2019-01-01 00:00:00
          in: query
          name: start:gte
          required: true
          schema:
            type: string
        - description: Filter records by start date (less equal or equal to)
          example: 2019-01-01 00:00:00
          in: query
          name: start:lte
          required: true
          schema:
            type: string
        - description: Filter records by end date (greater equal or equal to)
          example: 2019-01-01 00:00:00
          in: query
          name: end:gte
          schema:
            type: string
        - description: Filter records by end date (less equal or equal to)
          example: 2019-01-01 00:00:00
          in: query
          name: end:lte
          schema:
            type: string
        - description: Number of records per page
          example: 10
          in: query
          name: page_size
          required: true
          schema:
            default: 10
            type: number
        - description: Current page number
          example: 10
          in: query
          name: page
          required: true
          schema:
            default: 0
            type: number
        - description: Filter by called number
          example: 17325550100
          in: query
          name: to
          schema:
            type: string
        - description: Filter by source number
          example: 17325550100
          in: query
          name: from
          schema:
            type: string
        - description: Filter by source user
          in: query
          name: source_user
          schema:
            type: string
        - description: Filter by destination user
          in: query
          name: destination_user
          schema:
            type: string
        - description: Filter by call direction.
          example: Inbound
          in: query
          name: direction
          schema:
            enum:
              - Inbound
              - Outbound
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CallLogsHalResponse"
          description: Success
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ValidationErrorsResponse"
          description: Invalid parameters given
      security:
        - bearerAuth: []
      summary: Retrieve call logs for your account
components:
  parameters:
    AccountID:
      description: The Vonage Business Cloud account ID
      example: 913874
      in: path
      name: account_id
      required: true
      schema:
        type: string
  schemas:
    CallLog:
      properties:
        charge:
          description: Amount charged for the call
          example: 0
          type: number
        destination_device_name:
          description: Name of the destination device of the call
          example: Smith
          type: string
        destination_extension:
          description: Destination extension of the call
          example: 1000
          type: number
        destination_sip_id:
          description: SIP ID of the destination device of the call
          example: VH1111111
          type: string
        destination_user:
          description: Destination user of the call
          example: JSmith
          type: string
        destination_user_full_name:
          description: Full name of the destination user of the call
          example: John Smith
          type: string
        direction:
          description: Direction of the call
          example: Inbound
          type: string
        end:
          description: End time of the call
          example: 2019-01-01 00:00:00
          type: string
        from:
          description: Source number of the call
          example: 17325550100
          type: string
        id:
          description: Unique identifier of the call
          example: f27b937d-6dde-441a-9595-006e7302eac1
          type: string
        in_network:
          description: Indicates if call was on/off network
          example: true
          type: boolean
        international:
          description: Indicates if call was international
          example: false
          type: boolean
        length:
          description: Duration of the call in seconds
          example: 60
          type: number
        rate:
          description: Rate charged for the call
          example: 0
          type: number
        recorded:
          description: Indicates if call was recorded
          example: true
          type: boolean
        result:
          description: Result of the call
          example: Answered
          type: string
        source_device_name:
          description: Name of the source device of the call
          example: Smith
          type: string
        source_extension:
          description: Source extension of the call
          example: 1000
          type: number
        source_sip_id:
          description: SIP ID of the source device of the call
          example: VH1111111
          type: string
        source_user:
          description: Source user of the call
          example: JSmith
          type: string
        source_user_full_name:
          description: Full name of the source user of the call
          example: John Smith
          type: string
        start:
          description: Start time of the call
          example: 2019-01-01 00:00:00
          type: string
        to:
          description: Destination number of the call
          example: 17325550100
          type: string
      type: object
    CallLogsEmbeddedObject:
      properties:
        call_logs:
          items:
            $ref: "#/components/schemas/CallLog"
          type: array
      type: object
    CallLogsHalResponse:
      properties:
        _embedded:
          $ref: "#/components/schemas/CallLogsEmbeddedObject"
        _links:
          $ref: "#/components/schemas/Links"
        page:
          description: Current page number
          example: 1
          type: number
        page_size:
          description: Number of records per page
          example: 10
          type: number
        total_items:
          description: Total number of records
          example: 100
          type: number
        total_page:
          description: Total number of pages
          example: 10
          type: number
      type: object
    DetailedInvalidParam:
      properties:
        name:
          description: Invalid property name
          type: string
        reason:
          description: Invalid property reason
          type: string
      type: object
    ErrorResponse:
      properties:
        msg:
          description: Error message
          type: string
        status:
          description: Http Response Code
          type: number
      type: object
    FirstHref:
      description: URL to the first page of records
      properties:
        href:
          type: string
      type: object
    LastHref:
      description: URL to the last page of records
      properties:
        href:
          type: string
      type: object
    Links:
      properties:
        first:
          $ref: "#/components/schemas/FirstHref"
        next:
          $ref: "#/components/schemas/NextHref"
        prev:
          $ref: "#/components/schemas/PrevHref"
        self:
          $ref: "#/components/schemas/SelfHref"
      type: object
    NextHref:
      description: URL to the next page of records
      properties:
        href:
          type: string
      type: object
    PrevHref:
      description: URL to the previous page of records
      properties:
        href:
          type: string
      type: object
    SelfHref:
      description: URL to the current page of records
      properties:
        href:
          type: string
      type: object
    ValidationErrorsResponse:
      properties:
        instance:
          description: Error Track ID
          type: string
        invalid_parameters:
          description: Invalid parameters and their reason for failing
          items:
            $ref: "#/components/schemas/DetailedInvalidParam"
          type: array
        status:
          description: Error status code
          type: number
        title:
          description: Error title
          type: string
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: OAuth
      scheme: bearer
      type: http
