Give a member access, or change it
const url = 'http://localhost:3000/api/v1/grants';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"user":"example","resource":"organization","resourceId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","scope":"read"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/v1/grants \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "user": "example", "resource": "organization", "resourceId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "scope": "read" }'A scope on the organization (its admins only), a project, a collection or one asset (admins of the project), held by a member (user) or a group (group). Grants add up and reach down. Only for people already in the organization; invite anyone else. With project, a share: another project of the organization reads a brand, collection or asset where it is (admin on it shares it).
Any caller; the scope needed is checked on what it acts on.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
A member’s user id, from /api/v1/members
What the grant is on; it reaches everything inside it
The organization’s, project’s, collection’s or asset’s id
object
A group’s id, from /api/v1/groups: each of its members has the grant
What the grant is on; it reaches everything inside it
The organization’s, project’s, collection’s or asset’s id
object
A share: another project of the organization, by id or slug. Its members read the brand, collection or asset where it is
A share is always read: edits happen in its own project
Responses
Section titled “Responses”The grant, or the share
object
Example
{ "data": { "resource": "organization", "scope": "read" }}default
Section titled “default”An error
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "detail": "example" }}