deploy_resources

Create a deployment

Creates a deployment.

post/api/v4/projects/{id}/deployments

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of the project owned by the authenticated user

Request body

environmentstring required

The name of the environment to create the deployment for

shastring required

The SHA of the commit that is deployed

refstring required

The name of the branch or tag that is deployed

tagboolean required

A boolean that indicates if the deployed ref is a tag (true) or not (false)

status'running' | 'success' | 'failed' | 'canceled' required

The status of the deployment that is created. One of running, success, failed, or canceled

Response

Create a deployment

idinteger required
iidinteger required
refstring required
shastring required
created_atstring date-time required
updated_atstring date-time required
statusstring required
pending_approval_countinteger required

Example response

{
  "id": 41,
  "iid": 1,
  "ref": "main",
  "sha": "99d03678b90d914dbb1b109132516d71a4a03ea8",
  "created_at": "2016-08-11T11:32:35.444Z",
  "updated_at": "2016-08-11T11:32:35.444Z",
  "user": {
    "id": 1,
    "username": "admin",
    "public_email": "john@example.com",
    "name": "Administrator",
    "state": "active",
    "avatar_url": "https://gravatar.com/avatar/1",
    "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
    "custom_attributes": [
      {
        "key": "foo",
        "value": "bar"
      }
    ],
    "web_url": "https://gitlab.example.com/root"
  },
  "environment": {
    "id": 1,
    "name": "deploy",
    "slug": "deploy",
    "external_url": "https://deploy.gitlab.example.com",
    "created_at": "2019-05-25T18:55:13.252Z",
    "updated_at": "2019-05-25T18:55:13.252Z"
  },
  "deployable": {
    "id": 1,
    "status": "waiting_for_resource",
    "stage": "deploy",
    "name": "deploy_to_production",
    "ref": "main",
    "coverage": 98.29,
    "created_at": "2015-12-24T15:51:21.880Z",
    "started_at": "2015-12-24T17:54:30.733Z",
    "finished_at": "2015-12-24T17:54:31.198Z",
    "erased_at": "2015-12-24T18:00:29.728Z",
    "duration": 0.465,
    "queued_duration": 0.123,
    "user": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "commit": {
      "id": "2695effb5807a22ff3d138d593fd856244e155e7",
      "short_id": "2695effb",
      "created_at": "2017-07-26T11:08:53.000+02:00",
      "parent_ids": [
        "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
      ],
      "title": "Initial commit",
      "message": "Initial commit",
      "author_name": "John Smith",
      "author_email": "john@example.com",
      "authored_date": "2012-05-28T04:42:42-07:00",
      "committer_name": "Jack Smith",
      "committer_email": "jack@example.com",
      "committed_date": "2012-05-28T04:42:42-07:00",
      "trailers": {
        "Merged-By": "Jane Doe janedoe@gitlab.com"
      },
      "extended_trailers": {
        "Signed-off-by": [
          "John Doe <johndoe@gitlab.com>",
          "Jane Doe <janedoe@gitlab.com>"
        ]
      },
      "web_url": "https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746"
    },
    "pipeline": {
      "id": 1,
      "iid": 2,
      "project_id": 3,
      "sha": "0ec9e58fdfca6cdd6652c083c9edb53abc0bad52",
      "ref": "feature-branch",
      "status": "success",
      "source": "push",
      "created_at": "2022-10-21T16:49:48.000+02:00",
      "updated_at": "2022-10-21T16:49:48.000+02:00",
      "web_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61"
    },
    "failure_reason": "script_failure",
    "web_url": "https://example.com/foo/bar/-/jobs/1",
    "artifacts_file": {
      "filename": "artifacts.zip",
      "size": 1000
    },
    "artifacts": [
      {
        "file_type": "archive",
        "size": 1000,
        "filename": "artifacts.zip",
        "file_format": "zip"
      }
    ],
    "runner": {
      "id": 8,
      "description": "test-1-20150125",
      "ip_address": "127.0.0.1",
      "active": true,
      "is_shared": true,
      "runner_type": "instance_type",
      "name": "test",
      "online": true,
      "created_by": {
        "id": 1,
        "username": "admin",
        "public_email": "john@example.com",
        "name": "Administrator",
        "state": "active",
        "avatar_url": "https://gravatar.com/avatar/1",
        "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
        "custom_attributes": [
          {
            "key": "foo",
            "value": "bar"
          }
        ],
        "web_url": "https://gitlab.example.com/root"
      },
      "created_at": "2025-05-03T00:00:00.000Z",
      "status": "online",
      "job_execution_status": "idle"
    },
    "runner_manager": {
      "id": 8,
      "system_id": "runner-1",
      "version": "16.11.0",
      "revision": "91a27b2a",
      "platform": "linux",
      "architecture": "amd64",
      "created_at": "2023-10-24T01:27:06.549Z",
      "contacted_at": "2023-10-24T01:27:06.549Z",
      "ip_address": "127.0.0.1",
      "status": "online",
      "job_execution_status": "idle"
    },
    "artifacts_expire_at": "2016-01-19T09:05:50.355Z",
    "tag_list": [
      "ubuntu18",
      "docker runner"
    ]
  },
  "status": "created",
  "approvals": {
    "user": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "status": "approved",
    "created_at": "2022-02-24T20:22:30.097Z",
    "comment": "LGTM"
  },
  "approval_summary": {
    "rules": {
      "deployment_approvals": {
        "user": {
          "id": 1,
          "username": "admin",
          "public_email": "john@example.com",
          "name": "Administrator",
          "state": "active",
          "avatar_url": "https://gravatar.com/avatar/1",
          "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
          "custom_attributes": [
            {
              "key": "foo",
              "value": "bar"
            }
          ],
          "web_url": "https://gitlab.example.com/root"
        },
        "status": "approved",
        "created_at": "2022-02-24T20:22:30.097Z",
        "comment": "LGTM"
      }
    }
  }
}

Changes

No recorded changes to this operation across all 5 revisions of this API.