Documentation:
List code owners
curl --header "Authorization: bearer {your_personal_access_token}" https://api.codeowners.com/api/v1/owners/{org}/{repository}
The endpoint will return an object with a list of collaborators and teams. The Teams and Collaborators are listed only if they are explicitly listed as an owner. The Team members are listed for each team.
Headers:
Authorization: string; Required;
Append the bearer
followed with your personal-access-token
Path parameters:
org : string; Required;
The organization who owns the repository.
repository: string; Required;
The name of the repository.
Response schema:
{
"collaborators": {
"type": array,
"items": {
"type": "Collaborator",
"properties: {
"id": {
"type": integer,
"description": "Id of the user",
},
"login": {
"type": string,
"description": "The username of the user on GitHub"
},
"extId": {
"type": integer,
"description": "The external id of the user, from GitHub"
},
"isActive": {
"type": boolean,
"description": "True if the user still has a valid/active account"
},
"type": {
"type": "User" | "Bot",
"description": "The type of the collaborator, for this endpoint it should always be User until the AI apocalypse."
},
},
},
},
"teams": {
"type": array,
"items": {
"type": "Team",
"properties": {
"id": {
"type": integer,
"description": "Id of the team",
},
"extId": {
"type": integer,
"description": "The external id of the team, from GitHub"
},
"installationId": {
"type": integer,
"description": "The installation id the team is associated with"
},
"name": {
"type": string,
"description": "The name of the team"
},
"slug": {
"type": string,
"description": "The slug of the team, lower cased & hyphenated"
},
"members": {
"type": array,
"items": {
"type": "Collaborator"
}
},
}
}
}
}
Example response:
{
"collaborators": [
{
"id": 5,
"login": "blackwidow",
"extId": 104,
"isActive": true,
"type": "User"
},
{
"id": 6,
"login": "hawkeye",
"extId": 105,
"isActive": true,
"type": "User"
},
],
"teams": [
{
"id": 123,
"extId": 9000,
"installationId": 42,
"name": "The Avengers",
"slug":"the-avengers",
"members": [
{
"id": 1,
"login": "ironman",
"extId": 100,
"isActive": true,
"type": "User"
},
{
"id": 2,
"login": "captainamerica",
"extId": 101,
"isActive": true,
"type": "User"
},
{
"id": 3,
"login": "thor",
"extId": 102,
"isActive": true,
"type": "User"
},
{
"id": 4,
"login": "hulk",
"extId": 103,
"isActive": true,
"type": "User"
},
]
}
]
}