Skip to main content
POST
/
integration_secrets
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const integrationSecret = await client.integrationSecrets.create({
  identifier: 'my_secret',
  type: 'bearer',
  token: 'my_secret_value',
});

console.log(integrationSecret.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
)
integration_secret = client.integration_secrets.create(
identifier="my_secret",
type="bearer",
token="my_secret_value",
)
print(integration_secret.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"),
)
integrationSecret, err := client.IntegrationSecrets.New(context.TODO(), telnyx.IntegrationSecretNewParams{
Identifier: "my_secret",
Type: telnyx.IntegrationSecretNewParamsTypeBearer,
Token: telnyx.String("my_secret_value"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", integrationSecret.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.integrationsecrets.IntegrationSecretCreateParams;
import com.telnyx.sdk.models.integrationsecrets.IntegrationSecretCreateResponse;

public final class Main {
private Main() {}

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

IntegrationSecretCreateParams params = IntegrationSecretCreateParams.builder()
.identifier("my_secret")
.type(IntegrationSecretCreateParams.Type.BEARER)
.build();
IntegrationSecretCreateResponse integrationSecret = client.integrationSecrets().create(params);
}
}
require "telnyx"

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

integration_secret = telnyx.integration_secrets.create(identifier: "my_secret", type: :bearer)

puts(integration_secret)
<?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 {
$integrationSecret = $client->integrationSecrets->create(
identifier: 'my_secret',
type: 'bearer',
token: 'my_secret_value',
password: 'password',
username: 'username',
);

var_dump($integrationSecret);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx integration-secrets create \
--api-key 'My API Key' \
--identifier my_secret \
--type bearer
curl --request POST \
--url https://api.telnyx.com/v2/integration_secrets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"identifier": "my_secret",
"type": "bearer",
"token": "my_secret_value"
}
'
{
  "data": {
    "record_type": "integration_secret",
    "id": "<string>",
    "identifier": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}
{
"errors": [
{
"detail": "<string>",
"code": "<string>",
"title": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

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

Body

application/json
identifier
string
required

The unique identifier of the secret.

type
enum<string>
required

The type of secret.

Available options:
bearer,
basic
token
string

The token for the secret. Required for bearer type secrets, ignored otherwise.

username
string

The username for the secret. Required for basic type secrets, ignored otherwise.

password
string

The password for the secret. Required for basic type secrets, ignored otherwise.

Response

Successful Response

data
IntegrationSecret · object
required