Create / Update Theme Asset
curl --request PUT \
--url https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>",
"value": "<string>"
}
'import requests
url = "https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json"
payload = {
"key": "<string>",
"value": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({key: '<string>', value: '<string>'})
};
fetch('https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.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}/assets.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'key' => '<string>',
'value' => '<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://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json"
payload := strings.NewReader("{\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyThemes
Create / Update Theme Asset
Create a new theme file or overwrite an existing one
PUT
/
api
/
v1
/
themes
/
{theme_id}
/
assets.json
Create / Update Theme Asset
curl --request PUT \
--url https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>",
"value": "<string>"
}
'import requests
url = "https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json"
payload = {
"key": "<string>",
"value": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({key: '<string>', value: '<string>'})
};
fetch('https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.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}/assets.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'key' => '<string>',
'value' => '<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://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json"
payload := strings.NewReader("{\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/themes/{theme_id}/assets.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCreates a theme file or replaces its contents. This is an upsert keyed by
key — writing the same key again overwrites the file.
Auth: OAuth access token with the write_themes scope.
Everything this endpoint does is also available in your dashboard under the
theme code editor, with no app or access token required. Use the API when you
are automating theme changes from an app; use the editor for one-off edits to
your own store.
Writes apply to the theme you name in
theme_id, and take effect immediately
if that theme is the live one. To work safely, duplicate your theme first and
write to the copy — only the active theme is served to customers.Path Parameters
string
required
The theme ID
Body Parameters
string
required
Asset path within the theme, e.g.
snippets/custom-banner.aqua,
templates/page.landing.json, assets/custom.cssstring
required
The file’s text content
Request
curl -X PUT "https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/assets.json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key": "snippets/custom-banner.aqua",
"value": "<div class=\"custom-banner\">\n {{ section.settings.text }}\n</div>"
}'
const response = await fetch('https://api.launchmystore.io/api/v1/themes/1f2e3d4c-5b6a-7980-a1b2-c3d4e5f60718/assets.json', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
key: 'snippets/custom-banner.aqua',
value: '<div class="custom-banner">\n {{ section.settings.text }}\n</div>'
})
});
Response
The created or updated asset is nested underdata.asset.
{
"status": 200,
"state": "success",
"message": null,
"data": {
"asset": {
"key": "snippets/custom-banner.aqua",
"value": "<div class=\"custom-banner\">\n {{ section.settings.text }}\n</div>"
}
},
"count": null,
"pagination": null
}
Errors
| Status | Description |
|---|---|
401 | Invalid or missing access token |
403 | App doesn’t have the write_themes scope |
404 | Theme does not exist |
400 | Invalid asset key or content |