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

const client = new Telnyx();

const response = await client.oauth.register();

console.log(response.client_id);
from telnyx import Telnyx

client = Telnyx()
response = client.oauth.register()
print(response.client_id)
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"),
)
response, err := client.OAuth.Register(context.TODO(), telnyx.OAuthRegisterParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ClientID)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.oauth.OAuthRegisterParams;
import com.telnyx.sdk.models.oauth.OAuthRegisterResponse;

public final class Main {
private Main() {}

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

OAuthRegisterResponse response = client.oauth().register();
}
}
require "telnyx"

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

response = telnyx.oauth.register

puts(response)
<?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 {
$response = $client->oauth->register(
clientName: 'My OAuth Application',
grantTypes: ['authorization_code'],
logoUri: 'https://example.com',
policyUri: 'https://example.com',
redirectUris: ['https://example.com/callback'],
responseTypes: ['string'],
scope: 'admin',
tokenEndpointAuthMethod: 'none',
tosUri: 'https://example.com',
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx oauth register \
--api-key 'My API Key'
curl --request POST \
--url https://api.telnyx.com/v2/oauth/register \
--header 'Content-Type: application/json' \
--data '
{
"redirect_uris": [
"https://example.com/callback"
],
"client_name": "My OAuth Application",
"grant_types": [
"authorization_code"
],
"response_types": [
"code"
],
"scope": "admin",
"token_endpoint_auth_method": "client_secret_basic",
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>"
}
'
{
  "client_id": "abc123def456",
  "client_id_issued_at": 123,
  "client_secret": "<string>",
  "redirect_uris": [
    "<string>"
  ],
  "client_name": "<string>",
  "grant_types": [
    "<string>"
  ],
  "response_types": [
    "<string>"
  ],
  "scope": "<string>",
  "token_endpoint_auth_method": "<string>",
  "logo_uri": "<string>",
  "tos_uri": "<string>",
  "policy_uri": "<string>"
}
{
"error": "invalid_client_metadata",
"error_description": "The client metadata was invalid",
"invalid_fields": {}
}

Body

application/json
redirect_uris
string<uri>[]

Array of redirection URI strings for use in redirect-based flows

Example:
["https://example.com/callback"]
client_name
string

Human-readable string name of the client to be presented to the end-user

Example:

"My OAuth Application"

grant_types
enum<string>[]

Array of OAuth 2.0 grant type strings that the client may use

Available options:
authorization_code,
client_credentials,
refresh_token
response_types
string[]

Array of the OAuth 2.0 response type strings that the client may use

scope
string

Space-separated string of scope values that the client may use

Example:

"admin"

token_endpoint_auth_method
enum<string>
default:client_secret_basic

Authentication method for the token endpoint

Available options:
none,
client_secret_basic,
client_secret_post
logo_uri
string<uri>

URL of the client logo

tos_uri
string<uri>

URL of the client's terms of service

policy_uri
string<uri>

URL of the client's privacy policy

Response

Client registered successfully

client_id
string
required

Unique client identifier

Example:

"abc123def456"

client_id_issued_at
integer
required

Unix timestamp of when the client ID was issued

client_secret
string

Client secret (only for confidential clients)

redirect_uris
string<uri>[]

Array of redirection URIs

client_name
string

Human-readable client name

grant_types
string[]

Array of allowed grant types

response_types
string[]

Array of allowed response types

scope
string

Space-separated scope values

token_endpoint_auth_method
string

Token endpoint authentication method

logo_uri
string<uri>

URL of the client logo

tos_uri
string<uri>

URL of the client's terms of service

policy_uri
string<uri>

URL of the client's privacy policy