API reference
Every endpoint of the Git API, its authentication and its errors.
On this page
- Repositories and code
- Get a repository
- Create a repository
- A file or a folder
- Branches
- Protect a branch
- Report a check
- Pull requests and issues
- Open a pull request
- Review
- Merge
- Open an issue
- Link use cases
- History of a case
- Access, hooks and moves
- Add an SSH key
- Add a deploy key
- Create a webhook
- Import from GitHub
- Set up a mirror
- Errors
Base address: https://git.api.sypnia.com/v1. Authentication: Authorization: Bearer <token>, a Sypnia token or an HTTPS token. Paths and payloads follow GitHub’s REST API wherever there is an equivalent.
Repositories and code
Get a repository
GET
/v1/repos/{owner}/{repo} Cloud Create a repository
POST
/v1/orgs/{org}/repos Cloud { name, visibility }.A file or a folder
GET
/v1/repos/{owner}/{repo}/contents/{path} Cloud ?ref=.Branches
GET
/v1/repos/{owner}/{repo}/branches Cloud Protect a branch
PUT
/v1/repos/{owner}/{repo}/branches/{branch}/protection Cloud Report a check
POST
/v1/repos/{owner}/{repo}/statuses/{sha} Cloud { state, context, target_url?, description? }.Pull requests and issues
Open a pull request
POST
/v1/repos/{owner}/{repo}/pulls Cloud { head, base, title, body, draft? }.Review
POST
/v1/repos/{owner}/{repo}/pulls/{n}/reviews Cloud { event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT", body, comments? }.Merge
PUT
/v1/repos/{owner}/{repo}/pulls/{n}/merge Cloud { method: "merge" | "squash" | "rebase" }. 403 protected_branch when the rules are not met.Open an issue
POST
/v1/repos/{owner}/{repo}/issues Cloud { title, body, labels?, cases? }.Link use cases
PUT
/v1/repos/{owner}/{repo}/issues/{n}/cases Cloud { cases: ["place-order"] }.History of a case
GET
/v1/repos/{owner}/{repo}/commits?case={id} EngineCloud The commits whose
Case: trailer names the case, newest first, each with its pull request and whether it is on the default branch; since and until narrow the range.Access, hooks and moves
Add an SSH key
POST
/v1/user/keys Cloud Add a deploy key
POST
/v1/repos/{owner}/{repo}/keys Cloud { key, read_only }.Create a webhook
POST
/v1/repos/{owner}/{repo}/hooks Cloud { url, secret, events }.Import from GitHub
POST
/v1/imports Cloud { source: "github", repository }; follow with GET /v1/imports/{id}.Set up a mirror
POST
/v1/repos/{owner}/{repo}/mirrors Cloud { target: "github", repository }: a read-only copy on GitHub, updated on every push. DELETE on the same path stops it.Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | no token, or an expired one |
| 403 | forbidden, protected_branch | your role does not allow it; a branch rule blocks it |
| 404 | not_found | it does not exist, or you cannot see it |
| 409 | conflict | the branch moved; merge conflicts |
| 422 | invalid_request | a field is missing or wrong |
| 429 | rate_limited | too many requests |