List codebases
Every repository connected to Mode, oldest first. hasAccess is false when the plan does not include Mode, which takes Pro. Codebases are connected in the dashboard, under Mode.
GET
/codebasesAuthorization
AuthorizationBearer token · headerrequired`MEDIAN_KEY` from Settings under API, or an MCP OAuth access token. A key acts as the organization; a token acts as the person who approved it.
Responses
200The codebases.
hasAccessbooleancodebasesCodebase[]Show propertiesHide properties
Array of
CodebaseidstringownerstringrepostringdefaultBranchstringexcludedstring[]Folders and patterns Mode never reads, in gitignore style.
snapshotobject | nullThe copy code search reads, once one has been taken.
Show propertiesHide properties
shastringfilesintegerbytesintegerskippedintegerFiles left out for being binary, generated, huge or excluded.
takenAtintegerisCopyingbooleanerrorstring | nullWhy the last copy failed, or what it left out.
401The bearer token is missing, revoked, or expired.
errorobjectShow propertiesHide properties
codestringmessagestring429Too many requests. Wait the seconds in `Retry-After`. Limits depend on the plan. See [rate limits](/api/errors-and-limits#rate-limits).
errorobjectShow propertiesHide properties
codestringmessagestringRequest
curl -X GET "https://api.median.sh/v1/codebases" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://api.median.sh/v1/codebases", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_TOKEN"
}
});Response
{
"hasAccess": true,
"codebases": [
{
"id": "string",
"owner": "string",
"repo": "string",
"defaultBranch": "string",
"excluded": [
"string"
],
"snapshot": {
"sha": "string",
"files": 0,
"bytes": 0,
"skipped": 0,
"takenAt": 0
},
"isCopying": true,
"error": "string"
}
]
}{
"error": {
"code": "string",
"message": "string"
}
}{
"error": {
"code": "string",
"message": "string"
}
}