API Reference
Commits
Create multi-file commits and browse commit history via the API.
Create Commit
This is the core endpoint — create a commit with multiple file changes in a single call.
POST /v1/repos/:slug/commits{
"branch": "main",
"message": "Add homepage and config",
"parent_sha": "abc123...",
"author": { "name": "Agent", "email": "agent@example.com" },
"changes": [
{
"path": "index.html",
"content": "<h1>Hello</h1>"
},
{
"path": "config.json",
"content": "{\"version\": 1}",
"encoding": "utf-8"
},
{
"path": "old-file.txt",
"action": "delete"
}
]
}Changes
Each entry in changes creates or updates a file by default. Set action: "delete" to remove a file.
| Field | Required | Description |
|---|---|---|
path | Yes | File path (no traversal) |
content | No | File content (required unless deleting) |
encoding | No | utf-8 (default) or base64 |
action | No | Set to "delete" to remove the file |
Fields
branch— Target branch namemessage— Commit messageauthor—{ name, email }for the commit authorparent_sha— (optional) Expected head SHA for CAS conflict detectionchanges[].encoding—utf-8(default) orbase64for binary files
Limits
- Max 1,000 files per commit
- Max 10 MB per file
List Commits
GET /v1/repos/:slug/commits?ref=main&limit=20ref(orbranch) — Branch name, tag, or SHA (default: repo's default branch)limit— Max results (default: 20, max: 100)
Response 200:
{
"commits": [
{
"sha": "7f3b...",
"message": "Add login page",
"author_name": "Agent",
"author_email": "agent@example.com",
"timestamp": 1704067200,
"parents": ["abc1..."]
}
],
"ref": "main",
"has_more": false
}Get Commit
GET /v1/repos/:slug/commits/:shaResponse 200:
{
"sha": "7f3b...",
"message": "Add login page",
"tree": "a1c2...",
"author_name": "Agent",
"author_email": "agent@example.com",
"timestamp": 1704067200,
"parents": ["abc1..."]
}