---
title: "Connect a CI service (owners)"
description: "Answers the webhook URL to paste into the service, and its token\n(`webhook_token`), shown this once. For Buildkite: Organization\nSettings, Notification Services, Add, Webhook; the URL; the token,\nsent as `X-Buildkite-Token` or (better) signed as\n`X-Buildkite-Signature`; events `build.*` and `job.*`; the pipelines\nto send. One connection per organization per monorepo. REST calls\nuse the Worker secret `BUILDKITE_API_TOKEN` at launch (the connection\nsays `token: worker_secret`); per-connection tokens are not built yet.\n"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.gitpando.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Pando API › ci

`POST /v1/monorepos/{owner}/{monorepo}/ci/connections`

Answers the webhook URL to paste into the service, and its token
(`webhook_token`), shown this once. For Buildkite: Organization
Settings, Notification Services, Add, Webhook; the URL; the token,
sent as `X-Buildkite-Token` or (better) signed as
`X-Buildkite-Signature`; events `build.*` and `job.*`; the pipelines
to send. One connection per organization per monorepo. REST calls
use the Worker secret `BUILDKITE_API_TOKEN` at launch (the connection
says `token: worker_secret`); per-connection tokens are not built yet.

## Authentication

Requires one of the following:

- `credential`, http, header `Authorization`
- `session`, apiKey, in cookie

## Path parameters

- `createCiConnection.path.owner` (string, required) — The monorepo's owner, a namespace (a person's login or an organization). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$`
- `createCiConnection.path.monorepo` (string, required) — The monorepo's name within its owner (or an old name). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9._]|-(?!-)){0,38}$`

## Request body

_Required._

- `createCiConnection.service` (string, required)
  - one of `"buildkite"`
- `createCiConnection.organization` (string, required) — The organization's slug, as in buildkite.com/<slug>.
- `createCiConnection.webhook_token` (string, optional) — The service's own webhook token, if it made one; else Pando makes one.
  - minLength 16; maxLength 200

## Example request

```json
{
  "service": "buildkite",
  "organization": "string",
  "webhook_token": "stringstringstri"
}
```

## Code samples

### cURL

```curl
curl --request POST \
  --url https://app.gitpando.com/v1/monorepos/string/string/ci/connections \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "service": "buildkite",
  "organization": "string",
  "webhook_token": "stringstringstri"
}
'
```

### TypeScript

