Source: https://docs.cumuluslabs.io/reference/publications.promote
Content version: 9c77dab4

# publications.promote

Move head to an existing version (manual promote or rollback), rebasing the named open draft in the same transaction

## Request {#request}

`POST /api/v1/agents/{agent_id}/head`

- MCP: `publications_promote`
- SDK: `client.publications.promote` (SDK path arguments use `path`; MCP uses `params`).
- Minimum API key role: **member**.
- Idempotency: **natural**.

Body {version, expected_head_version}: expected_head_version is the current head version (agents_get head.version), or null when the agent has never been live.

## Input schema {#input-schema}

```json
{
  "parameters": [
    {
      "name": "agent_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256,
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PublicationsPromoteRequest"
        }
      }
    }
  }
}
```

## Responses {#responses}

```json
{
  "200": {
    "description": "Move head to an existing version (manual promote or rollback), rebasing the named open draft in the same transaction",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PublicationsPromoteResponse200"
        }
      }
    }
  },
  "4XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  },
  "5XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}
```

## Referenced schemas {#schemas}

```json
{
  "components": {
    "schemas": {
      "PublicationsPromoteRequest": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "expected_head_version": {
            "allOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 2147483647
              }
            ],
            "nullable": true
          },
          "draft_id": {
            "allOf": [
              {
                "type": "string",
                "format": "uuid"
              }
            ],
            "nullable": true
          }
        },
        "required": [
          "version",
          "expected_head_version"
        ],
        "additionalProperties": false
      },
      "PublicationsPromoteResponse200": {
        "type": "object",
        "properties": {
          "agent": {
            "type": "object",
            "properties": {
              "tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "agent"
                ]
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
              }
            },
            "required": [
              "tenant_id",
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "from_version": {
            "allOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 2147483647
              }
            ],
            "nullable": true
          },
          "to_version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "digest": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "moved": {
            "type": "boolean"
          }
        },
        "required": [
          "agent",
          "from_version",
          "to_version",
          "digest",
          "moved"
        ],
        "additionalProperties": false
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthenticated",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "invalid_request",
                  "idempotency_conflict",
                  "policy_denied",
                  "capability_unavailable",
                  "provider_unavailable",
                  "knowledge_unavailable",
                  "publication_invalid",
                  "run_not_active",
                  "rate_limited",
                  "outcome_unknown",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "none",
                  "unknown"
                ]
              },
              "details": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "outcome"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  }
}
```

## Errors and recovery {#errors}

See [API error handling](https://docs.cumuluslabs.io/api#errors) and [Troubleshooting](https://docs.cumuluslabs.io/troubleshooting).

## Related guides {#related-guides}

- [Agents](https://docs.cumuluslabs.io/agents)
- [Build and test recipes](https://docs.cumuluslabs.io/recipes)
