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

# Create a new CDR report request

> Creates a new CDR report request with the specified filters



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/usage-reports.yml post /legacy_reporting/batch_detail_records/voice
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/batch_detail_records/voice:
    post:
      tags:
        - CDR Reports
      summary: Create a new CDR report request
      description: Creates a new CDR report request with the specified filters
      operationId: submitCdrRequest
      parameters: []
      requestBody:
        description: CDR detailed report request data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CdrDetailedRequest'
        required: true
      responses:
        '200':
          description: CDR report request created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CdrPostDetailReportResponse'
        '400':
          description: Invalid request parameters
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal server error
      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 voice = await
            client.legacy.reporting.batchDetailRecords.voice.create({
              end_time: '2024-02-12T23:59:59Z',
              start_time: '2024-02-01T00:00:00Z',
            });


            console.log(voice.data);
        - lang: Python
          source: |-
            import os
            from datetime import datetime
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            voice = client.legacy.reporting.batch_detail_records.voice.create(
                end_time=datetime.fromisoformat("2024-02-12T23:59:59"),
                start_time=datetime.fromisoformat("2024-02-01T00:00:00"),
            )
            print(voice.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\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\tvoice, err := client.Legacy.Reporting.BatchDetailRecords.Voice.New(context.TODO(), telnyx.LegacyReportingBatchDetailRecordVoiceNewParams{\n\t\tEndTime:   time.Now(),\n\t\tStartTime: time.Now(),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", voice.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.legacy.reporting.batchdetailrecords.voice.VoiceCreateParams;

            import
            com.telnyx.sdk.models.legacy.reporting.batchdetailrecords.voice.VoiceCreateResponse;

            import java.time.OffsetDateTime;


            public final class Main {
                private Main() {}

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

                    VoiceCreateParams params = VoiceCreateParams.builder()
                        .endTime(OffsetDateTime.parse("2024-02-12T23:59:59Z"))
                        .startTime(OffsetDateTime.parse("2024-02-01T00:00:00Z"))
                        .build();
                    VoiceCreateResponse voice = client.legacy().reporting().batchDetailRecords().voice().create(params);
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            voice = telnyx.legacy.reporting.batch_detail_records.voice.create(
              end_time: "2024-02-12T23:59:59Z",
              start_time: "2024-02-01T00:00:00Z"
            )

            puts(voice)
        - lang: CLI
          source: |-
            telnyx legacy:reporting:batch-detail-records:voice create \
              --api-key 'My API Key' \
              --end-time "'2024-02-12T23:59:59Z'" \
              --start-time "'2024-02-01T00:00:00Z'"
components:
  schemas:
    CdrDetailedRequest:
      required:
        - start_time
        - end_time
      type: object
      properties:
        start_time:
          type: string
          description: Start time in ISO format
          format: date-time
          example: '2024-02-01T00:00:00Z'
        end_time:
          type: string
          description: End time in ISO format
          format: date-time
          example: '2024-02-12T23:59:59Z'
        timezone:
          type: string
          description: Timezone for the report
          example: UTC
        call_types:
          type: array
          description: List of call types to filter by (Inbound = 1, Outbound = 2)
          items:
            type: integer
            format: int32
          example:
            - 1
            - 2
        record_types:
          type: array
          description: >-
            List of record types to filter by (Complete = 1, Incomplete = 2,
            Errors = 3)
          items:
            type: integer
            format: int32
          example:
            - 1
            - 2
        connections:
          type: array
          description: List of connections to filter by
          items:
            type: integer
            format: int64
          example:
            - 123
            - 456
        report_name:
          type: string
          description: Name of the report
          example: My CDR Report
        source:
          type: string
          description: >-
            Source of the report. Valid values: calls (default), call-control,
            fax-api, webrtc
          example: calls
        include_all_metadata:
          type: boolean
          description: Whether to include all metadata
          example: true
        filters:
          type: array
          description: List of filters to apply
          items:
            $ref: '#/components/schemas/Filter'
        fields:
          type: array
          description: Set of fields to include in the report
          items:
            type: string
          example:
            - call_leg_id
            - start_time
            - end_time
        managed_accounts:
          type: array
          description: List of managed accounts to include
          items:
            type: string
            format: uuid
          example:
            - f47ac10b-58cc-4372-a567-0e02b2c3d479
            - 6ba7b810-9dad-11d1-80b4-00c04fd430c8
        select_all_managed_accounts:
          type: boolean
          description: Whether to select all managed accounts
          example: false
      description: Request object for CDR detailed report
    CdrPostDetailReportResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CdrDetailedReqResponse'
    Filter:
      type: object
      description: >-
        Query filter criteria. Note: The first filter object must specify
        filter_type as 'and'. You cannot follow an 'or' with another 'and'.
      properties:
        filter_type:
          type: string
          description: Logical operator for combining filters
          enum:
            - and
            - or
        cli:
          type: string
          description: Calling line identification (caller ID)
          example: '+13129457420'
        cli_filter:
          type: string
          description: Filter type for CLI matching
          enum:
            - contains
            - starts_with
            - ends_with
        cld:
          type: string
          description: Called line identification (destination number)
          example: '+13129457420'
        cld_filter:
          type: string
          description: Filter type for CLD matching
          enum:
            - contains
            - starts_with
            - ends_with
        tags_list:
          type: string
          description: Tag name to filter by
          example: tag1
        billing_group:
          type: string
          description: Billing group UUID to filter by
          example: adfaa016-f921-4b6c-97bb-e4c1dad231c5
    CdrDetailedReqResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the report
          example: 123e4567-e89b-12d3-a456-426614174000
        start_time:
          type: string
          description: Start time in ISO format
          example: '2024-02-01T00:00:00Z'
        end_time:
          type: string
          description: End time in ISO format
          example: '2024-02-12T23:59:59Z'
        call_types:
          type: array
          description: List of call types (Inbound = 1, Outbound = 2)
          items:
            type: integer
            description: Call type value
            format: int32
        record_types:
          type: array
          description: List of record types (Complete = 1, Incomplete = 2, Errors = 3)
          example:
            - 1
            - 2
          items:
            type: integer
            description: Record type value
            format: int32
        connections:
          type: array
          description: List of connections
          example:
            - 123
            - 456
          items:
            type: integer
            description: List of connections
            format: int64
        report_name:
          type: string
          description: Name of the report
          example: My Report
        status:
          type: integer
          description: >-
            Status of the report (Pending = 1, Complete = 2, Failed = 3, Expired
            = 4)
          format: int32
          example: 1
        report_url:
          type: string
          description: URL to download the report
        filters:
          type: array
          description: List of filters
          items:
            $ref: '#/components/schemas/Filter'
        created_at:
          type: string
          description: Creation date of the report
          example: '2024-02-12T14:00:00Z'
        updated_at:
          type: string
          description: Last update date of the report
          example: '2024-02-12T14:05:00Z'
        timezone:
          type: string
          description: Timezone for the report
        source:
          type: string
          description: >-
            Source of the report. Valid values: calls (default), call-control,
            fax-api, webrtc
        retry:
          type: integer
          description: Number of retries
          format: int32
        managed_accounts:
          type: array
          description: List of managed accounts
          items:
            type: string
            format: uuid
          example:
            - f47ac10b-58cc-4372-a567-0e02b2c3d479
            - 6ba7b810-9dad-11d1-80b4-00c04fd430c8
        record_type:
          type: string
          example: cdr_detailed_report
      description: Response object for CDR detailed report
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````