API Reference

The GitForge REST API lets you manage repositories, branches, commits, pull requests, and more programmatically. All endpoints return JSON.

Base URL

https://api.gitforge.dev

All API paths are relative to this base URL. Self-hosted instances use your configured domain.

Authentication

GitForge supports two authentication methods:

Bearer Token

Use a session token or Personal Access Token (PAT) in the Authorization header:

Authorization: Bearer gf_your_personal_access_token

Basic Auth (Git operations)

For Git clone/push/pull over HTTP, use your PAT as the password with any username:

git clone http://x:[email protected]/org/repo.git
Generating a PAT

Go to Settings → Access Tokens in the web dashboard to create a Personal Access Token. Tokens are prefixed with gf_ and support scoped permissions.

Rate Limiting

API requests are rate limited per authenticated user. Current limits:

Tier
Limit
Free
1,000 requests/hour
Pro
5,000 requests/hour
Enterprise
15,000 requests/hour

Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

Endpoints

Repositories

GET/api/repos
POST/api/repos
GET/api/repos/:id
PATCH/api/repos/:id
DELETE/api/repos/:id

Branches

GET/api/repos/:id/branches
POST/api/repos/:id/branches
DELETE/api/repos/:id/branches/:name

Commits

GET/api/repos/:id/commits
GET/api/repos/:id/commits/:sha

Pull Requests

GET/api/repos/:id/prs
POST/api/repos/:id/prs
GET/api/repos/:id/prs/:number
PATCH/api/repos/:id/prs/:number
POST/api/repos/:id/prs/:number/merge

Files & Trees

GET/api/repos/:id/tree/:ref/*path
GET/api/repos/:id/blob/:ref/*path

Webhooks

GET/api/repos/:id/webhooks
POST/api/repos/:id/webhooks
DELETE/api/repos/:id/webhooks/:hookId

Example Requests

List your repositories

Request
curl -s https://api.gitforge.dev/api/repos \
  -H "Authorization: Bearer gf_YOUR_PAT" | jq .

Create a repository

Request
curl -X POST https://api.gitforge.dev/api/repos \
  -H "Authorization: Bearer gf_YOUR_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-project",
    "description": "A new project",
    "visibility": "private",
    "defaultBranch": "main"
  }'

Create a pull request

Request
curl -X POST https://api.gitforge.dev/api/repos/REPO_ID/prs \
  -H "Authorization: Bearer gf_YOUR_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Add new feature",
    "description": "Implements the new feature",
    "sourceBranch": "feature/new-thing",
    "targetBranch": "main"
  }'

Error Responses

Errors return a JSON object with an error field:

Error response
{
  "error": "Repository not found"
}
Status
Meaning
400
Bad request — invalid parameters
401
Unauthorized — missing or invalid token
403
Forbidden — insufficient permissions
404
Not found
429
Rate limited — retry after reset time
Try It Live

Explore and test API endpoints interactively in the browser.

Prefer a Client Library?

Our SDKs wrap the REST API with typed interfaces and handle authentication, pagination, and error handling automatically.

API Reference | GitForge