Add Section
curl --request POST \
--url https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sectionType": "<string>",
"position": 123
}
'import requests
url = "https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json"
payload = {
"sectionType": "<string>",
"position": 123
}
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({sectionType: '<string>', position: 123})
};
fetch('https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json', 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://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json",
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([
'sectionType' => '<string>',
'position' => 123
]),
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://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json"
payload := strings.NewReader("{\n \"sectionType\": \"<string>\",\n \"position\": 123\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://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sectionType\": \"<string>\",\n \"position\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json")
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 \"sectionType\": \"<string>\",\n \"position\": 123\n}"
response = http.request(request)
puts response.read_bodyThemes
Add Section
Add a section to a template
POST
/
api
/
v1
/
themes
/
{theme_id}
/
templates
/
{template}
/
sections.json
Add Section
curl --request POST \
--url https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sectionType": "<string>",
"position": 123
}
'import requests
url = "https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json"
payload = {
"sectionType": "<string>",
"position": 123
}
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({sectionType: '<string>', position: 123})
};
fetch('https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json', 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://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json",
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([
'sectionType' => '<string>',
'position' => 123
]),
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://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json"
payload := strings.NewReader("{\n \"sectionType\": \"<string>\",\n \"position\": 123\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://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sectionType\": \"<string>\",\n \"position\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/themes/{theme_id}/templates/{template}/sections.json")
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 \"sectionType\": \"<string>\",\n \"position\": 123\n}"
response = http.request(request)
puts response.read_bodyAdds a section to a template, with the section’s preset (or default)
settings and blocks. Requires the
write_themes scope.
Request
curl -X POST "https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/templates/index/sections.json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "sectionType": "rich-text", "position": 1 }'
const response = await fetch('https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/templates/index/sections.json', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({ sectionType: 'rich-text', position: 1 })
});
Path Parameters
string
required
The theme id.
string
required
The template to add to. Templates are named as in the theme’s
templates/ folder: index,
product, product.alternate, customers/account (URL-encode the / in a
path segment), and section groups such as header-group. A path such as
templates/index.json is accepted too.Body Parameters
string
required
The section to add: a file name in the theme’s
sections/ folder, without
the extension (e.g. rich-text). Which section types exist depends on the
theme — list them with Theme Assets.integer
Zero-based position in the template’s section order. Omit to add the
section at the end.
Response
201 Created with the new section’s id under data.sectionId. Use it with
Update Section Settings and
Delete Section.
{
"status": 201,
"state": "success",
"message": null,
"data": {
"success": true,
"sectionId": "rich-text",
"message": "Section 'rich-text' added successfully"
},
"pagination": null
}
Error Codes
| Status | Description |
|---|---|
404 | Theme, template or section type not found |
422 | sectionType missing or an invalid template name |
401 | Invalid or missing access token |
403 | App doesn’t have the write_themes scope |