> ## 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 email component from an LMX body.



## OpenAPI

````yaml /openapi.json post /v1/components
openapi: 3.1.0
info:
  title: Loops OpenAPI Spec
  description: This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api).
  version: 1.21.0
servers:
  - url: https://app.loops.so/api
security: []
tags:
  - name: API key
  - name: Audience segments
    description: View audience segments
  - name: Campaigns
    description: Create and manage email campaigns
  - name: Campaign groups
    description: Organize campaigns into groups
  - name: Components
    description: View email components
  - name: Configuration
    description: View configuration settings
  - name: Contacts
    description: Manage contacts in your audience
  - name: Contact properties
    description: Manage contact properties
  - name: Email messages
    description: Manage email message content for campaigns
  - name: Events
    description: Trigger workflows with events
  - name: Event patterns
    description: View workflow event patterns
  - name: Mailing lists
    description: View mailing lists
  - name: Themes
    description: View email themes
  - name: Transactional emails
    description: Create, manage, and send transactional emails
  - name: Transactional groups
    description: Organize transactional emails into groups
  - name: Uploads
    description: Upload image assets
  - name: Workflows
    description: View and mutate workflow graphs
  - name: Workflow nodes
    description: View and mutate workflow nodes
paths:
  /v1/components:
    post:
      tags:
        - Components
      summary: Create a component
      description: Create a new email component from an LMX body.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateComponentBody'
      responses:
        '201':
          description: Component created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComponentResponse'
        '400':
          description: Invalid request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComponentFailureResponse'
        '401':
          description: Invalid API key or content API not enabled for this team.
        '405':
          description: Wrong HTTP request method.
        '413':
          description: LMX body exceeds the size limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComponentFailureResponse'
        '422':
          description: Invalid LMX.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComponentFailureResponse'
      security:
        - apiKey: []
components:
  schemas:
    CreateComponentBody:
      type: object
      properties:
        name:
          type: string
          description: The component name.
        lmx:
          type: string
          description: The component body as an LMX string.
      required:
        - name
        - lmx
    ComponentResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the component.
        name:
          type: string
          description: The name of the component.
        lmx:
          type: string
          description: The component body serialized as LMX.
      required:
        - id
        - name
        - lmx
    ComponentFailureResponse:
      type: object
      properties:
        message:
          type: string
      required:
        - message
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

## Related topics

- [Components](/docs/creating-emails/components.md)
- [API Introduction](/docs/api-reference/intro.md)
- [Get a component](/docs/api-reference/get-component.md)
- [Update a component](/docs/api-reference/update-component.md)
