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

Add Component to Block

Request Body Required

FieldTypeRequiredDescriptionExample
type string Yes The target type: page, header, footer, or secured. page
id string Yes The post_name (slug) of the target page, header, footer, or secured page. /
component_id string Yes The component identifier (post_name) to add, or "themePage" for theme page cloning. sectionContent
menu_order string Yes The sort position of the component within the target. 490
theme_template_id integer|null No Template ID from theme to clone when adding a theme component. 12
infrastructure_template_id integer|null No Infrastructure template ID for cross-website component cloning. 34
source_theme_id integer|null No Source theme ID when cloning components from a theme. 5
infrastructure_website_id integer|null No Source website ID for infrastructure-level component cloning. 1
theme_page_id integer|null No Theme page ID when cloning all components from a theme page. 99
layout_id integer|null No Layout ID to assign to the cloned page. 7
use_theme_layout boolean|null No Whether to use the theme's layout when cloning a theme page. false
auto_detach boolean|null No Whether to automatically detach the template into independent sections. false
meta mixed[] No Additional metadata key-value pairs for the component connection. {"section_content":{"time":1594475302702,"blocks":[{"type":"paragraph","data":{"text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit."}}],"version":"2.18.0"},"padding_top":"20","padding_bottom":"20","flex_grids":"w-full","content_hotizontal_position":"justify-start"}

Responses

500
200
422
404
403
401
429
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[]
Return response in same format as normal component add for frontend compatibility
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
component object
component.id integer|null
component.type mixed
Validation error
FieldTypeDescription
message string Errors overview.
errors object A detailed description of each field that failed validation.
Resource not found
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[]
Forbidden — insufficient permissions
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[]
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
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/add-to" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "page",
    "id": "/",
    "component_id": "sectionContent",
    "menu_order": "490",
    "theme_template_id": 12,
    "infrastructure_template_id": 34,
    "source_theme_id": 5,
    "infrastructure_website_id": 1,
    "theme_page_id": 99,
    "layout_id": 7,
    "use_theme_layout": false,
    "auto_detach": false,
    "meta": {
        "section_content": {
            "time": 1594475302702,
            "blocks": [
                {
                    "type": "paragraph",
                    "data": {
                        "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
                    }
                }
            ],
            "version": "2.18.0"
        },
        "padding_top": "20",
        "padding_bottom": "20",
        "flex_grids": "w-full",
        "content_hotizontal_position": "justify-start"
    }
}'
fetch('https://api.wemasy.nl/api/services/websites/v1/components/add-to', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "type": "page",
    "id": "/",
    "component_id": "sectionContent",
    "menu_order": "490",
    "theme_template_id": 12,
    "infrastructure_template_id": 34,
    "source_theme_id": 5,
    "infrastructure_website_id": 1,
    "theme_page_id": 99,
    "layout_id": 7,
    "use_theme_layout": false,
    "auto_detach": false,
    "meta": {
        "section_content": {
            "time": 1594475302702,
            "blocks": [
                {
                    "type": "paragraph",
                    "data": {
                        "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
                    }
                }
            ],
            "version": "2.18.0"
        },
        "padding_top": "20",
        "padding_bottom": "20",
        "flex_grids": "w-full",
        "content_hotizontal_position": "justify-start"
    }
})})
.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/add-to', {
    "type": "page",
    "id": "/",
    "component_id": "sectionContent",
    "menu_order": "490",
    "theme_template_id": 12,
    "infrastructure_template_id": 34,
    "source_theme_id": 5,
    "infrastructure_website_id": 1,
    "theme_page_id": 99,
    "layout_id": 7,
    "use_theme_layout": false,
    "auto_detach": false,
    "meta": {
        "section_content": {
            "time": 1594475302702,
            "blocks": [
                {
                    "type": "paragraph",
                    "data": {
                        "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
                    }
                }
            ],
            "version": "2.18.0"
        },
        "padding_top": "20",
        "padding_bottom": "20",
        "flex_grids": "w-full",
        "content_hotizontal_position": "justify-start"
    }
});
$data = $response->json();
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = {
    "type": "page",
    "id": "/",
    "component_id": "sectionContent",
    "menu_order": "490",
    "theme_template_id": 12,
    "infrastructure_template_id": 34,
    "source_theme_id": 5,
    "infrastructure_website_id": 1,
    "theme_page_id": 99,
    "layout_id": 7,
    "use_theme_layout": false,
    "auto_detach": false,
    "meta": {
        "section_content": {
            "time": 1594475302702,
            "blocks": [
                {
                    "type": "paragraph",
                    "data": {
                        "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
                    }
                }
            ],
            "version": "2.18.0"
        },
        "padding_top": "20",
        "padding_bottom": "20",
        "flex_grids": "w-full",
        "content_hotizontal_position": "justify-start"
    }
}
r = requests.post("https://api.wemasy.nl/api/services/websites/v1/components/add-to", headers=headers, json=data)
print(r.json())
Response Example
{
    "error": false,
    "component": {
        "id": 0,
        "type": "string"
    }
}

Try It
Request Body Required

Export