Coregit
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.

FieldRequiredDescription
pathYesFile path (no traversal)
contentNoFile content (required unless deleting)
encodingNoutf-8 (default) or base64
actionNoSet to "delete" to remove the file

Fields

  • branch — Target branch name
  • message — Commit message
  • author{ name, email } for the commit author
  • parent_sha — (optional) Expected head SHA for CAS conflict detection
  • changes[].encodingutf-8 (default) or base64 for binary files

Limits

  • Max 1,000 files per commit
  • Max 10 MB per file

List Commits

GET /v1/repos/:slug/commits?ref=main&limit=20
  • ref (or branch) — 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/:sha

Response 200:

{
  "sha": "7f3b...",
  "message": "Add login page",
  "tree": "a1c2...",
  "author_name": "Agent",
  "author_email": "agent@example.com",
  "timestamp": 1704067200,
  "parents": ["abc1..."]
}

On this page