---
title: "Update a component"
method: POST
path: "/v1/components/{componentId}"
tags: ["Components"]
---

# Update a component

`POST /v1/components/{componentId}`

Update a component's name and/or body. When the `lmx` body changes, the update cascades to every email using this component, and `affectedEmailCount` reports how many were affected. A change that would introduce a dynamic variable an email using the component cannot use is rejected.

## Request body

- UpdateComponentBody — At least one of `name` or `lmx` must be provided.
  - `name` string
  - `lmx` string — The component body as an LMX string.

## Response `200`

Successful.

- UpdateComponentResponse
  - `id` string, required — The ID of the component.
  - `name` string, required — The name of the component.
  - `lmx` string, required — The component body serialized as LMX.
  - `affectedEmailCount` number, required — The number of emails using this component that were updated by the body change. `0` when only the name changed.

## Other responses

- `400` — Invalid `componentId` or request body.
- `401` — Invalid API key or content API not enabled for this team.
- `404` — Component not found.
- `405` — Wrong HTTP request method.
- `413` — LMX body exceeds the size limit.
- `422` — Invalid LMX, or a body change that would break emails using the component.

---

[API](https://skmtc.net/loops/apis/loops-openapi-spec.md) · [All operations](https://skmtc.net/loops/apis/loops-openapi-spec/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/loops/loops-openapi-spec/revisions/9cc087257f0d/schema)
