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

# Lookup phone number data

> Returns information about the provided phone number.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/number-lookup.yml get /number_lookup/{phone_number}
openapi: 3.1.0
info:
  title: Telnyx Number Lookup API
  version: 2.0.0
  description: API for Number lookup.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /number_lookup/{phone_number}:
    get:
      tags:
        - Number Lookup
      summary: Lookup phone number data
      description: Returns information about the provided phone number.
      operationId: LookupNumber
      parameters:
        - $ref: '#/components/parameters/number-lookup_PhoneNumber'
        - $ref: '#/components/parameters/NumberLookupType'
      responses:
        '200':
          $ref: '#/components/responses/NumberLookupResponse'
        '422':
          $ref: '#/components/responses/number-lookup_UnprocessableEntity'
        default:
          $ref: '#/components/responses/number-lookup_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 numberLookup = await
            client.numberLookup.retrieve('+18665552368');


            console.log(numberLookup.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
            )
            number_lookup = client.number_lookup.retrieve(
                phone_number="+18665552368",
            )
            print(number_lookup.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\tnumberLookup, err := client.NumberLookup.Get(\n\t\tcontext.TODO(),\n\t\t\"+18665552368\",\n\t\ttelnyx.NumberLookupGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", numberLookup.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.numberlookup.NumberLookupRetrieveParams;

            import
            com.telnyx.sdk.models.numberlookup.NumberLookupRetrieveResponse;


            public final class Main {
                private Main() {}

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

                    NumberLookupRetrieveResponse numberLookup = client.numberLookup().retrieve("+18665552368");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            number_lookup = telnyx.number_lookup.retrieve("+18665552368")

            puts(number_lookup)
        - 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 {
              $numberLookup = $client->numberLookup->retrieve(
                '+18665552368', type: 'carrier'
              );

              var_dump($numberLookup);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx number-lookup retrieve \
              --api-key 'My API Key' \
              --phone-number +18665552368
components:
  parameters:
    number-lookup_PhoneNumber:
      name: phone_number
      description: The phone number to be looked up
      in: path
      required: true
      schema:
        type: string
        example: '+18665552368'
    NumberLookupType:
      name: type
      in: query
      required: false
      description: Specifies the type of number lookup to be performed
      schema:
        type: string
        enum:
          - carrier
          - caller-name
  responses:
    NumberLookupResponse:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            title: Number Lookup Response
            properties:
              data:
                $ref: '#/components/schemas/NumberLookupRecord'
    number-lookup_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/number-lookup_Errors'
    number-lookup_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/number-lookup_Errors'
  schemas:
    NumberLookupRecord:
      type: object
      title: NumberLookup
      properties:
        record_type:
          type: string
          description: Identifies the type of record
          example: number_lookup
        country_code:
          type: string
          description: Region code that matches the specific country calling code
          example: US
        national_format:
          type: string
          description: >-
            Hyphen-separated national number, preceded by the national
            destination code (NDC), with a 0 prefix, if an NDC is found
          example: (0312) 945-7420
        phone_number:
          type: string
          description: E164-formatted phone number
          example: '+13129457420'
        fraud:
          type:
            - string
            - 'null'
          description: Unused
          example: null
        carrier:
          $ref: '#/components/schemas/Carrier'
        caller_name:
          $ref: '#/components/schemas/CallerName'
        portability:
          $ref: '#/components/schemas/Portability'
    number-lookup_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/number-lookup_Error'
      type: object
    Carrier:
      type: object
      properties:
        mobile_country_code:
          type: string
          description: >-
            Region code that matches the specific country calling code if the
            requested phone number type is mobile
          example: US
        mobile_network_code:
          type: string
          description: >-
            National destination code (NDC), with a 0 prefix, if an NDC is found
            and the requested phone number type is mobile
          example: '0866'
        name:
          type: string
          description: >-
            SPID (Service Provider ID) name, if the requested phone number has
            been ported; otherwise, the name of carrier who owns the phone
            number block
          example: Telnyx/4
        type:
          type: string
          description: >-
            A phone number type that identifies the type of service associated
            with the requested phone number
          enum:
            - fixed line
            - mobile
            - voip
            - fixed line or mobile
            - toll free
            - premium rate
            - shared cost
            - personal number
            - pager
            - uan
            - voicemail
            - unknown
          example: voip
        error_code:
          type:
            - string
            - 'null'
          description: Unused
          example: null
        normalized_carrier:
          type: string
          description: If known to Telnyx and applicable, the primary network carrier.
          example: AT&T
    CallerName:
      type: object
      properties:
        caller_name:
          type: string
          description: >-
            The name of the requested phone number's owner as per the CNAM
            database
          example: TELNYX LLC
        error_code:
          type: string
          description: >-
            A caller-name lookup specific error code, expressed as a stringified
            5-digit integer
          example: '10001'
    Portability:
      type: object
      properties:
        lrn:
          type: string
          description: Local Routing Number, if assigned to the requested phone number
          example: '2245701999'
        ported_status:
          type: string
          description: Indicates whether or not the requested phone number has been ported
          enum:
            - 'Y'
            - 'N'
            - ''
          example: 'Y'
        ported_date:
          type: string
          description: ISO-formatted date when the requested phone number has been ported
          example: '2017-10-20'
        ocn:
          type: string
          description: >-
            Operating Company Name (OCN) as per the Local Exchange Routing Guide
            (LERG) database
          example: 073H
        line_type:
          type: string
          description: Type of number
          example: voip
        spid:
          type: string
          description: SPID (Service Provider ID)
          example: 073H
        spid_carrier_name:
          type: string
          description: Service provider name
          example: Telnyx/4
        spid_carrier_type:
          type: string
          description: Service provider type
          example: '3'
        altspid:
          type: string
          description: >-
            Alternative SPID (Service Provider ID). Often used when a carrier is
            using a number from another carrier
          example: 073H
        altspid_carrier_name:
          type: string
          description: Alternative service provider name
          example: Telnyx/4
        altspid_carrier_type:
          type: string
          description: Alternative service provider type
          example: '3'
        city:
          type: string
          description: >-
            City name extracted from the locality in the Local Exchange Routing
            Guide (LERG) database
          example: WAUKEGAN
        state:
          type: string
          example: Illinois
    number-lookup_Error:
      required:
        - code
        - title
      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
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````