Organizeroles
GET/roles/{role_id}/usage
Where a custom role is granted, as far as you can see.
get_role_usage
role:read
A token needs therole:readscope: See an organization's custom roles and where they are usedGranted byread_api,write_api.Every operation this scope unlocksFiltered across resources
x-gitmoap-isolation: {"kind":"cross_resource_filtered"}
Paginated
Pass thenext_tokena page returns to get the next one.
A grant on a group or repository you cannot see is left out of the page and only counted.
Parameters
Path
- role_idRoleId (string · uuid)Role ID
Query
- limitinteger · int64optionalMaximum number of grants, 1-100 (default 50)
- next_tokenstringoptionalPagination token
Responses
200The role's grants, oldest first, and how many limits name itapplication/json
grantsarray of RoleGrant
- The RoleGrant schema
atAccessScopeWhere the grant was made.
- The AccessScope schema
- full_pathstring
- idstring
- typeScopeTypegrouprepository
- created_atstring · date-time
- grant_idGrantId (string · uuid)
- subjectGrantSubject
- expires_atstring · date-time or nulloptional
- hidden_scopesbooleanWhether the role is also granted somewhere you cannot see. Those places are never named.
- limitsinteger · int64Limits capping someone at this role, across the organization.
- next_tokenstring or nulloptional
200 exampleSynthesized example
{
"grants": [
{
"at": {
"full_path": "acme/payments-api",
"id": "id-16dc",
"type": "group"
},
"created_at": "2026-10-12T07:23:09Z",
"grant_id": "f4996da3-5b54-4e18-9b38-86a35f430f75",
"subject": {
"principal": {
"id": "7acaf528-16a2-4218-acf6-cdb6f2d38886",
"kind": "user",
"username": "mara"
}
}
},
{
"at": {
"full_path": "acme/payments-api",
"id": "id-6881",
"type": "group"
},
"created_at": "2026-10-10T06:53:27Z",
"grant_id": "b42db932-b7c5-4d13-8f4e-93eb3df1f03c",
"subject": {
"principal": {
"id": "bcc5eae0-66f7-4d62-9478-fb3439362a9d",
"kind": "user",
"username": "tomas"
}
}
}
],
"hidden_scopes": false,
"limits": 1,
"next_token": "next-token-62f5"
}
400Invalid pagination tokenapplication/json
Error codes
- BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-5f7a",
"message": "Pin a page's payload to the build that rendered it"
}
}
401Authentication requiredapplication/json
Error codes
- UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-7139",
"message": "Label every synthesized example"
}
}
403The token lacks the scopeapplication/json
Error codes
- FORBIDDENYou are signed in but may not do this here;
reasonnames the permission or the rule that refused it - INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs;
required_scopenames it - PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-c865",
"message": "Stream pipeline status into the run header"
}
}
404Role not foundapplication/json
Error codes
- NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-0a0b",
"message": "Pin a page's payload to the build that rendered it"
}
}
CLI
gitmoap roles get-role-usage
- --role-ididRole ID
- --limitnumberoptionalMaximum number of grants, 1-100 (default 50)
- --next-tokenstringoptionalPagination token