Michał Wójcik
10/03/2025, 12:08 PMcurl -X PUT "<https://api.permit.io/v2/facts/default/dev/users/Test@Test.com>" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer xxx" \
-d '{
"key": "<mailto:Test@Test.com|Test@Test.com>",
"email": "<mailto:Test@Test.com|Test@Test.com>",
"first_name": "Jane",
"last_name": "Doe",
"attributes": {
"department": "marketing",
"age": 30,
"subscription": {}
},
"role_assignments": [
{
"role": "application#Trade",
"tenant": "default"
}
]
}'
response
{
"id": "4826aa77c24042a4bd4ca460ff37ddd7",
"title": "We could not find the requested object/s",
"error_code": "NOT_FOUND",
"message": "The requested data could not be found, we could not find 'Role' with the given filters: id='application#Trade'. Please try again with different filters.\nIf you are sure there is an object with the given filters, contact our support on Slack for further guidance.",
"additional_info": {
"filters": {
"id": "application#Trade"
}
}
}
Role exist in the project.Ask Inkeep
10/03/2025, 12:08 PMAsk Inkeep
10/03/2025, 12:08 PMApplication#Trade) directly through the user update endpoint, but resource-level roles require a resource_instance to be specified. (1)
For resource-level roles, you need to use the role assignments endpoint instead. Here's how to properly assign a resource-level role:
await permit.api.roleAssignments.assign({
role: "Marketer",
tenant: "default",
resource_instance: `Dashboard:${dashboard.id}`,
user: "auth0|elon",
}) ;
Or using cURL:
curl '<https://api.permit.io/v2/facts/{proj_id}/{env_id}/role_assignments>' \
--request POST \
--data '{
"user": "<mailto:jane@coolcompany.com|jane@coolcompany.com>",
"role": "admin",
"tenant": "stripe-inc"
}'Ask Inkeep
10/03/2025, 12:08 PMOr Weis
10/03/2025, 12:32 PMAsk Inkeep
10/03/2025, 12:33 PM