POST /api/applications/{applicationId}/roles

Assign API resource roles to the specified application. The API resource roles will be added to the existing API resource roles. Role IDs that are already assigned to the application are silently ignored.

Path parameters

  • applicationId string Required

    The unique identifier of the application.

application/json

Body Required

  • roleIds array[string] Required

    An array of API resource role IDs to assign.

    Minimum length of each is 1.

Responses

  • 201 application/json

    The API resource roles have been assigned to the application successfully.

    Hide response attributes Show response attributes object
    • roleIds array[string] Required

      An array of API resource role IDs requested for assignment.

      Minimum length of each is 1.

    • addedRoleIds array[string] Required

      An array of API resource role IDs newly assigned to the application. Role IDs already attached to the application are silently ignored and not present in this array.

      Minimum length of each is 1.

  • 400

    Bad Request

  • 401

    Unauthorized

  • 403

    Forbidden

  • 404

    Not Found

  • 422

    Unprocessable Content

POST /api/applications/{applicationId}/roles
curl \
 --request POST 'https://[tenant_id].logto.app/api/applications/{applicationId}/roles' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"roleIds":["string"]}'
Request examples
{
  "roleIds": [
    "string"
  ]
}
Response examples (201)
{
  "roleIds": [
    "string"
  ],
  "addedRoleIds": [
    "string"
  ]
}