Website Builder API
POST /services/websites/v1/components/convert-to-template Auth

Convert to Template

This is the inverse of the Unlink operation: 1. Creates a new Partial (reusable template) with custom='custom_template' 2. Copies the component's data (code, meta, custom_fields) into a PartialsComponents child 3. Updates the original component to become a templatePartial linked to the new template

Request Body Required

FieldTypeRequiredDescriptionExample
component_id string Yes The component connection ID to convert into a template. 6122
id string Yes The post_name (slug) of the page containing the component. /
type string Yes The target type: page, header, footer, or secured. page
template_type string
custom_template, reuseable_template
Yes The template type to create: custom_template (single use) or reuseable_template (shared). custom_template
template_name string|null
max: 255
No Optional display name for the new template. Template: Dynamic...

Responses

422
500
200
401
403
429
Validation error
FieldTypeDescription
message string Errors overview.
errors object A detailed description of each field that failed validation.
Internal server error
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
data mixed[]
Successful response
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
partial object
partial.id integer
partial.title string|null
partial.type string|null
partial.type_layout string|null
partial.preview_image null
Unauthenticated — missing or invalid Bearer token
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
Forbidden — insufficient permissions for this resource
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
Too Many Requests — rate limit exceeded
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
Retry-After integer Seconds until the rate limit resets 60
FieldTypeDescription
error boolean
message string
Base URL
https://api.wemasy.nl/api
Authentication

Request Sample
cURL
JS
PHP
Python
curl -X POST "https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "component_id": "6122",
    "id": "/",
    "type": "page",
    "template_type": "custom_template",
    "template_name": "Template: Dynamic..."
}'
fetch('https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "component_id": "6122",
    "id": "/",
    "type": "page",
    "template_type": "custom_template",
    "template_name": "Template: Dynamic..."
})})
.then(r => r.json())
.then(data => console.log(data));
$response = Http::withToken('YOUR_API_TOKEN')
    ->accept('application/json')
    ->post('https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template', {
    "component_id": "6122",
    "id": "/",
    "type": "page",
    "template_type": "custom_template",
    "template_name": "Template: Dynamic..."
});
$data = $response->json();
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = {
    "component_id": "6122",
    "id": "/",
    "type": "page",
    "template_type": "custom_template",
    "template_name": "Template: Dynamic..."
}
r = requests.post("https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template", headers=headers, json=data)
print(r.json())
Response Example
{
    "error": false,
    "message": "string",
    "partial": {
        "id": 0,
        "title": "string",
        "type": "string",
        "type_layout": "string",
        "preview_image": "string"
    }
}

Try It
Request Body Required

Export