> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch all Messaging usage reports

> Fetch all messaging usage reports. Usage reports are aggregated messaging data for specified time period and breakdown



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/usage-reports.yml get /reports/mdr_usage_reports
openapi: 3.1.0
info:
  title: Telnyx Usage Reports API
  version: 2.0.0
  description: API for Usage reports.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /reports/mdr_usage_reports:
    get:
      tags:
        - MDR Usage Reports
      summary: Fetch all Messaging usage reports
      description: >-
        Fetch all messaging usage reports. Usage reports are aggregated
        messaging data for specified time period and breakdown
      operationId: GetMdrUsageReports
      parameters:
        - name: page
          in: query
          style: deepObject
          explode: true
          description: >-
            Consolidated page parameter (deepObject style). Originally:
            page[number], page[size]
          schema:
            type: object
            properties:
              number:
                type: integer
                format: int32
                default: 1
                description: Page number
              size:
                type: integer
                format: int32
                default: 20
                description: Size of the page
          examples:
            page[number]=1&page[size]=20:
              value:
                number: 1
                size: 20
              summary: Default pagination with first page and 20 records per page
            page[number]=2&page[size]=20:
              value:
                number: 2
                size: 20
              summary: Second page with 20 records per page
            page[number]=1&page[size]=50:
              value:
                number: 1
                size: 50
              summary: First page with 50 records per page
            page[number]=5&page[size]=100:
              value:
                number: 5
                size: 100
              summary: Fifth page with 100 records per page
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrGetUsageReportsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reporting_ErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            // Automatically fetches more pages as needed.

            for await (const mdrUsageReport of
            client.reports.mdrUsageReports.list()) {
              console.log(mdrUsageReport.id);
            }
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            page = client.reports.mdr_usage_reports.list()
            page = page.data[0]
            print(page.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Reports.MdrUsageReports.List(context.TODO(), telnyx.ReportMdrUsageReportListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.reports.mdrusagereports.MdrUsageReportListPage;

            import
            com.telnyx.sdk.models.reports.mdrusagereports.MdrUsageReportListParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    MdrUsageReportListPage page = client.reports().mdrUsageReports().list();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            page = telnyx.reports.mdr_usage_reports.list

            puts(page)
        - lang: CLI
          source: |-
            telnyx reports:mdr-usage-reports list \
              --api-key 'My API Key'
components:
  schemas:
    MdrGetUsageReportsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MdrUsageReportResponse'
        meta:
          $ref: '#/components/schemas/reporting_PaginationMeta'
    reporting_ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/reporting_Error'
    MdrUsageReportResponse:
      type: object
      properties:
        id:
          type: string
          description: Identifies the resource
          format: uuid
        start_date:
          type: string
          format: date-time
          example: '2020-07-01T00:00:00-06:00'
        end_date:
          type: string
          format: date-time
          example: '2020-07-01T00:00:00-06:00'
        connections:
          type: array
          items:
            type: integer
            format: int64
        aggregation_type:
          type: string
          enum:
            - NO_AGGREGATION
            - PROFILE
            - TAGS
        status:
          type: string
          enum:
            - PENDING
            - COMPLETE
            - FAILED
            - EXPIRED
        report_url:
          type: string
          example: http://portal.telnyx.com/downloads/report_name_8hvb45Gu.csv
        result:
          type: array
          items:
            $ref: '#/components/schemas/MdrUsageRecord'
        created_at:
          type: string
          format: date-time
          example: '2020-07-01T00:00:00-06:00'
        updated_at:
          type: string
          format: date-time
          example: '2020-07-01T00:00:00-06:00'
        profiles:
          type: string
          example: My profile
        record_type:
          type: string
          example: mdr_usage_report
    reporting_PaginationMeta:
      type: object
      properties:
        total_pages:
          type: integer
          format: int32
          example: 3
        total_results:
          type: integer
          format: int32
          example: 55
        page_number:
          type: integer
          format: int32
          example: 2
        page_size:
          type: integer
          format: int32
          example: 25
    reporting_Error:
      type: object
      properties:
        code:
          type: string
          example: '10011'
        title:
          type: string
          example: Bad Request
        detail:
          type: string
          example: Invalid parameter value
    MdrUsageRecord:
      type: object
      properties:
        cost:
          type: string
          example: '0'
        direction:
          type: string
          example: outbound
        product:
          type: string
          example: outbound
        connection:
          type: string
          example: all
        received:
          type: string
          example: '0'
        delivered:
          type: string
          example: '0'
        currency:
          type: string
          example: USD
        parts:
          type: string
          example: '0'
        sent:
          type: string
          example: '0'
        profile_id:
          type: string
          example: All
        tags:
          type: string
          example: All
        message_type:
          type: string
          example: SMS
        tn_type:
          type: string
          example: TF
        carrier_passthrough_fee:
          type: string
          example: '0'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````