v2

Swagger 2.02026-08-01331211921.0 KB
Refs

Create a tag

Creates a new annotated tag in the specified repository.

The payload of the POST should consist of a JSON document that contains the name of the tag and the target hash.

curl https://api.bitbucket.org/2.0/repositories/jdoe/myrepo/refs/tags \
-s -u jdoe -X POST -H "Content-Type: application/json" \
-d '{
    "name" : "new-tag-name",
    "target" : {
        "hash" : "a1b2c3d4e5f6",
    }
}'

This endpoint does support using short hash prefixes for the commit hash, but it may return a 400 response if the provided prefix is ambiguous. Using a full commit hash is the preferred approach.

A message for the tag object may optionally be provided. If it is omitted or the provided message is empty, a default message of "Added tag <tagname> for changeset <shorthash>" will be used.

post/repositories/{workspace}/{repo_slug}/refs/tags

Request body

typestring required
namestring

The name of the ref.

messagestring

The message associated with the tag, if available.

datestring date-time

The date that the tag was created, if available

Response

The newly created tag.

typestring required
namestring

The name of the ref.

messagestring

The message associated with the tag, if available.

datestring date-time

The date that the tag was created, if available