---
title: "Update a journey"
method: PATCH
path: "/projects/{projectId}/goals/{goalId}"
tags: ["Swarms"]
---

# Update a journey

`PATCH /projects/{projectId}/goals/{goalId}`

Editing a goal never disturbs a run already under way: a run pins its own immutable snapshot of the definition at launch.

## Request body

- GoalUpdateRequest — PATCH with a TRI-STATE, and the third state is the point: a field absent leaves it alone, present sets it, and `null` CLEARS it. There is no other way to say "stop fanning this goal out across environments and go back to its host targets". `iterations` and `maxTurns` must be sent TOGETHER — they are one config object upstream, so a partial update would need a read-modify-write that could silently clobber a concurrent edit. Requiring both is a 400 you can fix rather than a lost update you never see.
  - `name` string
  - `goal` string
  - `environmentIds` string[], nullable — A non-empty list to set, or `null` to clear and fall back to host targets.
  - `serverAttachmentId` string, nullable — `null` clears the attachment.
  - `hostIds` string[]
  - `iterations` integer
  - `maxTurns` integer

## Response `200`

The updated goal.

- Goal — A persona's task: what they are trying to accomplish, and across which targets. Launching one is `POST /projects/{projectId}/goals/{goalId}/runs`.
  - `id` string, required
  - `projectId` string, required
  - `name` string, required
  - `goal` string, required — What the persona is trying to accomplish. This drives the whole run.
  - `personaId` string, required
  - `swarmId` string, nullable, required — The swarm container this goal was authored under. Provenance only — nothing resolves through it at run time, and a goal created outside a swarm has none.
  - `environmentIds` string[], required — Environments this goal fans out across. EMPTY on a host-pinned goal — that is a different execution model, not a goal with no targets.
  - `serverAttachmentId` string — Legacy host-pinned grounding. Absent on an environment-based goal.
  - `iterations` integer, nullable, required — Sessions run against EACH target. Total sessions = targets × this.
  - `maxTurns` integer, nullable, required
  - `setupWrites` boolean — Whether prerequisite setup may create or modify workspace data before sessions run. Defaults to false.
  - `createdAt` number, required — Epoch milliseconds.
  - `updatedAt` number, required — Epoch milliseconds.

## Other responses

- `400` — Malformed body or parameters.
- `401` — Missing, invalid, revoked, or orphaned key (`UNAUTHORIZED`) — or the **target MCP server** needs an OAuth grant (`OAUTH_REQUIRED`), which is a property of the server, not your key.
- `403` — Key is valid but not allowed to do this.
- `404` — Unknown project, server, or resource.
- `429` — Per-key rate limit exceeded (60 requests/minute sustained, bursts up to 10). Honor `Retry-After` and back off with jitter.
- `500` — Something failed on MCPJam's side.

## Changes

- **2026-09-22** `561e4fd0dfa2` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/mcpjam/apis/mcpjam-api/changes/projects/:projectId/goals/:goalId/patch.md)

---

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