Skip to content

Delete a protected branch rule

DELETE /api/v5/repos/{owner}/{repo}/branches/{wildcard}/setting

Deletes the protected branch rule of the specified branch in the specified repository. On success it returns an empty response body; if the branch has no protection rule, it returns an error message.

Supported access tokens

  • AtomGit user access tokens

Anonymous access allowed

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Namespace address to which the repository belongs (address path of the organization or user)
repo path string Yes Repository path (path)
wildcard path string Yes Branch name
access_token query string Yes User authorization code

Response parameters

On successful deletion this endpoint returns an empty response body ({}) with no business fields.

Error response

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

404 Resource does not exist

{
  "error": "not_found",
  "message": "No matching protected branch rule found"
}

Note: Error field names follow what the backend actually returns; the examples above are for reference only.

HTTP status codes

Status code Description
200 Success (OK)
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)
404 Resource does not exist (Not found)

Request example

Parameter notes

Replace <owner> with the namespace address to which the repository belongs (address path of the organization or user); replace <repo> with the repository path (path); replace <wildcard> with the branch name; replace <token> with your AtomGit user access token.

cURL

curl -X DELETE 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/branches/<wildcard>/setting?access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/branches/<wildcard>/setting?access_token=<token>",
  {
    method: "DELETE",
    headers: {
      "Accept": "application/json",
    },
  },
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

Python

import requests

resp = requests.delete(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/branches/<wildcard>/setting",
    params={"access_token": "<token>"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

Response example

Status code: 200

{}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
404 Resource does not exist
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc