배포 토큰 API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

모든 배포 토큰 목록

Tier: Free, Premium, Ultimate Offering: Self-managed, GitLab Dedicated

GitLab 인스턴스 전체의 모든 배포 토큰 목록을 가져옵니다. 이 엔드포인트는 관리자 액세스가 필요합니다.

GET /deploy_tokens

매개변수:

속성 타입 필수 여부 설명
active boolean 아니오 활성 상태로 제한합니다.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/deploy_tokens"

예시 응답:

[
  {
    "id": 1,
    "name": "MyToken",
    "username": "gitlab+deploy-token-1",
    "expires_at": "2020-02-14T00:00:00.000Z",
    "revoked": false,
    "expired": false,
    "scopes": [
      "read_repository",
      "read_registry"
    ]
  }
]

프로젝트 배포 토큰

프로젝트 배포 토큰 API 엔드포인트는 프로젝트의 Maintainer 역할 이상이 필요합니다.

프로젝트 배포 토큰 목록

프로젝트의 배포 토큰 목록을 가져옵니다.

GET /projects/:id/deploy_tokens

매개변수:

속성 타입 필수 여부 설명
id integer/string 프로젝트의 ID 또는 URL-encoded path.
active boolean 아니오 활성 상태로 제한합니다.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/deploy_tokens"

예시 응답:

[
  {
    "id": 1,
    "name": "MyToken",
    "username": "gitlab+deploy-token-1",
    "expires_at": "2020-02-14T00:00:00.000Z",
    "revoked": false,
    "expired": false,
    "scopes": [
      "read_repository",
      "read_registry"
    ]
  }
]

프로젝트 배포 토큰 가져오기

프로젝트의 특정 배포 토큰을 ID로 가져옵니다.

GET /projects/:id/deploy_tokens/:token_id

매개변수:

속성 타입 필수 여부 설명
id integer/string 인증된 사용자가 소유한 프로젝트의 ID 또는 URL-encoded path
token_id integer 배포 토큰의 ID

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/deploy_tokens/1"

예시 응답:

{
  "id": 1,
  "name": "MyToken",
  "username": "gitlab+deploy-token-1",
  "expires_at": "2020-02-14T00:00:00.000Z",
  "revoked": false,
  "expired": false,
  "scopes": [
    "read_repository",
    "read_registry"
  ]
}

프로젝트 배포 토큰 생성

프로젝트를 위한 새로운 배포 토큰을 생성합니다.

POST /projects/:id/deploy_tokens

매개변수:

속성 타입 필수 여부 설명
id integer/string 인증된 사용자가 소유한 프로젝트의 ID 또는 URL-encoded path
name string 새로운 배포 토큰의 이름
scopes 문자열 배열 배포 토큰 범위를 나타냅니다. 반드시 read_repository, read_registry, write_registry, read_package_registry, 또는 write_package_registry 중 하나 이상이어야 합니다.
expires_at datetime 아니오 배포 토큰의 만료 날짜입니다. 값을 제공하지 않으면 만료되지 않습니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 기대됩니다.
username string 아니오 배포 토큰의 사용자 이름. 기본값은 gitlab+deploy-token-{n}입니다.

예시 요청:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --header "Content-Type: application/json" \
     --data '{"name": "My deploy token", "expires_at": "2021-01-01", "username": "custom-user", "scopes": ["read_repository"]}' \
     "https://gitlab.example.com/api/v4/projects/5/deploy_tokens/"

예시 응답:

{
  "id": 1,
  "name": "My deploy token",
  "username": "custom-user",
  "expires_at": "2021-01-01T00:00:00.000Z",
  "token": "jMRvtPNxrn3crTAGukpZ",
  "revoked": false,
  "expired": false,
  "scopes": [
    "read_repository"
  ]
}

프로젝트 배포 토큰 삭제

프로젝트에서 배포 토큰을 제거합니다.

