/end-user-role-grantsGrant End User Role
Grants a project-level role to an end-user, creating a eur_-prefixed role grant record.
The role must be within the project's configured role ladder (minimum PROJECT_END_USER).
Role grants are privilege-escalation operations and require a checker by default under the Maker-Checker policy framework.
Requires PROJECT_ADMIN authority.
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
| endUserId * | string | The end user to grant the role to ( An id with no end user in this project gets 404 |
| role * | string | The role name, as your application defines it. The platform does not check it against a list. An end user holds each role at most once: granting a role they already hold gets 400 |
| HTTP | K9O Code | Description |
|---|---|---|
| 200 | Success | |
| 401 | K9O_SESSION_EXPIRED | Your session has expired; sign in again to continue. |
| 403 | K9O_ACCESS_DENIED | You do not hold the required role to grant roles to end-users. |
| 404 | K9O_END_USER_NOT_FOUND | The specified end-user does not exist in this project. |
| data * | object | The grant that was created. |
| grant * | object | An active role grant. |
| id * | string | The grant's id ( Use it to revoke the grant. |
| endUserId * | string | The end user who holds the role ( |
| role * | string | The role name. |
| grantedAt * | string <date-time> | When the role was granted. |
| grantedBy * | string | Who granted it: the subject id of the caller that made the grant (an operator's user id, |
| meta * | any | Request metadata: cost, timing and the request and trace ids. |
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.endUsers.roleGrants.grant({
endUserId: 'string',
role: 'string'
})Showing example in TypeScript
{
"endUserId": "string",
"role": "string"
}{
"data": {
"grant": {
"id": "string",
"endUserId": "string",
"role": "string",
"grantedAt": "string",
"grantedBy": "string"
}
}
}