Skip to Content
ZITADEL Docs
APIsCore ResourcesV2Role Assignment

Create Role Assignment

Note: Authorization in this context refers to role assignments, not to OAuth authorization.

CreateAuthorization creates a new authorization for a user in an owned or granted project.

Required permissions:

  • "user.grant.write"
POST
/zitadel.authorization.v2.AuthorizationService/CreateAuthorization

Header Parameters

Connect-Protocol-Version*1

Define the version of the Connect protocol

Value in1
Connect-Timeout-Ms?Connect-Timeout-Ms

Define the timeout, in ms

Request Body

application/json
  1. body
userId*user_id

UserID is the ID of the user who should be granted the authorization.

projectId*project_id

Project ID is the ID of the project the user should be authorized for.

organizationId*organization_id

OrganizationID is the ID of the organization on which the authorization should be created. The organization must either own the project or have a grant for the project.

roleKeys?array<string>

RoleKeys are the keys of the roles the user should be granted.

Response Body

Success

application/json
  1. response
id?id

ID is the unique identifier of the newly created authorization.

creationDate?creation_date

CreationDate is the timestamp when the authorization was created.

Formatdate-time
Example Request
curl -X POST 'https://example.com/zitadel.authorization.v2.AuthorizationService/CreateAuthorization' \  -H 'Connect-Protocol-Version: 1' \  -H 'Content-Type: application/json' \  -d '{  "userId": "string",  "projectId": "string",  "organizationId": "string"}'
Example Response
{  "id": "string",  "creationDate": "2023-01-15T01:30:15.01Z"}

Was this page helpful?