> ## 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 customer service record

> Create a new customer service record for the provided phone number.



## OpenAPI

````yaml /openapi/source/external/porting/customer_service_record.json post /customer_service_records
openapi: 3.1.0
info:
  version: 2.0.0
  title: Telnyx API
  x-latency-category: responsive
  description: SIP trunking, SMS, MMS, Call Control and Telephony Data Services.
  license:
    name: MIT
    url: https://github.com/openai/openai-openapi/blob/master/LICENSE
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
    description: Version 2.0.0 of the Telnyx API
security:
  - bearerAuth: []
tags:
  - name: Customer Service Record
    description: Customer Service Record operations
  - name: Callbacks
    description: Callbacks
paths:
  /customer_service_records:
    post:
      tags:
        - Customer Service Record
      summary: Create a customer service record
      description: Create a new customer service record for the provided phone number.
      operationId: CreateCustomerServiceRecord
      requestBody:
        $ref: '#/components/requestBodies/CreateCustomerServiceRecord'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CustomerServiceRecord'
                example:
                  data:
                    id: db7cebdb-21a8-4e89-8f51-e03ba6b799bb
                    phone_number: '+2003271000'
                    status: pending
                    error_message: null
                    result: null
                    webhook_url: https://example.com/webhook
                    created_at: '2023-01-01T00:00:00Z'
                    updated_at: '2023-01-01T00:00:00Z'
        '401':
          $ref: '#/components/responses/UnauthorizedErrorResponse'
        '403':
          $ref: '#/components/responses/ForbiddenErrorResponse'
        '422':
          $ref: '#/components/responses/UnprocessableEntityErrorResponse'
        '500':
          $ref: '#/components/responses/UnexpectedErrorResponse'
      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 customerServiceRecord = await
            client.customerServiceRecords.create({
              phone_number: '+13035553000',
            });


            console.log(customerServiceRecord.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
            )
            customer_service_record = client.customer_service_records.create(
                phone_number="+13035553000",
            )
            print(customer_service_record.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\tcustomerServiceRecord, err := client.CustomerServiceRecords.New(context.TODO(), telnyx.CustomerServiceRecordNewParams{\n\t\tPhoneNumber: \"+13035553000\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", customerServiceRecord.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.customerservicerecords.CustomerServiceRecordCreateParams;

            import
            com.telnyx.sdk.models.customerservicerecords.CustomerServiceRecordCreateResponse;


            public final class Main {
                private Main() {}

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

                    CustomerServiceRecordCreateParams params = CustomerServiceRecordCreateParams.builder()
                        .phoneNumber("+13035553000")
                        .build();
                    CustomerServiceRecordCreateResponse customerServiceRecord = client.customerServiceRecords().create(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            customer_service_record =
            telnyx.customer_service_records.create(phone_number: "+13035553000")


            puts(customer_service_record)
        - 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 {
              $customerServiceRecord = $client->customerServiceRecords->create(
                phoneNumber: '+13035553000',
                additionalData: [
                  'accountNumber' => '123456789',
                  'addressLine1' => '123 Main St',
                  'authorizedPersonName' => 'John Doe',
                  'billingPhoneNumber' => '+12065551212',
                  'city' => 'New York',
                  'customerCode' => '123456789',
                  'name' => 'Entity Inc.',
                  'pin' => '1234',
                  'state' => 'NY',
                  'zipCode' => '10001',
                ],
                webhookURL: 'https://example.com/webhook',
              );

              var_dump($customerServiceRecord);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx customer-service-records create \
              --api-key 'My API Key' \
              --phone-number +13035553000
components:
  requestBodies:
    CreateCustomerServiceRecord:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - phone_number
            properties:
              phone_number:
                type: string
                description: A valid US phone number in E164 format.
                example: '+13035553000'
                pattern: ^\+1\d{10}$
              webhook_url:
                type: string
                description: Callback URL to receive webhook notifications.
                example: https://example.com/webhook
              additional_data:
                $ref: '#/components/schemas/CustomerServiceRecordAdditionalData'
  schemas:
    CustomerServiceRecord:
      type: object
      properties:
        id:
          description: Uniquely identifies this customer service record
          type: string
          format: uuid
          example: f1486bae-f067-460c-ad43-73a92848f902
          readOnly: true
        phone_number:
          description: The phone number of the customer service record.
          type: string
          example: '+12065551212'
        status:
          description: The status of the customer service record
          type: string
          enum:
            - pending
            - completed
            - failed
          example: completed
        error_message:
          description: >-
            The error message in case status is `failed`. This field would be
            null in case of `pending` or `completed` status.
          type:
            - string
            - 'null'
          example: CSR information not available.
        result:
          description: >-
            The result of the CSR request. This field would be null in case of
            `pending` or `failed` status.
          type:
            - object
            - 'null'
          properties:
            carrier_name:
              description: The name of the carrier that the customer service record is for.
              type: string
              example: ABC CARRIER, INC.
            associated_phone_numbers:
              description: The associated phone numbers of the customer service record.
              type: array
              items:
                type: string
                example: '+12065551212'
            admin:
              description: The admin of the customer service record.
              type: object
              properties:
                name:
                  description: The name of the customer service record.
                  type: string
                  example: John Doe
                billing_phone_number:
                  description: The billing phone number of the customer service record.
                  type: string
                  example: '+12065551212'
                account_number:
                  description: The account number of the customer service record.
                  type: string
                  example: '1234567890'
                authorized_person_name:
                  description: The authorized person name of the customer service record.
                  type: string
                  example: John Doe
            address:
              description: The address of the customer service record
              type: object
              properties:
                administrative_area:
                  description: The state of the address
                  type: string
                  example: NY
                locality:
                  description: The city of the address
                  type: string
                  example: New York
                postal_code:
                  description: The zip code of the address
                  type: string
                  example: '10001'
                street_address:
                  description: The street address
                  type: string
                  example: 123 Main St
                full_address:
                  description: The full address
                  type: string
                  example: 123 Main St; New York; NY; 10001
        webhook_url:
          type: string
          description: Callback URL to receive webhook notifications.
          example: https://example.com/webhook
        record_type:
          type: string
          example: customer_service_record
          description: Identifies the type of the resource.
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the resource was created.
          example: '2021-03-19T10:07:15.527Z'
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the resource was created.
          example: '2021-03-19T10:07:15.527Z'
          readOnly: true
    CustomerServiceRecordAdditionalData:
      type: object
      properties:
        name:
          description: The name of the administrator of CSR.
          type: string
          example: Entity Inc.
        authorized_person_name:
          description: The name of the authorized person.
          type: string
          example: John Doe
        pin:
          description: The PIN of the customer service record.
          type: string
          example: '1234'
        account_number:
          description: The account number of the customer service record.
          type: string
          example: '123456789'
        customer_code:
          description: The customer code of the customer service record.
          type: string
          example: '123456789'
        address_line_1:
          description: The first line of the address of the customer service record.
          type: string
          example: 123 Main St
        city:
          description: The city of the customer service record.
          type: string
          example: New York
        state:
          description: The state of the customer service record.
          type: string
          example: NY
          maxLength: 2
          pattern: ^[A-Z]{2}$
        zip_code:
          description: The zip code of the customer service record.
          type: string
          example: '10001'
          maxLength: 5
          pattern: ^\d{5}$
        billing_phone_number:
          description: The billing phone number of the customer service record.
          type: string
          example: '+12065551212'
          pattern: ^\+1\d{10}$
    UnauthorizedError:
      allOf:
        - $ref: '#/components/schemas/GenericError'
        - properties:
            code:
              example: '10009'
              type: string
            title:
              example: Authentication failed
              type: string
            detail:
              example: >-
                The required authentication headers were either invalid or not
                included in the request.
              type: string
            meta:
              type: object
              properties:
                url:
                  type: string
                  example: https://developers.telnyx.com/docs/overview/errors/10009
          type: object
    ForbiddenError:
      allOf:
        - $ref: '#/components/schemas/GenericError'
        - properties:
            code:
              example: '10010'
              type: string
            title:
              example: Authorization failed
              type: string
            detail:
              example: >-
                You do not have permission to perform the requested action on
                the specified resource or resources.
              type: string
            meta:
              type: object
              properties:
                url:
                  type: string
                  example: https://developers.telnyx.com/docs/overview/errors/10010
          type: object
    UnprocessableEntityError:
      allOf:
        - $ref: '#/components/schemas/GenericError'
        - properties:
            code:
              example: '10002'
              type: string
            title:
              example: Invalid phone number
              type: string
            detail:
              example: The phone number is invalid.
              type: string
            source:
              type: object
              properties:
                pointer:
                  type: string
                  example: /phone_numbers
            meta:
              type: object
              properties:
                url:
                  type: string
                  example: https://developers.telnyx.com/docs/overview/errors/10002
          type: object
    UnexpectedError:
      allOf:
        - $ref: '#/components/schemas/GenericError'
        - properties:
            code:
              example: '10007'
              type: string
            title:
              example: Unexpected error
              type: string
            detail:
              example: An unexpected error occurred.
              type: string
            meta:
              type: object
              properties:
                url:
                  type: string
                  example: https://developers.telnyx.com/docs/overview/errors/10007
          type: object
    GenericError:
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
  responses:
    UnauthorizedErrorResponse:
      description: >-
        The required authentication headers were either invalid or not included
        in the request.
      content:
        application/json:
          schema:
            properties:
              errors:
                type: array
                items:
                  $ref: '#/components/schemas/UnauthorizedError'
    ForbiddenErrorResponse:
      description: >-
        You do not have permission to perform the requested action on the
        specified resource or resources.
      content:
        application/json:
          schema:
            properties:
              errors:
                type: array
                items:
                  $ref: '#/components/schemas/ForbiddenError'
    UnprocessableEntityErrorResponse:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            properties:
              errors:
                type: array
                items:
                  $ref: '#/components/schemas/UnprocessableEntityError'
    UnexpectedErrorResponse:
      description: An unexpected error occurred.
      content:
        application/json:
          schema:
            properties:
              errors:
                type: array
                items:
                  $ref: '#/components/schemas/UnexpectedError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````