Repos API
Hosted repositories, repository creation, platform credential binding, deploy URLs, and repository workspaces.
/api/repos manages "the relationship between repositories and platforms". The endpoints that read and write code, Issues, and PRs are documented in the Git Repos API.
Endpoints
Repository reads
| Method | Path | Purpose | Authentication |
|---|---|---|---|
GET |
/api/repos/managed |
List hosted repositories | dual |
GET |
/api/repos/member |
List member repositories | dual |
GET |
/api/repos/{owner}/{repo}/project-info |
Project information | dual |
GET |
/api/repos/{owner}/{repo}/scene-recommend-config |
Scene recommendation configuration | dual |
PUT |
/api/repos/favorite |
Favorite a repository (pinned in lists) | User-level |
DELETE |
/api/repos/favorite |
Remove a favorite | User-level |
Repository management
| Method | Path | Purpose | Authentication |
|---|---|---|---|
POST |
/api/repos/sync |
Sync repository | dual |
GET |
/api/repos/check-name |
Validate repository name | User-level |
POST |
/api/repos/create |
Create repository | User-level |
POST |
/api/repos/host |
Host repository | User-level |
POST |
/api/repos/{owner}/{repo}/repair-host |
Repair hosting | User-level |
POST |
/api/repos/{owner}/{repo}/vcs-health/reset |
Reset repo VCS breaker | User-level |
POST |
/api/repos/remove |
Remove hosting | User-level |
PUT |
/api/repos/{owner}/{repo}/scene-recommend-config |
Save scene recommendation configuration | User-level |
PUT |
/api/repos/{owner}/{repo}/default-scene |
Set the repository default Scene | User-level |
Credentials and URLs
| Method | Path | Purpose | Authentication |
|---|---|---|---|
GET |
/api/repos/{owner}/{repo}/git-credential |
One-time git credential | session_only |
GET |
/api/repos/{owner}/{repo}/workspace |
Repository workspace path | session_only |
GET |
/api/repos/bot-token/{owner}/{repo_name} |
Query bot token status | User-level |
PUT |
/api/repos/bot-token |
Set bot token | User-level |
PUT |
/api/repos/{owner}/{repo_name}/bot-token |
Bind a repository bot token explicitly | User-level |
GET |
/api/repos/deploy-url/{owner}/{repo_name} |
Get deploy URL | User-level |
PUT |
/api/repos/deploy-url |
Set deploy URL | User-level |
Platform connection and migration
| Method | Path | Purpose | Authentication |
|---|---|---|---|
GET |
/api/repos/create-targets |
Namespaces available for repository creation | User-level |
GET |
/api/repos/{provider}/connection |
Query platform PAT status | User-level |
PUT |
/api/repos/{provider}/connection |
Save platform PAT | User-level |
DELETE |
/api/repos/{provider}/connection |
Clear platform PAT | User-level |
GET |
/api/repos/migrate-orgs |
Organizations available for migration | User-level |
POST |
/api/repos/migrate |
Migrate repository to another organization | User-level |
"User-level" means a grape_ API key or a web JWT; session_only accepts tk_ only.
Common operations
View hosted repositories
curl -fsS -H @~/.grape.auth "$GRAPE_BASE_URL/api/repos/managed"
Returns the hosted repositories visible to the current user. Fields follow the actual response from the endpoint.
Host a repository
POST /api/repos/host
Content-Type: application/json
Provide fields such as provider, owner, and repo in the request body according to the platform. After hosting succeeds, the repository appears in the managed list and participates in Webhook events.
Platform credentials
GET /api/repos/{provider}/connection
PUT /api/repos/{provider}/connection
DELETE /api/repos/{provider}/connection
Use these endpoints to query, save, and clear the PAT for a Git platform. provider is the platform identifier, not the repository name.
One-time git credential
GET /api/repos/{owner}/{repo}/git-credential
Available only to tk_ sessions. Returns a short-lived credential for an Agent to clone or push within a task. Do not write the result to logs.
Takeover uses a separate credential path: a takeover session gets a tko_ token that only works through the Git proxy, so the server must have GRAPE_GIT_PROXY_BASE configured. Without it, the takeover token cannot obtain a usable git credential.
Workspace path
GET /api/repos/{owner}/{repo}/workspace
Available only to tk_ sessions. Returns the repository workspace path for the current task.
Common errors
| Status | Cause |
|---|---|
| 400 | Missing parameter, invalid repository name, or platform token not configured |
| 401 | Unauthenticated |
| 403 | tk_ used to call a User-level endpoint, or grape_ used to call a session endpoint |
| 404 | Repository does not exist or is not hosted |
| 502 | Request to the upstream Git platform failed |
Related
Git Repos API | Code platform integration | Authentication and credentials