Create an organization role

POST /api/organization-roles

Create a new organization role with the given data.

application/json

Body Required

  • tenantId string

    Maximum length is 21.

  • name string Required

    The name of the organization role. It must be unique within the organization template.

    Minimum length is 1, maximum length is 128.

  • description string | null

    The description of the organization role.

    Maximum length is 256.

  • type string

    Values are User or MachineToMachine.

  • organizationScopeIds array[string] Required

    An array of organization scope IDs to be assigned to the organization role.

    Default value is [] (empty).

  • resourceScopeIds array[string] Required

    An array of resource scope IDs to be assigned to the organization role.

    Default value is [] (empty).

Responses

  • 201 application/json

    The organization role was created successfully.

    Hide response attributes Show response attributes object
    • tenantId string Required

      Maximum length is 21.

    • id string Required

      Minimum length is 1, maximum length is 21.

    • name string Required

      Minimum length is 1, maximum length is 128.

    • description string | null Required

      Maximum length is 256.

    • type string Required

      Values are User or MachineToMachine.

  • Bad Request

  • Unauthorized

  • Forbidden

  • The organization role name is already in use.

POST /api/organization-roles
curl \
 -X POST https://[tenant_id].logto.app/api/organization-roles \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"tenantId":"string","name":"string","description":"string","type":"User","organizationScopeIds":[],"resourceScopeIds":[]}'
Request examples
{
  "tenantId": "string",
  "name": "string",
  "description": "string",
  "type": "User",
  "organizationScopeIds": [],
  "resourceScopeIds": []
}
Response examples (201)
{
  "tenantId": "string",
  "id": "string",
  "name": "string",
  "description": "string",
  "type": "User"
}