Skip to main content
POST
https://{tenantDomain}/api/v2
/
token-exchange-profiles
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;

public partial class Examples
{
    public async Task Example() {
        var client = new ManagementClient(
            token: "<token>"
        );

        await client.TokenExchangeProfiles.CreateAsync(
            new CreateTokenExchangeProfileRequestContent {
                Name = "name",
                SubjectTokenType = "subject_token_type",
                ActionId = "action_id",
                Type = "custom_authentication"
            }
        );
    }

}
package example

import (
context "context"

management "github.com/auth0/go-auth0/management/management"
client "github.com/auth0/go-auth0/management/management/client"
option "github.com/auth0/go-auth0/management/management/option"
)

func do() {
client := client.NewClient(
option.WithToken(
"<token>",
),
)
request := &management.CreateTokenExchangeProfileRequestContent{
Name: "name",
SubjectTokenType: "subject_token_type",
ActionId: "action_id",
Type: management.TokenExchangeProfileTypeEnum(
"custom_authentication",
),
}
client.TokenExchangeProfiles.Create(
context.TODO(),
request,
)
}
package com.example.usage;

import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.tokenexchangeprofiles.requests.CreateTokenExchangeProfileRequestContent;

public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.token("<token>")
.build();

client.tokenExchangeProfiles().create(
CreateTokenExchangeProfileRequestContent
.builder()
.name("name")
.subjectTokenType("subject_token_type")
.actionId("action_id")
.type("custom_authentication")
.build()
);
}
}
<?php

namespace Example;

use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\TokenExchangeProfiles\Requests\CreateTokenExchangeProfileRequestContent;

$client = new Management(
token: '<token>',
);
$client->tokenExchangeProfiles->create(
new CreateTokenExchangeProfileRequestContent([
'name' => 'name',
'subjectTokenType' => 'subject_token_type',
'actionId' => 'action_id',
'type' => 'custom_authentication',
]),
);
from auth0.management import ManagementClient

client = ManagementClient(
token="<token>",
)

client.token_exchange_profiles.create(
name="name",
subject_token_type="subject_token_type",
action_id="action_id",
)
require "auth0"

client = Auth0::Management.new(token: "<token>")

client.token_exchange_profiles.create(
name: "name",
subject_token_type: "subject_token_type",
action_id: "action_id",
type: "custom_authentication"
)
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.tokenExchangeProfiles.create({
name: "name",
subjectTokenType: "subject_token_type",
actionId: "action_id",
type: "custom_authentication",
});
}
main();
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.tokenExchangeProfiles.create({
name: "name",
subjectTokenType: "subject_token_type",
actionId: "action_id",
type: "custom_authentication",
});
}
main();
curl --request POST \
--url https://{tenantDomain}/api/v2/token-exchange-profiles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Token Exchange Profile 1",
"subject_token_type": "<string>",
"action_id": "<string>",
"type": "custom_authentication"
}
'
{
  "id": "<string>",
  "name": "Token Exchange Profile 1",
  "subject_token_type": "<string>",
  "action_id": "<string>",
  "type": "custom_authentication",
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-01-01T00:00:00.000Z"
}

Authorizations

Authorization
string
header
required

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

Body

name
string
default:Token Exchange Profile 1
required

Friendly name of this profile.

Required string length: 3 - 50
subject_token_type
string<url>
required

Subject token type for this profile. When receiving a token exchange request on the Authentication API, the corresponding token exchange profile with a matching subject_token_type will be executed. This must be a URI.

Required string length: 8 - 100
action_id
string
required

The ID of the Custom Token Exchange action to execute for this profile, in order to validate the subject_token. The action must use the custom-token-exchange trigger.

Required string length: 1 - 36
type
enum<string>
required

The type of the profile, which controls how the profile will be executed when receiving a token exchange request.

Available options:
custom_authentication
Required string length: 1 - 21

Response

Token exchange profile successfully created.

id
string<token-exchange-profile-id>

The unique ID of the token exchange profile.

name
string
default:Token Exchange Profile 1

Friendly name of this profile.

Required string length: 3 - 50
subject_token_type
string<url>

Subject token type for this profile. When receiving a token exchange request on the Authentication API, the corresponding token exchange profile with a matching subject_token_type will be executed. This must be a URI.

Required string length: 8 - 100
action_id
string

The ID of the Custom Token Exchange action to execute for this profile, in order to validate the subject_token. The action must use the custom-token-exchange trigger.

Required string length: 1 - 36
type
enum<string>

The type of the profile, which controls how the profile will be executed when receiving a token exchange request.

Available options:
custom_authentication
Required string length: 1 - 21
created_at
string<date-time>
default:2024-01-01T00:00:00.000Z

The time when this profile was created.

updated_at
string<date-time>
default:2024-01-01T00:00:00.000Z

The time when this profile was updated.