Skip to main content
PATCH
/
short_codes
/
{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 shortCode = await client.shortCodes.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
  messaging_profile_id: 'abc85f64-5717-4562-b3fc-2c9600000000',
});

console.log(shortCode.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
)
short_code = client.short_codes.update(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
messaging_profile_id="abc85f64-5717-4562-b3fc-2c9600000000",
)
print(short_code.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"),
)
shortCode, err := client.ShortCodes.Update(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.ShortCodeUpdateParams{
MessagingProfileID: "abc85f64-5717-4562-b3fc-2c9600000000",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", shortCode.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.shortcodes.ShortCodeUpdateParams;
import com.telnyx.sdk.models.shortcodes.ShortCodeUpdateResponse;

public final class Main {
private Main() {}

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

ShortCodeUpdateParams params = ShortCodeUpdateParams.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.messagingProfileId("abc85f64-5717-4562-b3fc-2c9600000000")
.build();
ShortCodeUpdateResponse shortCode = client.shortCodes().update(params);
}
}
require "telnyx"

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

short_code = telnyx.short_codes.update(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
messaging_profile_id: "abc85f64-5717-4562-b3fc-2c9600000000"
)

puts(short_code)
<?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 {
$shortCode = $client->shortCodes->update(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
messagingProfileID: 'abc85f64-5717-4562-b3fc-2c9600000000',
tags: ['test_customer'],
);

var_dump($shortCode);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx short-codes update \
--api-key 'My API Key' \
--id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
--messaging-profile-id abc85f64-5717-4562-b3fc-2c9600000000
curl --request PATCH \
--url https://api.telnyx.com/v2/short_codes/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messaging_profile_id": "abc85f64-5717-4562-b3fc-2c9600000000",
"tags": [
"test_customer"
]
}
'
{
  "data": {
    "record_type": "short_code",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "short_code": "12345",
    "country_code": "US",
    "messaging_profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "tags": [
      "test_customer"
    ],
    "created_at": "2019-01-23T18:10:02.574Z",
    "updated_at": "2019-01-23T18:10:02.574Z"
  }
}
{
"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<uuid>
required

The id of the short code

Body

application/json

Short code update

messaging_profile_id
string
required

Unique identifier for a messaging profile.

tags
string[]

Response

Successful response with details about a short code.

data
object
Example:
{
"record_type": "short_code",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"short_code": "12345",
"country_code": "US",
"messaging_profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"tags": ["test_customer"],
"created_at": "2019-01-23T18:10:02.574Z",
"updated_at": "2019-01-23T18:10:02.574Z"
}