Skip to content

Modify a project protected tag

PUT /api/v5/repos/{owner}/{repo}/protected_tags

This endpoint modifies a project protected tag in the specified repository. It can set the tag name and the access level allowed to create it, to control tag creation permissions.

Access token support

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

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)
access_token query string Yes User authorization code

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "description": "Tag name",
      "type": "string"
    },
    "create_access_level": {
      "description": "Access level allowed to create (0: no one; 30: Developer, Maintainer, Administrator; 40: Maintainer, Administrator)",
      "type": "integer",
      "enum": [0, 30, 40]
    }
  },
  "required": ["name", "create_access_level"]
}

Response parameters

Field Type Always returned Nullable Description
name string Yes No Tag name
create_access_level integer Yes No Access level allowed to create (0: no one; 30: Developer, Maintainer, Administrator; 40: Maintainer, Administrator)
create_access_level_desc string Yes No Description of the access level allowed to create

Error responses

400 Invalid parameter

{
  "error": "invalid_request",
  "message": "Parameter name cannot be empty",
  "field": "name"
}

401 Unauthenticated

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

Note: The actual error field names are subject to what the backend returns.

HTTP response status codes

Status code Description
200 Success (OK)
400 Invalid parameter (Bad request)
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)

Request example

Parameter description

The following examples are consistent with the rest of this document: the path parameters owner and repo, the required query parameter access_token, and the required request body fields name and create_access_level are all included.

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

cURL

curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/protected_tags?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -d '{"name": "v1.0.0", "create_access_level": 30}'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/protected_tags?access_token=<token>",
  {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
    body: JSON.stringify({
      name: "v1.0.0",
      create_access_level: 30,
    }),
  }
);

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

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.put(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/protected_tags",
    params={"access_token": "<token>"},
    headers={
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    json={"name": "v1.0.0", "create_access_level": 30},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "name": "v1.0.0",
  "create_access_level": 30,
  "create_access_level_desc": "Developer, Maintainer, Administrator"
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
400 Invalid parameter or the request could not be parsed
403 Access forbidden
404 The request path does not exist
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