# Code pipeline runs

14 calls. Every request needs the `Authorization` header: see [the overview](https://docs.maitento.com/reference.md).

## `pipelineRuns.list`

```http
GET /code-pipelines/processes
```

Every pipeline run of the tenant (unbounded; prefer `runs.list({ types: ["CodePipeline"] })`).

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fcode-pipelines%2Fprocesses).

**Response:** [`CodePipelineProcess`](https://docs.maitento.com/reference/types/code-pipeline-process.md)`[]` (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/code-pipelines/processes" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const runs = await mt.pipelineRuns.list();
```
```python title="Python"
mt.pipeline_runs.list()
```

## `pipelineRuns.listActive`

```http
GET /code-pipelines/processes/alive
```

Every pipeline run that has not finished.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fcode-pipelines%2Fprocesses%2Falive).

**Response:** [`CodePipelineProcess`](https://docs.maitento.com/reference/types/code-pipeline-process.md)`[]` (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/code-pipelines/processes/alive" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const active = await mt.pipelineRuns.listActive();
```
```python title="Python"
mt.pipeline_runs.list_active()
```

## `pipelineRuns.get`

```http
GET /code-pipelines/processes/by-id/{id}
```

The run with this id. Throws `NotFoundError` when there is none.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Response:** [`CodePipelineProcess`](https://docs.maitento.com/reference/types/code-pipeline-process.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/code-pipelines/processes/by-id/<id>" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const run = await mt.pipelineRuns.get("aa11bb22-cc33-4d44-8e55-ff6677889900");
```
```python title="Python"
mt.pipeline_runs.get("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f")
```

## `pipelineRuns.answer`

```http
POST /code-pipelines/processes/by-id/{id}/answer
```

Answers the question a run is waiting on.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=POST%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fanswer).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Request body:** [`CodePipelineProcessAnswerRequest`](https://docs.maitento.com/reference/types/code-pipeline-process-answer-request.md)

| Field | Type | Required | Description |
|---|---|---|---|
| `requestId` | `uuid` | yes | The question's `id`, from the step's `humanInteractionRequests`. |
| `answer` | `string` | yes | The answer: one of the suggested answers, or your own. |

**Response:** no body (204)

```bash title="curl"
curl -X POST "https://api.maitento.com/code-pipelines/processes/by-id/<id>/answer" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '{"requestId":"...","answer":"..."}'
```
```ts title="TypeScript"
await mt.pipelineRuns.answer("aa11bb22-cc33-4d44-8e55-ff6677889900", { requestId: "3e4f5a6b-7c8d-4e9f-a0b1-c2d3e4f5a6b7", answer: "Use the v2 API." });
```
```python title="Python"
mt.pipeline_runs.answer("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f", "d2e3f4a5-b6c7-4d8e-9f0a-1b2c3d4e5f6a", "Use PostgreSQL.")
```

## `pipelineRuns.updateCredentials`

```http
PUT /code-pipelines/processes/by-id/{id}/credentials
```

Replaces the run's engine credentials (each `type` discriminator is sent first).

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fcredentials).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Request body:** [`CodePipelineProcessCredentialsInput`](https://docs.maitento.com/reference/types/code-pipeline-process-credentials.md)`[]`

**Response:** no body (204)

```bash title="curl"
curl -X PUT "https://api.maitento.com/code-pipelines/processes/by-id/<id>/credentials" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '[{"type":"apiKey","apiKey":"...","baseUrl":"...","hostingMode":"...","modelNameOverrides":{},"boundModel":"...","contextWindowTokens":0,"awsRegion":"...","gcpProjectId":"...","gcpRegion":"...","engine":"Claude","credentialId":"...","isOwnLicense":false,"priority":0,"billingMode":"..."}]'
```
```ts title="TypeScript"
await mt.pipelineRuns.updateCredentials("aa11bb22-cc33-4d44-8e55-ff6677889900", [{ type: "apiKey", engine: "Codex", apiKey: process.env.OPENAI_API_KEY!, isOwnLicense: true }]);
```
```python title="Python"
mt.pipeline_runs.update_credentials("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f", [{"type": "apiKey", "engine": "Codex", "apiKey": os.environ["OPENAI_API_KEY"]}])
```

## `pipelineRuns.diff`

```http
GET /code-pipelines/processes/by-id/{id}/diff
```

The run's diff so far, or `null` when there is none yet.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fdiff).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Response:** [`CodePipelineProcessDiff`](https://docs.maitento.com/reference/types/code-pipeline-process-diff.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/code-pipelines/processes/by-id/<id>/diff" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const diff = await mt.pipelineRuns.diff("aa11bb22-cc33-4d44-8e55-ff6677889900");
```
```python title="Python"
mt.pipeline_runs.diff("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f")
```

## `pipelineRuns.rawDiff`

```http
GET /code-pipelines/processes/by-id/{id}/diff/raw
```

The run's raw unified diff, or `null` when there is none yet.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fdiff%2Fraw).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Response:** [`CodePipelineProcessDiffRaw`](https://docs.maitento.com/reference/types/code-pipeline-process-diff-raw.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/code-pipelines/processes/by-id/<id>/diff/raw" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const raw = await mt.pipelineRuns.rawDiff("aa11bb22-cc33-4d44-8e55-ff6677889900");
```
```python title="Python"
mt.pipeline_runs.raw_diff("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f")
```

## `pipelineRuns.kill`

```http
PUT /code-pipelines/processes/by-id/{id}/kill
```

Kills the run.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fkill).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Response:** no body (204)

```bash title="curl"
curl -X PUT "https://api.maitento.com/code-pipelines/processes/by-id/<id>/kill" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
await mt.pipelineRuns.kill("aa11bb22-cc33-4d44-8e55-ff6677889900");
```
```python title="Python"
mt.pipeline_runs.kill("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f")
```

## `pipelineRuns.payloads`

```http
POST /code-pipelines/processes/by-id/{id}/payloads/by-ids
```

Full tool-use and context-entry payloads by id (an unknown run answers empty lists).

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=POST%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fpayloads%2Fby-ids).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Request body:** [`CodePipelineProcessPayloadsByIdsRequest`](https://docs.maitento.com/reference/types/code-pipeline-process-payloads-by-ids-request.md)

| Field | Type | Required | Description |
|---|---|---|---|
| `toolUseIds` | `uuid[]` |  | The ids of the tool calls to fetch. At most 500; ask for more in further requests. Send an empty array for none. |
| `contextEntryIds` | `uuid[]` |  | The ids of the transcript entries to fetch. At most 500; ask for more in further requests. Send an empty array for none. |

**Response:** [`CodePipelineProcessPayloadsResponse`](https://docs.maitento.com/reference/types/code-pipeline-process-payloads-response.md) (200)

```bash title="curl"
curl -X POST "https://api.maitento.com/code-pipelines/processes/by-id/<id>/payloads/by-ids" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '{"toolUseIds":[],"contextEntryIds":[]}'
```
```ts title="TypeScript"
const payloads = await mt.pipelineRuns.payloads("aa11bb22-cc33-4d44-8e55-ff6677889900", { toolUseIds: ["6a7b8c9d-0e1f-4a2b-8c3d-4e5f6a7b8c9d"], contextEntryIds: [] });
```
```python title="Python"
mt.pipeline_runs.payloads("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f", tool_use_ids=["e3f4a5b6-c7d8-4e9f-8a0b-1c2d3e4f5a6b"])
```

## `pipelineRuns.stepPayloads`

```http
GET /code-pipelines/processes/by-id/{id}/payloads/steps/{stepExecutionId}
```

The payloads of one step execution.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fpayloads%2Fsteps%2F%7BstepExecutionId%7D).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |
| `stepExecutionId` | `uuid` | yes |  |

**Response:** [`CodePipelineProcessPayloadsResponse`](https://docs.maitento.com/reference/types/code-pipeline-process-payloads-response.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/code-pipelines/processes/by-id/<id>/payloads/steps/<stepExecutionId>" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const payloads = await mt.pipelineRuns.stepPayloads("aa11bb22-cc33-4d44-8e55-ff6677889900", "5d6e7f80-91a2-4b3c-8d4e-5f60718293a4");
```
```python title="Python"
mt.pipeline_runs.step_payloads("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f", "f4a5b6c7-d8e9-4f0a-9b1c-2d3e4f5a6b7c")
```

## `pipelineRuns.updateRepos`

```http
PUT /code-pipelines/processes/by-id/{id}/repos
```

Replaces the run's repos (each `type` discriminator is sent first).

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Frepos).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Request body:** [`CodePipelineProcessRepoInput`](https://docs.maitento.com/reference/types/code-pipeline-process-repo.md)`[]`

**Response:** no body (204)

```bash title="curl"
curl -X PUT "https://api.maitento.com/code-pipelines/processes/by-id/<id>/repos" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '[{"type":"http","url":"...","credentials":"...","name":"...","branchSource":"...","branchWork":"...","mcpServer":{},"resolvedCommitSha":"...","runBaseCommitSha":"...","finalCommitSha":"...","dateLastCommitUtc":"2026-01-01T00:00:00Z"}]'
```
```ts title="TypeScript"
await mt.pipelineRuns.updateRepos("aa11bb22-cc33-4d44-8e55-ff6677889900", [{ type: "http", name: "app", url: "https://github.com/acme/app.git", credentials: process.env.GIT_TOKEN!, branchSource: "main", branchWork: "fix/login" }]);
```
```python title="Python"
mt.pipeline_runs.update_repos("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f", [{"type": "http", "name": "app", "url": "https://github.com/acme/app.git", "branchSource": "main", "branchWork": "maitento/health-check"}])
```

## `pipelineRuns.restart`

```http
PUT /code-pipelines/processes/by-id/{id}/restart
```

Starts a NEW run from this one's context. Never retried.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Frestart).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Response:** [`CodePipelineProcess`](https://docs.maitento.com/reference/types/code-pipeline-process.md) (200)

```bash title="curl"
curl -X PUT "https://api.maitento.com/code-pipelines/processes/by-id/<id>/restart" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const next = await mt.pipelineRuns.restart("aa11bb22-cc33-4d44-8e55-ff6677889900");
```
```python title="Python"
mt.pipeline_runs.restart("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f")
```

## `pipelineRuns.resume`

```http
PUT /code-pipelines/processes/by-id/{id}/resume
```

Resumes a stopped run where it left off.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fresume).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Response:** no body (204)

```bash title="curl"
curl -X PUT "https://api.maitento.com/code-pipelines/processes/by-id/<id>/resume" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
await mt.pipelineRuns.resume("aa11bb22-cc33-4d44-8e55-ff6677889900");
```
```python title="Python"
mt.pipeline_runs.resume("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f")
```

## `pipelineRuns.resumeWithPrompt`

```http
PUT /code-pipelines/processes/by-id/{id}/resume-with-prompt
```

Resumes a run with a continuation prompt. Returns the run as it was before the update: re-read it.

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Fcode-pipelines%2Fprocesses%2Fby-id%2F%7Bid%7D%2Fresume-with-prompt).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Request body:** [`CodePipelineProcessResumeWithPromptRequest`](https://docs.maitento.com/reference/types/code-pipeline-process-resume-with-prompt-request.md)

| Field | Type | Required | Description |
|---|---|---|---|
| `continuationPrompt` | `string` | yes | What to tell the agent, for example what went wrong and how to carry on. |
| `credentials` | [`CodePipelineProcessCredentialsInput`](https://docs.maitento.com/reference/types/code-pipeline-process-credentials.md)`[] \| null` |  | New credentials for the run's engines, to replace the ones it started with, for example when a token has expired. Null or empty: keep the run's credentials. |
| `credentialStack` | `string \| null` |  | A credential stack (name or id) to run on from here, snapshotted now, in place of the credentials or stack the run started with. Not with `credentials`. Null: keep the run's stack. Sending `credentials` instead moves the run off its stack and onto them. |
| `repos` | [`CodePipelineProcessRepoInput`](https://docs.maitento.com/reference/types/code-pipeline-process-repo.md)`[] \| null` |  | New repositories, with fresh git credentials, to replace the ones the run started with, for example when a short-lived token has expired. Null or empty: keep the run's repositories. |

**Response:** [`CodePipelineProcess`](https://docs.maitento.com/reference/types/code-pipeline-process.md) (200)

```bash title="curl"
curl -X PUT "https://api.maitento.com/code-pipelines/processes/by-id/<id>/resume-with-prompt" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '{"continuationPrompt":"..."}'
```
```ts title="TypeScript"
await mt.pipelineRuns.resumeWithPrompt("aa11bb22-cc33-4d44-8e55-ff6677889900", { continuationPrompt: "Also add a regression test." });
```
```python title="Python"
mt.pipeline_runs.resume_with_prompt("b7e6d5c4-3a2b-4c1d-8e9f-0a1b2c3d4e5f", continuation_prompt="Also add a test for it.")
```
