Assign resources to a shared template page
curl --request POST \
--url https://studio.weaverse.io/api/v1/content/projects/{projectId}/template-assignments/{pageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assignments": [
{
"handle": "summer-sale",
"shopifyResourceId": "gid://shopify/Collection/123456789"
},
{
"handle": "winter-drop",
"shopifyResourceId": "gid://shopify/Collection/987654321"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
assignments: [
{handle: 'summer-sale', shopifyResourceId: 'gid://shopify/Collection/123456789'},
{handle: 'winter-drop', shopifyResourceId: 'gid://shopify/Collection/987654321'}
]
})
};
fetch('https://studio.weaverse.io/api/v1/content/projects/{projectId}/template-assignments/{pageId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://studio.weaverse.io/api/v1/content/projects/{projectId}/template-assignments/{pageId}"
payload = { "assignments": [
{
"handle": "summer-sale",
"shopifyResourceId": "gid://shopify/Collection/123456789"
},
{
"handle": "winter-drop",
"shopifyResourceId": "gid://shopify/Collection/987654321"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "template_assignments",
"pageId": "clz2r7t5w0002mnop9012qrst",
"type": "COLLECTION",
"requested": 2,
"created": [
{
"handle": "summer-sale",
"locale": "",
"assignmentId": "clz5b1c2d0008wxyz3456abcd"
}
],
"existing": [
{
"handle": "winter-drop",
"locale": "",
"assignmentId": "clz5b0a1b0009wxyz7890efgh"
}
]
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "CONFLICT",
"message": "1 of 2 resource(s) already belong to a different page; no assignments were created",
"status": 409,
"details": {
"conflicts": [
{
"handle": "winter-drop",
"locale": "",
"assignmentId": "clz5b0a1b0009wxyz7890efgh"
}
]
}
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}Assignments
Assign resources to a shared template page
Assigns many Shopify resources to one existing template page: the shared-template model (one page, many assignments). Each resource becomes its own assignment row pointing at pageId, so the template content stays shared, not copied. To create an independent, editable copy per resource, use POST /projects/{projectId}/pages instead.
- The target must be a live page assigned to this project. Its type is derived from its existing assignments and must be resource-backed (
PRODUCT,COLLECTION,PAGE,BLOG,ARTICLE); any other type returns400. - Send 1-100 entries in
assignments.handleis the Shopify resource handle (trimmed, kept verbatim);localedefaults to the global assignment (""). - A resource already assigned to this page is an idempotent no-op, reported under
existing. - All-or-nothing. Every handle is checked first. If any handle already belongs to a different live page, the whole request returns
409 CONFLICTwith the clashing handles indetails.conflicts, and nothing is written. A resource is never repointed away from another page: unassign it from its current template, then retry. - New rows are created in a single transaction. All lookups and writes are scoped to
projectId.
Required scope: content:write
POST
/
projects
/
{projectId}
/
template-assignments
/
{pageId}
Assign resources to a shared template page
curl --request POST \
--url https://studio.weaverse.io/api/v1/content/projects/{projectId}/template-assignments/{pageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assignments": [
{
"handle": "summer-sale",
"shopifyResourceId": "gid://shopify/Collection/123456789"
},
{
"handle": "winter-drop",
"shopifyResourceId": "gid://shopify/Collection/987654321"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
assignments: [
{handle: 'summer-sale', shopifyResourceId: 'gid://shopify/Collection/123456789'},
{handle: 'winter-drop', shopifyResourceId: 'gid://shopify/Collection/987654321'}
]
})
};
fetch('https://studio.weaverse.io/api/v1/content/projects/{projectId}/template-assignments/{pageId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://studio.weaverse.io/api/v1/content/projects/{projectId}/template-assignments/{pageId}"
payload = { "assignments": [
{
"handle": "summer-sale",
"shopifyResourceId": "gid://shopify/Collection/123456789"
},
{
"handle": "winter-drop",
"shopifyResourceId": "gid://shopify/Collection/987654321"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "template_assignments",
"pageId": "clz2r7t5w0002mnop9012qrst",
"type": "COLLECTION",
"requested": 2,
"created": [
{
"handle": "summer-sale",
"locale": "",
"assignmentId": "clz5b1c2d0008wxyz3456abcd"
}
],
"existing": [
{
"handle": "winter-drop",
"locale": "",
"assignmentId": "clz5b0a1b0009wxyz7890efgh"
}
]
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}{
"object": "error",
"code": "CONFLICT",
"message": "1 of 2 resource(s) already belong to a different page; no assignments were created",
"status": 409,
"details": {
"conflicts": [
{
"handle": "winter-drop",
"locale": "",
"assignmentId": "clz5b0a1b0009wxyz7890efgh"
}
]
}
}{
"object": "error",
"code": "UNAUTHORIZED",
"message": "<string>",
"status": 123,
"details": "<unknown>"
}Authorizations
Path Parameters
Body
application/json
Response
Assignments applied. created = new rows; existing = idempotent no-ops.
Was this page helpful?