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

const client = new Telnyx({
  apiKey: 'My API Key',
});

const oauthClient = await client.oauthClients.create({
  allowed_grant_types: ['client_credentials'],
  allowed_scopes: ['admin'],
  client_type: 'public',
  name: 'My OAuth client',
});

console.log(oauthClient.data);
{
  "data": {
    "record_type": "oauth_client",
    "client_id": "<string>",
    "name": "<string>",
    "org_id": "<string>",
    "user_id": "<string>",
    "client_type": "public",
    "require_pkce": true,
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "allowed_scopes": [
      "<string>"
    ],
    "allowed_grant_types": [
      "client_credentials"
    ],
    "redirect_uris": [
      "<string>"
    ],
    "logo_uri": "<string>",
    "tos_uri": "<string>",
    "policy_uri": "<string>",
    "client_secret": "<string>"
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json
name
string
required

The name of the OAuth client

Example:

"My OAuth client"

allowed_scopes
string[]
required

List of allowed OAuth scopes

Example:
["admin"]
client_type
enum<string>
required

OAuth client type

Available options:
public,
confidential
allowed_grant_types
enum<string>[]
required

List of allowed OAuth grant types

Available options:
client_credentials,
authorization_code,
refresh_token
require_pkce
boolean
default:false

Whether PKCE (Proof Key for Code Exchange) is required for this client

redirect_uris
string<uri>[]

List of redirect URIs (required for authorization_code flow)

logo_uri
string<uri>

URL of the client logo

policy_uri
string<uri>

URL of the client's privacy policy

tos_uri
string<uri>

URL of the client's terms of service

Response

OAuth client created successfully

data
object