Telnyx MDR Usage Reports API

Messaging usage reports

OpenAPI Specification

telnyx-mdr-usage-reports-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: support@telnyx.com
  description: Telnyx provides global communications and connectivity APIs for developers — including SIP trunking, programmable voice, SMS, MMS, WhatsApp Business Messaging, Call Control, Fax, Wireless (IoT & eSIM), Phone Numbers (DID provisioning & porting), Emergency Services, and Network APIs for private interconnects and edge connectivity. Build, scale, and manage voice, messaging, and data networks with Telnyx's carrier-grade global infrastructure and API-first platform.
  title: Telnyx Access Tokens MDR Usage Reports API
  version: 2.0.0
  x-endpoint-cost: light
servers:
- description: Version 2.0.0 of the Telnyx API
  url: https://api.telnyx.com/v2
security:
- bearerAuth: []
tags:
- description: Messaging usage reports
  name: MDR Usage Reports
paths:
  /legacy/reporting/usage_reports/messaging:
    get:
      description: 'Fetch all previous requests for MDR usage reports. '
      operationId: getMdrUsageReports
      parameters:
      - description: Page number
        in: query
        name: page
        schema:
          default: 1
          format: int32
          minimum: 1
          type: integer
      - description: Size of the page
        in: query
        name: per_page
        schema:
          default: 20
          format: int32
          maximum: 250
          minimum: 1
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/standard_MdrGetUsageReportsResponse'
          description: Successful
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/standard_ErrorResponse'
          description: Bad Request
      security:
      - bearerAuth: []
      summary: List MDR usage reports
      tags:
      - MDR Usage Reports
      x-latency-category: responsive
    post:
      description: Creates a new legacy usage V2 MDR report request with the specified filters
      operationId: submitMdrUsageReport
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/MdrUsageRequestLegacy'
        description: MDR detail request data
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrPostUsageReportResponse'
          description: V2 legacy MDR usage report request created successfully
        '400':
          description: Invalid request parameters
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal server error
      security:
      - bearerAuth: []
      summary: Create a new legacy usage V2 MDR report request
      tags:
      - MDR Usage Reports
      x-latency-category: responsive
  /legacy/reporting/usage_reports/messaging/{id}:
    delete:
      description: Deletes a specific V2 legacy usage MDR report request by ID
      operationId: deleteMdrUsageReport
      parameters:
      - in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrDeleteUsageReportResponse'
          description: V2 legacy usage MDR report request deleted successfully
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Report not found
        '500':
          description: Internal server error
      security:
      - bearerAuth: []
      summary: Delete a V2 legacy usage MDR report request
      tags:
      - MDR Usage Reports
      x-latency-category: responsive
    get:
      description: Fetch single MDR usage report by id.
      operationId: getMdrUsageReport
      parameters:
      - in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrGetUsageReportByIdResponse'
          description: Successful
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Report not found
        '500':
          description: Internal server error
      security:
      - bearerAuth: []
      summary: Get an MDR usage report
      tags:
      - MDR Usage Reports
      x-latency-category: responsive
  /reports/mdr_usage_reports:
    get:
      description: Fetch all messaging usage reports. Usage reports are aggregated messaging data for specified time period and breakdown
      operationId: GetMdrUsageReports
      parameters:
      - description: 'Consolidated page parameter (deepObject style). Originally: page[number], page[size]'
        examples:
          page[number]=1&page[size]=20:
            summary: Default pagination with first page and 20 records per page
            value:
              number: 1
              size: 20
          page[number]=1&page[size]=50:
            summary: First page with 50 records per page
            value:
              number: 1
              size: 50
          page[number]=2&page[size]=20:
            summary: Second page with 20 records per page
            value:
              number: 2
              size: 20
          page[number]=5&page[size]=100:
            summary: Fifth page with 100 records per page
            value:
              number: 5
              size: 100
        explode: true
        in: query
        name: page
        schema:
          properties:
            number:
              default: 1
              description: Page number
              format: int32
              type: integer
            size:
              default: 20
              description: Size of the page
              format: int32
              type: integer
          type: object
        style: deepObject
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrGetUsageReportsResponse'
          description: Successful
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reporting_ErrorResponse'
          description: Bad Request
      security:
      - bearerAuth: []
      summary: Fetch all Messaging usage reports
      tags:
      - MDR Usage Reports
      x-latency-category: interactive
    post:
      description: 'Submit request for new new messaging usage report. This endpoint will pull and aggregate messaging data in specified time period. '
      operationId: SubmitUsageReport
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/MdrPostUsageReportRequest'
        description: Mdr usage report data
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrPostUsageReportsResponse'
          description: Successful
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reporting_ErrorResponse'
          description: Bad Request
      security:
      - bearerAuth: []
      summary: Create MDR Usage Report
      tags:
      - MDR Usage Reports
      x-latency-category: background
  /reports/mdr_usage_reports/sync:
    get:
      description: 'Generate and fetch messaging usage report synchronously. This endpoint will both generate and fetch the messaging report over a specified time period. No polling is necessary but the response may take up to a couple of minutes. '
      operationId: GetMDRUsageReportSync
      parameters:
      - in: query
        name: start_date
        schema:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
      - in: query
        name: end_date
        schema:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
      - in: query
        name: aggregation_type
        required: true
        schema:
          enum:
          - NO_AGGREGATION
          - PROFILE
          - TAGS
          example: PROFILE
          type: string
      - in: query
        name: profiles
        schema:
          example:
          - My profile
          items:
            example: My profile
            type: string
          type: array
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrGetSyncUsageReportResponse'
          description: Successful
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reporting_ErrorResponse'
          description: Bad Request
      security:
      - bearerAuth: []
      summary: Generate and fetch MDR Usage Report
      tags:
      - MDR Usage Reports
      x-latency-category: background
  /reports/mdr_usage_reports/{id}:
    delete:
      description: Delete messaging usage report by id
      operationId: DeleteUsageReport
      parameters:
      - in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrDeleteUsageReportsResponse'
          description: Successful
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reporting_ErrorResponse'
          description: Bad Request
      security:
      - bearerAuth: []
      summary: Delete MDR Usage Report
      tags:
      - MDR Usage Reports
      x-latency-category: interactive
    get:
      description: Fetch a single messaging usage report by id
      operationId: GetUsageReport
      parameters:
      - in: path
        name: id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrGetUsageReportsByIdResponse'
          description: Successful
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reporting_ErrorResponse'
          description: Bad Request
      security:
      - bearerAuth: []
      summary: Retrieve messaging report
      tags:
      - MDR Usage Reports
      x-latency-category: interactive
