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

# Delete a messaging hosted number



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/messaging/hosted-numbers.yml delete /messaging_hosted_numbers/{id}
openapi: 3.1.0
info:
  title: Telnyx Messaging Hosted Numbers API
  version: 2.0.0
  description: API for messaging hosted number orders.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /messaging_hosted_numbers/{id}:
    delete:
      tags:
        - Hosted Numbers
      summary: Delete a messaging hosted number
      operationId: DeleteMessagingHostedNumber
      parameters:
        - name: id
          in: path
          description: Identifies the type of resource.
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/MessagingHostedNumberOrderResponse'
        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 messagingHostedNumber = await
            client.messagingHostedNumbers.delete('id');


            console.log(messagingHostedNumber.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_hosted_number = client.messaging_hosted_numbers.delete(
                "id",
            )
            print(messaging_hosted_number.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\tmessagingHostedNumber, err := client.MessagingHostedNumbers.Delete(context.TODO(), \"id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", messagingHostedNumber.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.messaginghostednumbers.MessagingHostedNumberDeleteParams;

            import
            com.telnyx.sdk.models.messaginghostednumbers.MessagingHostedNumberDeleteResponse;


            public final class Main {
                private Main() {}

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

                    MessagingHostedNumberDeleteResponse messagingHostedNumber = client.messagingHostedNumbers().delete("id");
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            messaging_hosted_number =
            telnyx.messaging_hosted_numbers.delete("id")


            puts(messaging_hosted_number)
        - 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 {
              $messagingHostedNumber = $client->messagingHostedNumbers->delete('id');

              var_dump($messagingHostedNumber);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx messaging-hosted-numbers delete \
              --api-key 'My API Key' \
              --id id
components:
  responses:
    MessagingHostedNumberOrderResponse:
      description: Successful response with details about a messaging hosted number order.
      content:
        application/json:
          schema:
            type: object
            title: Retrieve Messaging Hosted Number Order Response
            properties:
              data:
                $ref: '#/components/schemas/MessagingHostedNumberOrder'
    messaging_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/messaging_Errors'
  schemas:
    MessagingHostedNumberOrder:
      type: object
      example:
        id: 86f58db9-0fe3-4adc-9d1f-46e66e6e9323
        record_type: messaging_hosted_number_order
        messaging_profile_id: dc8f39ac-953d-4520-b93b-786ae87db0da
        status: pending
        phone_numbers:
          - record_type: messaging_hosted_number
            id: bf6307bd-884d-4c1f-b6ea-c62b8c495d3c
            phone_number: '+18665550001'
            status: pending
          - record_type: messaging_hosted_number
            id: 464bd54e-a328-4b11-a131-28e6793cb6f2
            phone_number: '+18665550002'
            status: pending
      properties:
        record_type:
          type: string
          example: messaging_hosted_number_order
          description: Identifies the type of the resource.
          readOnly: true
        id:
          type: string
          format: uuid
          description: Resource unique identifier.
          readOnly: true
        messaging_profile_id:
          type:
            - string
            - 'null'
          description: >-
            Automatically associate the number with this messaging profile ID
            when the order is complete.
        status:
          type: string
          enum:
            - carrier_rejected
            - compliance_review_failed
            - deleted
            - failed
            - incomplete_documentation
            - incorrect_billing_information
            - ineligible_carrier
            - loa_file_invalid
            - loa_file_successful
            - pending
            - provisioning
            - successful
        phone_numbers:
          type: array
          items:
            $ref: '#/components/schemas/HostedNumber'
    messaging_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/messaging_Error'
    HostedNumber:
      example:
        record_type: messaging_hosted_number
        id: bf6307bd-884d-4c1f-b6ea-c62b8c495d3c
        phone_number: '+18665550001'
        status: successful
      type: object
      properties:
        record_type:
          type: string
          example: messaging_hosted_number
        id:
          type: string
          format: uuid
          description: Identifies the type of resource.
          readOnly: true
        phone_number:
          type: string
          x-format: +E.164
          description: The messaging hosted phone number (+E.164 format)
        status:
          type: string
          enum:
            - deleted
            - failed
            - failed_activation
            - failed_carrier_rejected
            - failed_ineligible_carrier
            - failed_number_already_hosted
            - failed_number_not_found
            - failed_ownership_verification
            - failed_timeout
            - pending
            - provisioning
            - successful
    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

````