Skip to main content
DELETE
/
messaging_hosted_numbers
/
{id}
JavaScript
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);
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)
package main

import (
	"context"
	"fmt"

	"github.com/team-telnyx/telnyx-go"
	"github.com/team-telnyx/telnyx-go/option"
)

func main() {
	client := telnyx.NewClient(
		option.WithAPIKey("My API Key"),
	)
	messagingHostedNumber, err := client.MessagingHostedNumbers.Delete(context.TODO(), "id")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", messagingHostedNumber.Data)
}
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");
    }
}
require "telnyx"

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

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

puts(messaging_hosted_number)
<?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();
}
telnyx messaging-hosted-numbers delete \
  --api-key 'My API Key' \
  --id id
curl --request DELETE \
  --url https://api.telnyx.com/v2/messaging_hosted_numbers/{id} \
  --header 'Authorization: Bearer <token>'
{
  "data": {
    "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"
      }
    ]
  }
}
{
  "errors": [
    {
      "code": "<string>",
      "title": "<string>",
      "detail": "<string>",
      "source": {
        "pointer": "<string>",
        "parameter": "<string>"
      },
      "meta": {}
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Identifies the type of resource.

Response

Successful response with details about a messaging hosted number order.

data
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"
    }
  ]
}