API Overview

The .git API provides programmatic access to repositories, deployments, and team resources. All endpoints return JSON and require authentication via Bearer tokens. The API follows RESTful conventions and uses standard HTTP status codes.

Base URL: https://api.git.dev/v1

Authentication

Authenticate your requests using a Personal Access Token (PAT) or OAuth2 token. Include the token in the `Authorization` header:

Authorization: Bearer <YOUR_API_TOKEN>

Generate tokens via your dashboard under Settings → API → Tokens. Tokens expire after 90 days unless marked permanent.

Rate Limits

API requests are limited to prevent abuse. Limits vary by plan:

PlanRequests/minBurst
Starter6020
Pro600100
EnterpriseCustomCustom

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

List Repositories

GET /v1/repositories

Returns a paginated list of repositories accessible to the authenticated user.

Query Parameters

ParameterTypeRequiredDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (max: 100)
sortstringSort by: created, updated, name

Example Response (200 OK)

{ "data": [ { "id": "repo_8f3k29d", "name": "frontend-app", "full_name": "acme/frontend-app", "visibility": "private", "created_at": "2024-11-15T08:22:00Z", "default_branch": "main" } ], "meta": { "total": 42, "page": 1, "per_page": 10 } }

Create Deployment

POST /v1/repositories/{repo_id}/deployments

Triggers a new deployment pipeline for the specified repository. Returns immediately with a deployment ID.

Path Parameters

ParameterTypeRequiredDescription
repo_idstringYesRepository slug or ID

Body Parameters

ParameterTypeRequiredDescription
refstringYesBranch, tag, or commit SHA
environmentstringTarget environment: preview, staging, production
variablesobjectKey-value pairs for build env vars

Example Request

curl -X POST https://api.git.dev/v1/repositories/repo_8f3k29d/deployments \\ -H "Authorization: Bearer $TOKEN" \\ -H "Content-Type: application/json" \\ -d '{ "ref": "main", "environment": "production" }'

Example Response (201 Created)

{ "id": "deploy_9x2m4p", "status": "queued", "url": "https://api.git.dev/v1/deployments/deploy_9x2m4p", "created_at": "2024-12-01T14:30:00Z" }

Error Codes

.git uses standard HTTP status codes to indicate success or failure. Error responses include a JSON body with details:

CodeMeaning
400Bad Request – Invalid parameters
401Unauthorized – Missing or invalid token
403Forbidden – Insufficient permissions
404Not Found – Resource doesn't exist
429Too Many Requests – Rate limit exceeded
500Internal Server Error – Try again later
{ "error": { "code": "invalid_ref", "message": "Branch 'feature-x' not found", "request_id": "req_7a2b9c" } }