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

# Retrieve a phone number with messaging settings



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/messaging/phone-numbers.yml get /phone_numbers/{id}/messaging
openapi: 3.1.0
info:
  title: Telnyx Messaging Phone Numbers API
  version: 2.0.0
  description: API for phone number messaging settings.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /phone_numbers/{id}/messaging:
    get:
      tags:
        - Number Settings
      summary: Retrieve a phone number with messaging settings
      operationId: GetPhoneNumberMessagingSettings
      parameters:
        - name: id
          in: path
          description: Identifies the type of resource.
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/PhoneNumberWithMessagingSettingsResponse'
        4XX:
          $ref: '#/components/responses/messaging_GenericErrorResponse'
      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 messaging = await
            client.phoneNumbers.messaging.retrieve('id');


            console.log(messaging.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
            )
            messaging = client.phone_numbers.messaging.retrieve(
                "id",
            )
            print(messaging.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\tmessaging, err := client.PhoneNumbers.Messaging.Get(context.TODO(), \"id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", messaging.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.phonenumbers.messaging.MessagingRetrieveParams;

            import
            com.telnyx.sdk.models.phonenumbers.messaging.MessagingRetrieveResponse;


            public final class Main {
                private Main() {}

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

                    MessagingRetrieveResponse messaging = client.phoneNumbers().messaging().retrieve("id");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            messaging = telnyx.phone_numbers.messaging.retrieve("id")

            puts(messaging)
        - 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 {
              $messaging = $client->phoneNumbers->messaging->retrieve('id');

              var_dump($messaging);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx phone-numbers:messaging retrieve \
              --api-key 'My API Key' \
              --id id
components:
  responses:
    PhoneNumberWithMessagingSettingsResponse:
      description: >-
        Successful response with details about a phone number including
        messaging settings.
      content:
        application/json:
          schema:
            type: object
            title: Retrieve Messaging Settings Response
            properties:
              data:
                $ref: '#/components/schemas/PhoneNumberWithMessagingSettings'
    messaging_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/messaging_Errors'
  schemas:
    PhoneNumberWithMessagingSettings:
      type: object
      example:
        record_type: messaging_settings
        id: '1293384261075731499'
        phone_number: '+18005550001'
        messaging_profile_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
        created_at: '2019-01-23T18:10:02.574Z'
        updated_at: '2019-01-23T18:10:02.574Z'
        country_code: US
        type: tollfree
        health:
          message_count: 122
          inbound_outbound_ratio: 0.43
          success_ratio: 0.94
          spam_ratio: 0.06
        eligible_messaging_products:
          - A2P
        traffic_type: A2P
        messaging_product: A2P
        features:
          sms:
            domestic_two_way: true
            international_inbound: true
            international_outbound: true
          mms: null
      properties:
        record_type:
          type: string
          example: messaging_settings
          enum:
            - messaging_phone_number
            - messaging_settings
          description: Identifies the type of the resource.
          readOnly: true
        id:
          type: string
          description: Identifies the type of resource.
          readOnly: true
        phone_number:
          type: string
          description: +E.164 formatted phone number.
          readOnly: true
          x-format: e164
        messaging_profile_id:
          type:
            - string
            - 'null'
          description: Unique identifier for a messaging profile.
        created_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the resource was created.
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the resource was updated.
          readOnly: true
        country_code:
          type: string
          description: ISO 3166-1 alpha-2 country code.
          pattern: ^[A-Z]{2}$
          example: US
          readOnly: true
        type:
          type: string
          description: The type of the phone number
          enum:
            - long-code
            - toll-free
            - short-code
            - longcode
            - tollfree
            - shortcode
          readOnly: true
        health:
          $ref: '#/components/schemas/NumberHealthMetrics'
        eligible_messaging_products:
          type: array
          description: The messaging products that this number can be registered to use
          readOnly: true
          items:
            type: string
        traffic_type:
          type: string
          description: >-
            The messaging traffic or use case for which the number is currently
            configured.
          example: P2P
          readOnly: true
        messaging_product:
          type: string
          description: The messaging product that the number is registered to use
          example: P2P
        features:
          type: object
          readOnly: true
          properties:
            sms:
              $ref: '#/components/schemas/MessagingFeatureSet'
            mms:
              $ref: '#/components/schemas/MessagingFeatureSet'
        organization_id:
          type: string
          description: The organization that owns this phone number.
        tags:
          type: array
          items:
            type: string
          description: Tags associated with this phone number.
    messaging_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/messaging_Error'
    NumberHealthMetrics:
      type: object
      required:
        - message_count
        - inbound_outbound_ratio
        - success_ratio
        - spam_ratio
      description: >
        High level health metrics about the number and it's messaging sending
        patterns.
      properties:
        message_count:
          type: integer
          description: The number of messages analyzed for the health metrics.
        inbound_outbound_ratio:
          type: number
          format: float
          description: The ratio of messages received to the number of messages sent.
        success_ratio:
          type: number
          format: float
          description: >-
            The ratio of messages sucessfully delivered to the number of
            messages attempted.
        spam_ratio:
          type: number
          format: float
          description: >-
            The ratio of messages blocked for spam to the number of messages
            attempted.
      example:
        message_count: 10
        inbound_outbound_ratio: 1
        success_ratio: 2
        spam_ratio: 10
    MessagingFeatureSet:
      type:
        - object
        - 'null'
      required:
        - domestic_two_way
        - international_inbound
        - international_outbound
      description: >
        The set of features available for a specific messaging use case (SMS or
        MMS). Features

        can vary depending on the characteristics the phone number, as well as
        its current

        product configuration.
      properties:
        domestic_two_way:
          type: boolean
          description: >-
            Send messages to and receive messages from numbers in the same
            country.
        international_inbound:
          type: boolean
          description: Receive messages from numbers in other countries.
        international_outbound:
          type: boolean
          description: Send messages to numbers in other countries.
      example:
        domestic_two_way: true
        international_inbound: false
        international_outbound: true
    messaging_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
          x-format: integer
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
              format: json-pointer
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````