Skip to content

API reference

Every endpoint of the Git API, its authentication and its errors.

Applies to Cloud
View as Markdown
On this page
  1. Repositories and code
  2. Get a repository
  3. Create a repository
  4. A file or a folder
  5. Branches
  6. Protect a branch
  7. Report a check
  8. Pull requests and issues
  9. Open a pull request
  10. Review
  11. Merge
  12. Open an issue
  13. Link use cases
  14. History of a case
  15. Access, hooks and moves
  16. Add an SSH key
  17. Add a deploy key
  18. Create a webhook
  19. Import from GitHub
  20. Set up a mirror
  21. 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
Authentication
repo:read
Create a repository
POST /v1/orgs/{org}/repos Cloud
{ name, visibility }.
Authentication
repo:admin
A file or a folder
GET /v1/repos/{owner}/{repo}/contents/{path} Cloud
?ref=.
Authentication
repo:read
Branches
GET /v1/repos/{owner}/{repo}/branches Cloud
Authentication
repo:read
Protect a branch
PUT /v1/repos/{owner}/{repo}/branches/{branch}/protection Cloud
Authentication
repo:maintain
Report a check
POST /v1/repos/{owner}/{repo}/statuses/{sha} Cloud
{ state, context, target_url?, description? }.
Authentication
repo:write

Pull requests and issues

Open a pull request
POST /v1/repos/{owner}/{repo}/pulls Cloud
{ head, base, title, body, draft? }.
Authentication
repo:write
Review
POST /v1/repos/{owner}/{repo}/pulls/{n}/reviews Cloud
{ event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT", body, comments? }.
Authentication
repo:write
Merge
PUT /v1/repos/{owner}/{repo}/pulls/{n}/merge Cloud
{ method: "merge" | "squash" | "rebase" }. 403 protected_branch when the rules are not met.
Authentication
repo:write
Open an issue
POST /v1/repos/{owner}/{repo}/issues Cloud
{ title, body, labels?, cases? }.
Authentication
repo:triage
Link use cases
PUT /v1/repos/{owner}/{repo}/issues/{n}/cases Cloud
{ cases: ["place-order"] }.
Authentication
repo:triage
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.
Authentication
repo:read

Access, hooks and moves

Add an SSH key
POST /v1/user/keys Cloud
Authentication
user
Add a deploy key
POST /v1/repos/{owner}/{repo}/keys Cloud
{ key, read_only }.
Authentication
repo:admin
Create a webhook
POST /v1/repos/{owner}/{repo}/hooks Cloud
{ url, secret, events }.
Authentication
repo:maintain
Import from GitHub
POST /v1/imports Cloud
{ source: "github", repository }; follow with GET /v1/imports/{id}.
Authentication
repo:admin
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.
Authentication
repo:admin

Errors

StatusCodeWhen
401unauthorizedno token, or an expired one
403forbidden, protected_branchyour role does not allow it; a branch rule blocks it
404not_foundit does not exist, or you cannot see it
409conflictthe branch moved; merge conflicts
422invalid_requesta field is missing or wrong
429rate_limitedtoo many requests
  1. Repositories and code
  2. Get a repository
  3. Create a repository
  4. A file or a folder
  5. Branches
  6. Protect a branch
  7. Report a check
  8. Pull requests and issues
  9. Open a pull request
  10. Review
  11. Merge
  12. Open an issue
  13. Link use cases
  14. History of a case
  15. Access, hooks and moves
  16. Add an SSH key
  17. Add a deploy key
  18. Create a webhook
  19. Import from GitHub
  20. Set up a mirror
  21. Errors

    Search pages, sections and terms