2020-06-23 00:09:42 +05:30
---
2023-05-27 22:25:52 +05:30
stage: Configure
group: Configure
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-06-23 00:09:42 +05:30
---
2021-11-11 11:23:49 +05:30
# Release links API **(FREE)**
2019-02-15 15:39:39 +05:30
2022-07-23 23:45:48 +05:30
> Support for [GitLab CI/CD job token](../../ci/jobs/ci_job_token.md) authentication [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/250819) in GitLab 15.1.
2022-03-02 08:16:31 +05:30
Use this API to manipulate GitLab [Release ](../../user/project/releases/index.md )
links. For manipulating other Release assets, see [Release API ](index.md ).
2019-02-15 15:39:39 +05:30
2020-04-22 19:07:51 +05:30
GitLab supports links to `http` , `https` , and `ftp` assets.
2019-02-15 15:39:39 +05:30
2023-01-13 00:05:48 +05:30
## List links of a release
2019-02-15 15:39:39 +05:30
2023-01-13 00:05:48 +05:30
Get assets as links from a release.
2019-02-15 15:39:39 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
GET /projects/:id/releases/:tag_name/assets/links
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](../rest/index.md#namespaced-path-encoding ). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
Example request:
2020-03-13 15:44:24 +05:30
```shell
2021-03-08 18:12:59 +05:30
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
[
{
"id":2,
"name":"awesome-v0.2.msi",
"url":"http://192.168.10.15:3000/msi",
2023-04-23 21:23:45 +05:30
"external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
2020-06-23 00:09:42 +05:30
"link_type":"other"
2019-02-15 15:39:39 +05:30
},
{
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
2023-04-23 21:23:45 +05:30
"external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
2020-06-23 00:09:42 +05:30
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
]
```
2023-01-13 00:05:48 +05:30
## Get a release link
2019-02-15 15:39:39 +05:30
2023-01-13 00:05:48 +05:30
Get an asset as a link from a release.
2019-02-15 15:39:39 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
GET /projects/:id/releases/:tag_name/assets/links/:link_id
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](../rest/index.md#namespaced-path-encoding ). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
2020-05-24 23:13:21 +05:30
| `link_id` | integer | yes | The ID of the link. |
2019-02-15 15:39:39 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2021-03-08 18:12:59 +05:30
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
"id":1,
"name":"awesome-v0.2.dmg",
"url":"http://192.168.10.15:3000",
2023-04-23 21:23:45 +05:30
"external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
2020-06-23 00:09:42 +05:30
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
```
2023-01-13 00:05:48 +05:30
## Create a release link
2019-02-15 15:39:39 +05:30
2023-01-13 00:05:48 +05:30
Creates an asset as a link from a release.
2019-02-15 15:39:39 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
POST /projects/:id/releases/:tag_name/assets/links
```
2023-04-23 21:23:45 +05:30
| Attribute | Type | Required | Description |
|----------------------|----------------|----------|---------------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](../rest/index.md#namespaced-path-encoding ). |
| `tag_name` | string | yes | The tag associated with the Release. |
| `name` | string | yes | The name of the link. Link names must be unique in the release. |
| `url` | string | yes | The URL of the link. Link URLs must be unique in the release. |
| `filepath` | string | no | Deprecated: Use `direct_asset_path` instead. |
| `direct_asset_path` | string | no | Optional path for a [direct asset link ](../../user/project/releases/release_fields.md#permanent-links-to-release-assets ). |
| `link_type` | string | no | The type of the link: `other` , `runbook` , `image` , `package` . Defaults to `other` . |
2019-02-15 15:39:39 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2019-02-15 15:39:39 +05:30
curl --request POST \
2021-03-08 18:12:59 +05:30
--header "PRIVATE-TOKEN: < your_access_token > " \
2021-01-29 00:20:46 +05:30
--data name="hellodarwin-amd64" \
--data url="https://gitlab.example.com/mynamespace/hello/-/jobs/688/artifacts/raw/bin/hello-darwin-amd64" \
2023-04-23 21:23:45 +05:30
--data direct_asset_path="/bin/hellodarwin-amd64" \
2021-01-29 00:20:46 +05:30
"https://gitlab.example.com/api/v4/projects/20/releases/v1.7.0/assets/links"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
2021-01-29 00:20:46 +05:30
"id":2,
"name":"hellodarwin-amd64",
"url":"https://gitlab.example.com/mynamespace/hello/-/jobs/688/artifacts/raw/bin/hello-darwin-amd64",
"direct_asset_url":"https://gitlab.example.com/mynamespace/hello/-/releases/v1.7.0/downloads/bin/hellodarwin-amd64",
2023-04-23 21:23:45 +05:30
"external":false, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
2020-06-23 00:09:42 +05:30
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
```
2023-01-13 00:05:48 +05:30
## Update a release link
2019-02-15 15:39:39 +05:30
2023-01-13 00:05:48 +05:30
Updates an asset as a link from a release.
2019-02-15 15:39:39 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
PUT /projects/:id/releases/:tag_name/assets/links/:link_id
```
2023-04-23 21:23:45 +05:30
| Attribute | Type | Required | Description |
| -------------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](../rest/index.md#namespaced-path-encoding ). |
| `tag_name` | string | yes | The tag associated with the Release. |
| `link_id` | integer | yes | The ID of the link. |
| `name` | string | no | The name of the link. |
| `url` | string | no | The URL of the link. |
| `filepath` | string | no | Deprecated: Use `direct_asset_path` instead. |
| `direct_asset_path` | string | no | Optional path for a [direct asset link ](../../user/project/releases/release_fields.md#permanent-links-to-release-assets ). |
| `link_type` | string | no | The type of the link: `other` , `runbook` , `image` , `package` . Defaults to `other` . |
2019-02-15 15:39:39 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2019-02-15 15:39:39 +05:30
You have to specify at least one of `name` or `url`
Example request:
2020-03-13 15:44:24 +05:30
```shell
2021-09-04 01:27:46 +05:30
curl --request PUT --data name="new name" --data link_type="runbook" \
--header "PRIVATE-TOKEN: < your_access_token > " \
"https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
"id":1,
"name":"new name",
"url":"http://192.168.10.15:3000",
2023-04-23 21:23:45 +05:30
"external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
2020-06-23 00:09:42 +05:30
"link_type":"runbook"
2019-02-15 15:39:39 +05:30
}
```
2023-01-13 00:05:48 +05:30
## Delete a release link
2019-02-15 15:39:39 +05:30
2023-01-13 00:05:48 +05:30
Deletes an asset as a link from a release.
2019-02-15 15:39:39 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
DELETE /projects/:id/releases/:tag_name/assets/links/:link_id
```
| Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | --------------------------------------- |
2023-04-23 21:23:45 +05:30
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](../rest/index.md#namespaced-path-encoding ). |
2019-02-15 15:39:39 +05:30
| `tag_name` | string | yes | The tag associated with the Release. |
2020-05-24 23:13:21 +05:30
| `link_id` | integer | yes | The ID of the link. |
2019-02-15 15:39:39 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2021-03-08 18:12:59 +05:30
curl --request DELETE --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1"
2019-02-15 15:39:39 +05:30
```
Example response:
```json
{
"id":1,
"name":"new name",
"url":"http://192.168.10.15:3000",
2023-04-23 21:23:45 +05:30
"external":true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0.
2020-06-23 00:09:42 +05:30
"link_type":"other"
2019-02-15 15:39:39 +05:30
}
```