Website Builder API
POST /services/websites/v1/redirects/create Auth

Create Redirection

Creates a new URL redirection for the current website.

Request Body Required

FieldTypeRequiredDescriptionExample
id integer|null No Existing redirection ID (for edit only). 1
from_path string
max: 500
Yes Source path, must start with /, lowercase, no query strings or fragments. Cannot be the homepage (/). Only valid URL path characters allowed. /old-page
to_path string|null
max: 500
No Target path (starts with /) or external URL (starts with https://). Required when no target_type is set. No javascript:, data:, mailto:, tel:, vbscript: protocols allowed. /new-page
redirect_type string
301, 302
Yes HTTP redirect status code. Only 301 (permanent) or 302 (temporary). 301
is_active boolean|null No Whether this redirect is currently active. true
target_type string|null
pages, structure_items, structure_categories, products, products_categories
No Content type when redirecting to an existing page. pages
target_id integer|null No Content ID when redirecting to an existing page. Required when target_type is set. 123

Responses

500
200
422
401
403
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[]
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
data object
data.redirection object
Validation error
FieldTypeDescription
message string Errors overview.
errors object A detailed description of each field that failed validation.
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/redirects/create" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "id": 1,
    "from_path": "/old-page",
    "to_path": "/new-page",
    "redirect_type": "301",
    "is_active": true,
    "target_type": "pages",
    "target_id": 123
}'
fetch('https://api.wemasy.nl/api/services/websites/v1/redirects/create', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "id": 1,
    "from_path": "/old-page",
    "to_path": "/new-page",
    "redirect_type": "301",
    "is_active": true,
    "target_type": "pages",
    "target_id": 123
})})
.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/redirects/create', {
    "id": 1,
    "from_path": "/old-page",
    "to_path": "/new-page",
    "redirect_type": "301",
    "is_active": true,
    "target_type": "pages",
    "target_id": 123
});
$data = $response->json();
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = {
    "id": 1,
    "from_path": "/old-page",
    "to_path": "/new-page",
    "redirect_type": "301",
    "is_active": true,
    "target_type": "pages",
    "target_id": 123
}
r = requests.post("https://api.wemasy.nl/api/services/websites/v1/redirects/create", headers=headers, json=data)
print(r.json())
Response Example
{
    "error": false,
    "message": "string",
    "data": {
        "redirection": {
            "id": "string",
            "from_path": "string",
            "to_path": "string",
            "redirect_type": "string",
            "is_active": "string",
            "sort_order": "string",
            "source": "string",
            "target_type": "string",
            "target_id": "string"
        }
    }
}

Try It
Request Body Required

Export