Create a component
curl --request POST \
--url https://app.loops.so/api/v1/components \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lmx": "<string>"
}
'import requests
url = "https://app.loops.so/api/v1/components"
payload = {
"name": "<string>",
"lmx": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', lmx: '<string>'})
};
fetch('https://app.loops.so/api/v1/components', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.loops.so/api/v1/components",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lmx' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.loops.so/api/v1/components"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lmx\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.loops.so/api/v1/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"lmx\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.loops.so/api/v1/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"lmx\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cmn5ziajr01oztzlifwarda8m",
"name": "Hero header",
"lmx": "<Section><H2>Welcome</H2></Section>"
}
{
"message": "Invalid LMX."
}
Components
Create a component
Create a new reusable email component from an LMX body.
POST
/
v1
/
components
Create a component
curl --request POST \
--url https://app.loops.so/api/v1/components \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lmx": "<string>"
}
'import requests
url = "https://app.loops.so/api/v1/components"
payload = {
"name": "<string>",
"lmx": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', lmx: '<string>'})
};
fetch('https://app.loops.so/api/v1/components', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.loops.so/api/v1/components",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lmx' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.loops.so/api/v1/components"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lmx\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.loops.so/api/v1/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"lmx\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.loops.so/api/v1/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"lmx\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cmn5ziajr01oztzlifwarda8m",
"name": "Hero header",
"lmx": "<Section><H2>Welcome</H2></Section>"
}
{
"message": "Invalid LMX."
}
Read more about components.
Request
Body
The component name.
Response
Success
Returns201 Created.
The component ID.
The component name.
The component body serialized as LMX.
Error
If the request body is invalid, a400 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.
An error message describing what went wrong.
{
"id": "cmn5ziajr01oztzlifwarda8m",
"name": "Hero header",
"lmx": "<Section><H2>Welcome</H2></Section>"
}
{
"message": "Invalid LMX."
}
Last modified on July 9, 2026
Was this page helpful?
⌘I