components:
  schemas:
    MdrDeleteUsageReportsResponse:
      properties:
        data:
          $ref: '#/components/schemas/MdrUsageReportResponse'
      type: object
    MdrUsageRecord:
      properties:
        carrier_passthrough_fee:
          example: '0'
          type: string
        connection:
          example: all
          type: string
        cost:
          example: '0'
          type: string
        currency:
          example: USD
          type: string
        delivered:
          example: '0'
          type: string
        direction:
          example: outbound
          type: string
        message_type:
          example: SMS
          type: string
        parts:
          example: '0'
          type: string
        product:
          example: outbound
          type: string
        profile_id:
          example: All
          type: string
        received:
          example: '0'
          type: string
        sent:
          example: '0'
          type: string
        tags:
          example: All
          type: string
        tn_type:
          example: TF
          type: string
      type: object
    reporting_PaginationMeta:
      properties:
        page_number:
          example: 2
          format: int32
          type: integer
        page_size:
          example: 25
          format: int32
          type: integer
        total_pages:
          example: 3
          format: int32
          type: integer
        total_results:
          example: 55
          format: int32
          type: integer
      type: object
    standard_Error:
      properties:
        code:
          title: Telnyx error code
          type: string
        detail:
          title: Error details
          type: string
        title:
          title: Error title
          type: string
      required:
      - detail
      title: Error
      type: object
    MdrGetUsageReportsResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/MdrUsageReportResponse'
          type: array
        meta:
          $ref: '#/components/schemas/reporting_PaginationMeta'
      type: object
    MdrUsageReportResponse:
      properties:
        aggregation_type:
          enum:
          - NO_AGGREGATION
          - PROFILE
          - TAGS
          type: string
        connections:
          items:
            format: int64
            type: integer
          type: array
        created_at:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
        end_date:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
        id:
          description: Identifies the resource
          format: uuid
          type: string
        profiles:
          example: My profile
          type: string
        record_type:
          example: mdr_usage_report
          type: string
        report_url:
          example: http://portal.telnyx.com/downloads/report_name_8hvb45Gu.csv
          type: string
        result:
          items:
            $ref: '#/components/schemas/MdrUsageRecord'
          type: array
        start_date:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
        status:
          enum:
          - PENDING
          - COMPLETE
          - FAILED
          - EXPIRED
          type: string
        updated_at:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
      type: object
    MdrPostUsageReportRequest:
      properties:
        aggregation_type:
          enum:
          - NO_AGGREGATION
          - PROFILE
          - TAGS
          type: string
        end_date:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
        profiles:
          example: My profile
          type: string
        start_date:
          example: '2020-07-01T00:00:00-06:00'
          format: date-time
          type: string
      required:
      - aggregation_type
      - end_date
      - start_date
      type: object
    standard_ErrorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/standard_Error'
          title: Errors
          type: array
      title: ErrorResponse
      type: object
    MdrUsageRequestLegacy:
      description: MDR usage request parameters
      properties:
        aggregation_type:
          description: 'Aggregation type: No aggregation = 0, By Messaging Profile = 1, By Tags = 2'
          example: 0
          format: int32
          type: integer
        end_time:
          example: '2020-01-02T00:00:00Z'
          format: date-time
          type: string
        managed_accounts:
          description: List of managed accounts to include
          example:
          - f47ac10b-58cc-4372-a567-0e02b2c3d479
          - 6ba7b810-9dad-11d1-80b4-00c04fd430c8
          items:
            format: uuid
            type: string
          type: array
        profiles:
          description: List of messaging profile IDs to filter by
          example:
          - 3fa85f64-5717-4562-b3fc-2c963f66afa6
          - 7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f
          items:
            format: uuid
            type: string
          type: array
        select_all_managed_accounts:
          example: true
          type: boolean
        start_time:
          example: '2020-01-01T00:00:00Z'
          format: date-time
          type: string
      required:
      - aggregation_type
      type: object
    reporting_ErrorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/reporting_Error'
          type: array
      type: object
    MdrGetUsageReportByIdResponse:
      properties:
        data:
          $ref: '#/components/schemas/MdrUsageReportResponseLegacy'
      type: object
    reporting_Error:
      properties:
        code:
          example: '10011'
          type: string
        detail:
          example: Invalid parameter value
          type: string
        title:
          example: Bad Request
          type: string
      type: object
    MdrGetUsageReportsByIdResponse:
      properties:
        data:
          $ref: '#/components/schemas/MdrUsageReportResponse'
      type: object
    standard_PaginationMeta:
      properties:
        page_number:
          example: 2
          format: int32
          type: integer
        page_size:
          example: 25
          format: int32
          type: integer
        total_pages:
          example: 3
          format: int32
          type: integer
        total_results:
          example: 55
          format: int32
          type: integer
      type: object
    MdrPostUsageReportResponse:
      properties:
        data:
          $ref: '#/components/schemas/MdrUsageReportResponseLegacy'
      type: object
    MdrPostUsageReportsResponse:
      properties:
        data:
          $ref: '#/components/schemas/MdrUsageReportResponse'
      type: object
    MdrUsageReportResponseLegacy:
      description: Legacy V2 MDR usage report response
      properties:
        aggregation_type:
          description: 'Aggregation type: No aggregation = 0, By Messaging Profile = 1, By Tags = 2'
          format: int32
          type: integer
        connections:
          example:
          - '1234567890'
          - '9876543210'
          items:
            type: string
          type: array
          uniqueItems: true
        created_at:
          example: '2018-02-02T22:25:27.521Z'
          format: date-time
          type: string
        end_time:
          example: '2018-02-02T22:25:27.521Z'
          format: date-time
          type: string
        id:
          description: Identifies the resource
          format: uuid
          type: string
        profiles:
          description: List of messaging profile IDs
          example:
          - 3fa85f64-5717-4562-b3fc-2c963f66afa6
          - 7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f
          items:
            format: uuid
            type: string
          type: array
        record_type:
          example: mdr_usage_report_v2_legacy
          type: string
        report_url:
          example: http://portal.telnyx.com/downloads/report_name_8hvb45Gu.csv
          type: string
        result:
          type: object
        start_time:
          example: '2018-02-02T22:25:27.521Z'
          format: date-time
          type: string
        status:
          description: Status of the report (Pending = 1, Complete = 2, Failed = 3, Expired = 4)
          format: int32
          type: integer
        updated_at:
          example: '2018-02-02T22:25:27.521Z'
          format: date-time
          type: string
      type: object
    standard_MdrGetUsageReportsResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/MdrUsageReportResponseLegacy'
          type: array
        meta:
          $ref: '#/components/schemas/standard_PaginationMeta'
      type: object
    MdrDeleteUsageReportResponse:
      properties:
        data:
          $ref: '#/components/schemas/MdrUsageReportResponseLegacy'
      type: object
    MdrGetSyncUsageReportResponse:
      properties:
        data:
          $ref: '#/components/schemas/MdrUsageReportResponse'
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    branded-calling_bearerAuth:
      description: API key passed as a Bearer token in the Authorization header
      scheme: bearer
      type: http
    oauthClientAuth:
      description: OAuth 2.0 authentication for Telnyx API and MCP integrations
      flows:
        authorizationCode:
          authorizationUrl: https://api.telnyx.com/v2/oauth/authorize
          refreshUrl: https://api.telnyx.com/v2/oauth/token
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
        clientCredentials:
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
      type: oauth2
    outbound-voice-profiles_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
    pronunciation-dicts_bearerAuth:
      description: Telnyx API v2 key. Obtain from https://portal.telnyx.com
      scheme: bearer
      type: http
    stored-payment-transactions_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http