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

# Create a component

> Create a new reusable email component from an LMX body.

<Tip>
  Read more about [components](/creating-emails/components).
</Tip>

## Request

### Body

<ParamField body="name" type="string" required>
  The component name.
</ParamField>

<ParamField body="lmx" type="string" required>
  The component body as an [LMX](/creating-emails/lmx) string.
</ParamField>

## Response

### Success

Returns `201 Created`.

<ResponseField name="id" type="string" required>
  The component ID.
</ResponseField>

<ResponseField name="name" type="string" required>
  The component name.
</ResponseField>

<ResponseField name="lmx" type="string" required>
  The component body serialized as LMX.
</ResponseField>

### Error

If the request body is invalid, a `400 Bad Request` is returned.

If the API key is invalid (or content API is not enabled for your team), a
`401 Unauthorized` is returned.

A `413 Payload Too Large` is returned when the LMX body exceeds the size limit.

A `422 Unprocessable Entity` is returned when the LMX is invalid.

<ResponseField name="message" type="string" required>
  An error message describing what went wrong.
</ResponseField>

<ResponseExample>
  ```json Response theme={"dark"}
  {
    "id": "cmn5ziajr01oztzlifwarda8m",
    "name": "Hero header",
    "lmx": "<Section><H2>Welcome</H2></Section>"
  }
  ```

  ```json Error response theme={"dark"}
  {
    "message": "Invalid LMX."
  }
  ```
</ResponseExample>
