> ## 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 Mdr records

> Fetch all Mdr records 



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/usage-reports.yml get /reports/mdrs
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/mdrs:
    get:
      tags:
        - MDR Detail Reports
      summary: Fetch all Mdr records
      description: 'Fetch all Mdr records '
      operationId: GetPaginatedMdrs
      parameters:
        - name: start_date
          in: query
          description: Pagination start date
          schema:
            type: string
        - name: end_date
          in: query
          description: Pagination end date
          schema:
            type: string
        - name: id
          in: query
          schema:
            type: string
            description: Message uuid
            example: e093fbe0-5bde-11eb-ae93-0242ac130002
        - name: direction
          in: query
          schema:
            type: string
            description: Direction (inbound or outbound)
            example: INBOUND
            enum:
              - INBOUND
              - OUTBOUND
        - name: profile
          in: query
          schema:
            type: string
            description: Name of the profile
            example: My profile
        - name: cld
          in: query
          schema:
            type: string
            description: Destination number
            example: '+15551237654'
        - name: cli
          in: query
          schema:
            type: string
            description: Origination number
            example: '+15551237654'
        - name: status
          in: query
          schema:
            type: string
            description: Message status
            example: DELIVERED
            enum:
              - GW_TIMEOUT
              - DELIVERED
              - DLR_UNCONFIRMED
              - DLR_TIMEOUT
              - RECEIVED
              - GW_REJECT
              - FAILED
        - name: message_type
          in: query
          schema:
            type: string
            description: Type of message
            example: SMS
            enum:
              - SMS
              - MMS
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdrGetDetailResponse'
        '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
            });

            const response = await client.reports.listMdrs();

            console.log(response.data);
        - 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
            )
            response = client.reports.list_mdrs()
            print(response.data)
        - 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\tresponse, err := client.Reports.ListMdrs(context.TODO(), telnyx.ReportListMdrsParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\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.ReportListMdrsParams;
            import com.telnyx.sdk.models.reports.ReportListMdrsResponse;

            public final class Main {
                private Main() {}

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

                    ReportListMdrsResponse response = client.reports().listMdrs();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            response = telnyx.reports.list_mdrs

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->reports->listMdrs(
                id: 'e093fbe0-5bde-11eb-ae93-0242ac130002',
                cld: '+15551237654',
                cli: '+15551237654',
                direction: 'INBOUND',
                endDate: 'end_date',
                messageType: 'SMS',
                profile: 'My profile',
                startDate: 'start_date',
                status: 'DELIVERED',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx reports list-mdrs \
              --api-key 'My API Key'
components:
  schemas:
    MdrGetDetailResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MdrDetailResponse'
        meta:
          $ref: '#/components/schemas/reporting_PaginationMeta'
    reporting_ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/reporting_Error'
    MdrDetailResponse:
      type: object
      properties:
        created_at:
          type: string
          description: Message sent time
          format: date-time
          example: '2020-07-01T00:00:00-06:00'
        profile_name:
          type: string
          description: >-
            Configured profile name. New profiles can be created and configured
            on Telnyx portal
          example: configured-profile-name
        direction:
          type: string
          description: Direction of message - inbound or outbound.
          example: outbound
        parts:
          type: number
          description: >-
            Number of parts this message has. Max number of character is 160. If
            message contains more characters then that it will be broken down in
            multiple parts
          example: 2
        status:
          type: string
          description: Message status
          example: DELIVERED
          enum:
            - GW_TIMEOUT
            - DELIVERED
            - DLR_UNCONFIRMED
            - DLR_TIMEOUT
            - RECEIVED
            - GW_REJECT
            - FAILED
        cld:
          type: string
          description: The destination number for a call, or the callee
          example: '+1555123456'
        cli:
          type: string
          description: >-
            The number associated with the person initiating the call, or the
            caller
          example: '+1555123456'
        rate:
          type: string
          description: Rate applied to the message
          example: '0.05'
        cost:
          type: string
          description: Final cost. Cost is calculated as rate * parts
          example: '0.1'
        currency:
          type: string
          description: Currency of the rate and cost
          example: USD
          enum:
            - AUD
            - CAD
            - EUR
            - GBP
            - USD
        id:
          type: string
          description: Id of message detail record
          example: 99b637f3-07fd-45ac-b9ca-b87208c24650
        message_type:
          type: string
          description: Type of message
          example: SMS
          enum:
            - SMS
            - MMS
        record_type:
          type: string
          example: mdr_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
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````