---
title: "Trigger a pipeline with a token"
method: POST
path: "/api/v4/projects/{id}/(ref/{ref}/)trigger/pipeline"
tags: ["ci_triggers"]
---

# Trigger a pipeline with a token

`POST /api/v4/projects/{id}/(ref/{ref}/)trigger/pipeline`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/projects/{id}/(ref/{ref}/)trigger/pipeline`
- Auth: none declared

Triggers a pipeline with a token. With a CI/CD job token, the triggered pipeline is a multi-project pipeline. The job that authenticates the request becomes associated with the upstream pipeline, which is visible on the pipeline graph. If you use a trigger token in a job, the job is not associated with the upstream pipeline.

## Path parameters

- `id` string, required
- `ref` string, required

## Request body

- PostApiV4ProjectsIdRefRefTriggerPipeline: Trigger a pipeline with a token
  - `token` string, required: The unique token of trigger or job token
  - `variables` object: The list of variables to be injected into build
  - `inputs` object: The list of inputs to be used to create the pipeline.

## Response `201`

Trigger a pipeline with a token

- APIEntitiesCiPipeline: API_Entities_Ci_Pipeline model
  - `id` integer, required
  - `iid` integer, required
  - `project_id` integer, required
  - `sha` string, required
  - `ref` string, required
  - `status` string, required
  - `source` string, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `web_url` string, required
  - `before_sha` string, required
  - `tag` boolean, required
  - `yaml_errors` string, required
  - `user` APIEntitiesUserBasic, required: API_Entities_UserBasic model
    - `id` integer, required
    - `username` string, required
    - `public_email` string, required
    - `name` string, required
    - `state` string, required
    - `locked` boolean, required
    - `avatar_url` string, required
    - `avatar_path` string
    - `custom_attributes` APIEntitiesCustomAttribute[]
      - `key` string, required
      - `value` string, required
    - `web_url` string, required
  - `started_at` string, date-time, required
  - `finished_at` string, date-time, required
  - `committed_at` string, date-time, required
  - `duration` integer, required: Time spent running in seconds
  - `queued_duration` integer, required: Time spent enqueued in seconds
  - `coverage` number, float, required
  - `detailed_status` DetailedStatusEntity, required
    - `icon` string, required
    - `text` string, required
    - `label` string, required
    - `group` string, required
    - `tooltip` string, required
    - `has_details` boolean, required
    - `details_path` string, required
    - `illustration` object, required
    - `favicon` string, required
    - `action` object
      - `icon` string, required
      - `title` string, required
      - `path` string, required
      - `method` string, required
      - `button_title` string, required
      - `confirmation_message` string, required
  - `archived` boolean, required

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
