> ## 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.

# List MDR usage reports

> Fetch all previous requests for MDR usage reports. 



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/usage-reports.yml get /legacy_reporting/usage_reports/messaging
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:
  /legacy_reporting/usage_reports/messaging:
    get:
      tags:
        - MDR Usage Reports
      summary: List MDR usage reports
      description: 'Fetch all previous requests for MDR usage reports. '
      operationId: getMdrUsageReports
      parameters:
        - name: page
          in: query
          description: Page number
          schema:
            minimum: 1
            type: integer
            format: int32
            default: 1
        - name: per_page
          in: query
          description: Size of the page
          schema:
            maximum: 250
            minimum: 1
            type: integer
            format: int32
            default: 20
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/standard_MdrGetUsageReportsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/standard_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 mdrUsageReportResponseLegacy of
            client.legacy.reporting.usageReports.messaging.list()) {
              console.log(mdrUsageReportResponseLegacy.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.legacy.reporting.usage_reports.messaging.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.Legacy.Reporting.UsageReports.Messaging.List(context.TODO(), telnyx.LegacyReportingUsageReportMessagingListParams{})\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.legacy.reporting.usagereports.messaging.MessagingListPage;

            import
            com.telnyx.sdk.models.legacy.reporting.usagereports.messaging.MessagingListParams;


            public final class Main {
                private Main() {}

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

                    MessagingListPage page = client.legacy().reporting().usageReports().messaging().list();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            page = telnyx.legacy.reporting.usage_reports.messaging.list

            puts(page)
        - lang: CLI
          source: |-
            telnyx legacy:reporting:usage-reports:messaging list \
              --api-key 'My API Key'
components:
  schemas:
    standard_MdrGetUsageReportsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MdrUsageReportResponseLegacy'
        meta:
          $ref: '#/components/schemas/standard_PaginationMeta'
    standard_ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/standard_Error'
          title: Errors
      title: ErrorResponse
    MdrUsageReportResponseLegacy:
      type: object
      properties:
        id:
          type: string
          description: Identifies the resource
          format: uuid
        start_time:
          type: string
          format: date-time
          example: '2018-02-02T22:25:27.521Z'
        end_time:
          type: string
          format: date-time
          example: '2018-02-02T22:25:27.521Z'
        connections:
          uniqueItems: true
          type: array
          example:
            - '1234567890'
            - '9876543210'
          items:
            type: string
        aggregation_type:
          type: integer
          description: >-
            Aggregation type: No aggregation = 0, By Messaging Profile = 1, By
            Tags = 2
          format: int32
        status:
          type: integer
          description: >-
            Status of the report (Pending = 1, Complete = 2, Failed = 3, Expired
            = 4)
          format: int32
        report_url:
          type: string
          example: http://portal.telnyx.com/downloads/report_name_8hvb45Gu.csv
        result:
          type: object
        created_at:
          type: string
          format: date-time
          example: '2018-02-02T22:25:27.521Z'
        updated_at:
          type: string
          format: date-time
          example: '2018-02-02T22:25:27.521Z'
        profiles:
          type: array
          description: List of messaging profile IDs
          items:
            type: string
            format: uuid
          example:
            - 3fa85f64-5717-4562-b3fc-2c963f66afa6
            - 7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f
        record_type:
          type: string
          example: mdr_usage_report_v2_legacy
      description: Legacy V2 MDR usage report response
    standard_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
    standard_Error:
      type: object
      properties:
        code:
          type: string
          title: Telnyx error code
        detail:
          type: string
          title: Error details
        title:
          type: string
          title: Error title
      required:
        - detail
      title: Error
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````