Body
Required
-
tenantId
string Maximum length is
21
. -
name
string Required The name of the role. It should be unique within the tenant.
Minimum length is
1
, maximum length is128
. -
description
string Required Minimum length is
1
, maximum length is128
. -
type
string The type of the role. It cannot be changed after creation.
Values are
User
orMachineToMachine
. -
isDefault
boolean -
scopeIds
array[string] The initial API resource scopes assigned to the role.
Minimum length of each is
1
.
POST
/api/roles
curl \
--request POST 'https://[tenant_id].logto.app/api/roles' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"tenantId":"string","name":"string","description":"string","type":"User","isDefault":true,"scopeIds":["string"]}'
Request examples
{
"tenantId": "string",
"name": "string",
"description": "string",
"type": "User",
"isDefault": true,
"scopeIds": [
"string"
]
}
Response examples (200)
{
"tenantId": "string",
"id": "string",
"name": "string",
"description": "string",
"type": "User",
"isDefault": true
}