DELETE /projects/:id/deploy_tokens/:token_id

매개변수:

속성 유형 필수 여부 설명
id 정수/문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL 인코딩된 경로
token_id 정수 배포 토큰의 ID

예시 요청:

curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
    "https://gitlab.example.com/api/v4/projects/5/deploy_tokens/13"

그룹 배포 토큰

그룹의 유지자 역할을 적어도 가진 사용자는 그룹 배포 토큰을 나열할 수 있습니다. 그룹 소유자만 그룹 배포 토큰을 생성하고 삭제할 수 있습니다.

그룹 배포 토큰 나열

그룹의 배포 토큰 목록을 가져옵니다.

GET /groups/:id/deploy_tokens

매개변수:

속성 유형 필수 여부 설명
id 정수/문자열 URL 인코딩된 경로의 그룹 ID
active 부울 아니오 활성 상태로 제한합니다.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/deploy_tokens"

예시 응답:

[
  {
    "id": 1,
    "name": "MyToken",
    "username": "gitlab+deploy-token-1",
    "expires_at": "2020-02-14T00:00:00.000Z",
    "revoked": false,
    "expired": false,
    "scopes": [
      "read_repository",
      "read_registry"
    ]
  }
]

그룹 배포 토큰 가져오기

ID로 단일 그룹의 배포 토큰을 가져옵니다.

GET /groups/:id/deploy_tokens/:token_id

매개변수:

속성 유형 필수 여부 설명
id 정수/문자열 인증된 사용자가 소유한 그룹의 ID 또는 URL 인코딩된 경로
token_id 정수 배포 토큰의 ID

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/deploy_tokens/1"

예시 응답:

{
  "id": 1,
  "name": "MyToken",
  "username": "gitlab+deploy-token-1",
  "expires_at": "2020-02-14T00:00:00.000Z",
  "revoked": false,
  "expired": false,
  "scopes": [
    "read_repository",
    "read_registry"
  ]
}

그룹 배포 토큰 생성

그룹을 위한 새로운 배포 토큰을 생성합니다.

POST /groups/:id/deploy_tokens

매개변수:

속성 유형 필수 여부 설명
id 정수/문자열 인증된 사용자가 소유한 그룹의 ID 또는 URL 인코딩된 경로
name 문자열 새로운 배포 토큰의 이름
scopes 문자열 배열 배포 토큰 범위를 나타냅니다. 반드시 read_repository, read_registry, write_registry, read_package_registry, 또는 write_package_registry 중 하나 이상이어야 합니다.
expires_at 날짜 및 시간 아니오 배포 토큰의 만료 날짜. 값이 제공되지 않으면 만료되지 않습니다. ISO 8601 형식으로 예상됨 (2019-03-15T08:00:00Z)
username 문자열 아니오 배포 토큰을 위한 사용자 이름. 기본값은 gitlab+deploy-token-{n}입니다.

예시 요청:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --header "Content-Type: application/json" \
     --data '{"name": "My deploy token", "expires_at": "2021-01-01", "username": "custom-user", "scopes": ["read_repository"]}' \
     "https://gitlab.example.com/api/v4/groups/5/deploy_tokens/"

예시 응답:

{
  "id": 1,
  "name": "My deploy token",
  "username": "custom-user",
  "expires_at": "2021-01-01T00:00:00.000Z",
  "token": "jMRvtPNxrn3crTAGukpZ",
  "revoked": false,
  "expired": false,
  "scopes": [
    "read_registry"
  ]
}

그룹 배포 토큰 삭제

그룹에서 배포 토큰을 제거합니다.

DELETE /groups/:id/deploy_tokens/:token_id

매개변수:

속성 유형 필수 여부 설명
id integer/string 인증된 사용자가 소유한 그룹의 ID 또는 URL 인코딩된 경로
token_id integer 배포 토큰의 ID

예시 요청:

curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/deploy_tokens/13"