```typescript
const url = 'https://app.gitpando.com/v1/monorepos/string/string/ci/connections';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    service: 'buildkite',
    organization: 'string',
    webhook_token: 'stringstringstri'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://app.gitpando.com/v1/monorepos/string/string/ci/connections"

payload = {
    "service": "buildkite",
    "organization": "string",
    "webhook_token": "stringstringstri"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Connected

#### Example

```json
{
  "connection": {
    "id": "string",
    "service": "buildkite",
    "organization": "string",
    "web_url": "string",
    "webhook_url": "string",
    "token": "worker_secret",
    "created_at": "2019-08-24T14:15:22Z",
    "created_by": "string",
    "last_event": {
      "at": "2019-08-24T14:15:22Z",
      "event": "string",
      "result": "string"
    },
    "last_refused": {
      "at": "2019-08-24T14:15:22Z",
      "reason": "string"
    }
  },
  "webhook_token": "string"
}
```

- `createCiConnection.response.201.connection` (object, required)
  - `createCiConnection.response.201.connection.id` (string, required)
  - `createCiConnection.response.201.connection.service` (string, required)
    - one of `"buildkite"`
  - `createCiConnection.response.201.connection.organization` (string, required)
  - `createCiConnection.response.201.connection.web_url` (string, required) — The organization on the service.
  - `createCiConnection.response.201.connection.webhook_url` (string, required) — The URL to paste into the service's webhook settings.
  - `createCiConnection.response.201.connection.token` (string, required) — Where its REST token comes from: the Worker secret BUILDKITE_API_TOKEN at launch.
    - one of `"worker_secret"`, `"stored"`
  - `createCiConnection.response.201.connection.created_at` (string, required)
    - format `date-time`
  - `createCiConnection.response.201.connection.created_by` (string, required)
  - `createCiConnection.response.201.connection.last_event` (object | null, required) — The last webhook that passed its check.
    - `createCiConnection.response.201.connection.last_event.at` (string, optional)
      - format `date-time`
    - `createCiConnection.response.201.connection.last_event.event` (string | null, optional)
    - `createCiConnection.response.201.connection.last_event.result` (string | null, optional) — `recorded`, or `ignored: <reason>`.
  - `createCiConnection.response.201.connection.last_refused` (object | null, required) — The last webhook refused (a wrong token or signature), recorded at most every 10 s.
    - `createCiConnection.response.201.connection.last_refused.at` (string, optional)
      - format `date-time`
    - `createCiConnection.response.201.connection.last_refused.reason` (string | null, optional)
- `createCiConnection.response.201.webhook_token` (string, required) — Shown once.

### 400

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `createCiConnection.response.400.error` (object, required)
  - `createCiConnection.response.400.error.code` (string, required)
  - `createCiConnection.response.400.error.message` (string, required)
  - `createCiConnection.response.400.error.paths` (array<string>, optional)
  - `createCiConnection.response.400.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `createCiConnection.response.400.error.checks.sha` (string | null, required)
    - `createCiConnection.response.400.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `createCiConnection.response.400.error.checks.required` (array | null, required) — Null while unknown.
    - `createCiConnection.response.400.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `createCiConnection.response.400.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `createCiConnection.response.400.error.checks.statuses.sha` (string, required)
      - `createCiConnection.response.400.error.checks.statuses.context` (string, required)
      - `createCiConnection.response.400.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `createCiConnection.response.400.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `createCiConnection.response.400.error.checks.statuses.target_url` (string | null, optional)
      - `createCiConnection.response.400.error.checks.statuses.description` (string | null, optional)
      - `createCiConnection.response.400.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `createCiConnection.response.400.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `createCiConnection.response.400.error.checks.missing` (array<string>, optional)

### 403

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `createCiConnection.response.403.error` (object, required)
  - `createCiConnection.response.403.error.code` (string, required)
  - `createCiConnection.response.403.error.message` (string, required)
  - `createCiConnection.response.403.error.paths` (array<string>, optional)
  - `createCiConnection.response.403.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `createCiConnection.response.403.error.checks.sha` (string | null, required)
    - `createCiConnection.response.403.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `createCiConnection.response.403.error.checks.required` (array | null, required) — Null while unknown.
    - `createCiConnection.response.403.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `createCiConnection.response.403.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `createCiConnection.response.403.error.checks.statuses.sha` (string, required)
      - `createCiConnection.response.403.error.checks.statuses.context` (string, required)
      - `createCiConnection.response.403.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `createCiConnection.response.403.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `createCiConnection.response.403.error.checks.statuses.target_url` (string | null, optional)
      - `createCiConnection.response.403.error.checks.statuses.description` (string | null, optional)
      - `createCiConnection.response.403.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `createCiConnection.response.403.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `createCiConnection.response.403.error.checks.missing` (array<string>, optional)

### 409

`ci_connection_exists`: this organization is connected already.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `createCiConnection.response.409.error` (object, required)
  - `createCiConnection.response.409.error.code` (string, required)
  - `createCiConnection.response.409.error.message` (string, required)
  - `createCiConnection.response.409.error.paths` (array<string>, optional)
  - `createCiConnection.response.409.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `createCiConnection.response.409.error.checks.sha` (string | null, required)
    - `createCiConnection.response.409.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `createCiConnection.response.409.error.checks.required` (array | null, required) — Null while unknown.
    - `createCiConnection.response.409.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `createCiConnection.response.409.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `createCiConnection.response.409.error.checks.statuses.sha` (string, required)
      - `createCiConnection.response.409.error.checks.statuses.context` (string, required)
      - `createCiConnection.response.409.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `createCiConnection.response.409.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `createCiConnection.response.409.error.checks.statuses.target_url` (string | null, optional)
      - `createCiConnection.response.409.error.checks.statuses.description` (string | null, optional)
      - `createCiConnection.response.409.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `createCiConnection.response.409.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `createCiConnection.response.409.error.checks.missing` (array<string>, optional)


Source: https://docs.gitpando.com/api/ci/createCiConnection/index.md
