Skip to content
Median
Esc
↑↓navigate↵open⌘Jpreview

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/codebases
Authorization
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.
hasAccessboolean
codebasesCodebase[]
Show properties
Array of Codebase
idstring
ownerstring
repostring
defaultBranchstring
excludedstring[]
Folders and patterns Mode never reads, in gitignore style.
snapshotobject | null
The copy code search reads, once one has been taken.
Show properties
shastring
filesinteger
bytesinteger
skippedinteger
Files left out for being binary, generated, huge or excluded.
takenAtinteger
isCopyingboolean
errorstring | null
Why the last copy failed, or what it left out.
401The bearer token is missing, revoked, or expired.
errorobject
Show properties
codestring
messagestring
429Too many requests. Wait the seconds in `Retry-After`. Limits depend on the plan. See [rate limits](/api/errors-and-limits#rate-limits).
errorobject
Show properties
codestring
messagestring
Request
curl -X GET "https://api.median.sh/v1/codebases" \
  -H "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"
    }
  ]
}