> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.makeswift.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.makeswift.com/_mcp/server.

# Create Pages

POST https://api.makeswift.com/v6/pages/$bulk
Content-Type: application/json

This feature is in beta and may change. Requests return `403` until the feature flag is enabled for your site or workspace.

Creates up to 1000 pages, each like Create Page. The response has one result per page, in request order: the created page, or the error that kept it from being created. An error in one page does not keep the others from being created. Only an error in the request itself, such as an invalid body, rejects the whole batch.

The pages are created in one transaction.

The request body is limited to 500 KB, and a larger one is rejected with `413`, so a request with element trees may hold fewer pages than that.

Reference: https://docs.makeswift.com/developer/api-reference/rest/pages/create-pages

## Authentication

- `x-api-key` header (required) — API key authentication. Accepts either: - App API key (e.g. sk_eczMHVBY9fV6GYFhvs53qcnxq7yptlXL3ABKOZtn6dQ) - Site API key (UUID format, e.g. 550e8400-e29b-41d4-a716-446655440000)

## Request

### Body (application/json)

This endpoint expects a CreatePagesBulkV6RequestBodyDto.

- `siteId` (string, required) — The site ID to create the pages in.
- `pages` (list of CreatePagesBulkV6RequestBodyDtoPagesItems, required) — The pages to create, each like the body of Create Page.

## Response

### 200

- `list of CreatePagesBulkV6ResponseBodyDtoItems`

## Errors

### 400 Bad Request Error

- `object` (enum, required)
  - Allowed values: `error`
- `code` (enum, required)
  - Allowed values: `bad_request`
- `message` (string, required)

### 403 Forbidden Error

- `object` (enum, required)
  - Allowed values: `error`
- `code` (enum, required)
  - Allowed values: `forbidden`
- `message` (string, required)

### 404 Not Found Error

- `object` (enum, required)
  - Allowed values: `error`
- `code` (enum, required)
  - Allowed values: `not_found`
- `message` (string, required)

## Types

### CreatePagesBulkV6RequestBodyDtoPagesItems

- `pathname` (string, required) — The page pathname.
- `name` (string, required) — The page name.
- `elements` (CreatePagesBulkV6RequestBodyDtoPagesItemsElements, optional) — The root of the page's element tree. When omitted, the page starts with an empty root. This feature is in beta and may change. Requests return `403` until the feature flag is enabled for your site or workspace.

### CreatePagesBulkV6ResponseBodyDtoItems

### CreatePagesBulkV6RequestBodyDtoPagesItemsElements

The root of the page's element tree. When omitted, the page starts with an empty root. This feature is in beta and may change. Requests return `403` until the feature flag is enabled for your site or workspace.

- `type` (enum, required)
  - Allowed values: `./components/Root/index.js`
- `key` (string, required) — A UUID, unique within this tree.
- `props` (map from string to any, required) — Control-defined values, keyed by prop name. Nested elements appear here too, as a \{ elements, columns } value that may sit under any prop name and at any depth - there is no reserved prop name for children.

### CreatePagesBulkV6ResponseBodyDtoItems0

- `success` (boolean, required)
- `data` (CreatePagesBulkV6ResponseBodyDtoItemsOneOf0Data, required)

### CreatePagesBulkV6ResponseBodyDtoItems1

- `success` (boolean, required)
- `error` (CreatePagesBulkV6ResponseBodyDtoItemsOneOf1Error, required)

### CreatePagesBulkV6ResponseBodyDtoItemsOneOf0Data

- `object` (enum, required)
  - Allowed values: `page`
- `id` (string, required) — The ID of the page.
- `pathname` (string, required) — The page pathname.
- `canonicalUrl` (string, required, nullable) — The canonical URL of the page.
- `title` (string, required, nullable) — The page title.
- `description` (string, required, nullable) — The page description.
- `socialImageUrl` (string, required, nullable) — The social image URL of the page.
- `sitemapPriority` (double, required, nullable) — The sitemap priority.
- `sitemapFrequency` (enum, required, nullable) — The sitemap update frequency.
  - Allowed values: `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, `never`
- `createdAt` (datetime, required, nullable) — The page creation date and time.
- `updatedAt` (datetime, required, nullable) — The page last update date and time.
- `publishedAt` (datetime, required, nullable) — The page publication date and time.
- `isOnline` (boolean, required) — The flag that indicates whether the page is online.
- `excludedFromSearchEngines` (boolean, required, nullable) — The flag that indicates whether the page is excluded from search.
- `localizations` (list of CreatePagesBulkV6ResponseBodyDtoItemsOneOf0DataLocalizationsItems, required) — The localizations of the page.
- `elements` (any, required) — Always `null` here. Get Page and List Pages return the page's element tree with `include=elements`.
- `locale` (string, optional) — The page locale. This defaults to the default locale of the parent site.

### CreatePagesBulkV6ResponseBodyDtoItemsOneOf1Error

- `code` (enum, required) — `INVALID_PATHNAME`: the pathname is not valid. `DUPLICATE_IN_BATCH`: an earlier page in the batch has the same pathname. `PATHNAME_CONFLICT`: a page in the site already has the pathname. `INVALID_ELEMENT_TREE`: the element tree is invalid.
  - Allowed values: `INVALID_PATHNAME`, `DUPLICATE_IN_BATCH`, `PATHNAME_CONFLICT`, `INVALID_ELEMENT_TREE`
- `message` (string, required)

### CreatePagesBulkV6ResponseBodyDtoItemsOneOf0DataLocalizationsItems

- `pathname` (string, required) — The pathname of the localization.
- `locale` (string, optional) — The locale of the localization.
- `id` (string, optional) — The ID of the localization.

## Examples

**Request**

```json
{
  "siteId": "string",
  "pages": [
    {
      "pathname": "string",
      "name": "string"
    }
  ]
}
```

**Response**

```json
[
  {
    "data": {
      "canonicalUrl": "string",
      "createdAt": "2024-01-15T09:30:00Z",
      "description": "string",
      "elements": null,
      "excludedFromSearchEngines": true,
      "id": "string",
      "isOnline": true,
      "locale": "string",
      "localizations": [
        {
          "id": "string",
          "locale": "string",
          "pathname": "string"
        }
      ],
      "object": "page",
      "pathname": "furniture",
      "publishedAt": "2024-01-15T09:30:00Z",
      "sitemapFrequency": "always",
      "sitemapPriority": 0.5,
      "socialImageUrl": "string",
      "title": "string",
      "updatedAt": "2024-01-15T09:30:00Z"
    },
    "success": true
  }
]
```

**SDK Code**

```python
import requests

url = "https://api.makeswift.com/v6/pages/$bulk"

payload = {
    "siteId": "string",
    "pages": [
        {
            "pathname": "string",
            "name": "string"
        }
    ]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.makeswift.com/v6/pages/$bulk';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"siteId":"string","pages":[{"pathname":"string","name":"string"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.makeswift.com/v6/pages/$bulk"

	payload := strings.NewReader("{\n  \"siteId\": \"string\",\n  \"pages\": [\n    {\n      \"pathname\": \"string\",\n      \"name\": \"string\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.makeswift.com/v6/pages/$bulk")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"siteId\": \"string\",\n  \"pages\": [\n    {\n      \"pathname\": \"string\",\n      \"name\": \"string\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.makeswift.com/v6/pages/$bulk")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"siteId\": \"string\",\n  \"pages\": [\n    {\n      \"pathname\": \"string\",\n      \"name\": \"string\"\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.makeswift.com/v6/pages/$bulk', [
  'body' => '{
  "siteId": "string",
  "pages": [
    {
      "pathname": "string",
      "name": "string"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.makeswift.com/v6/pages/$bulk");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"siteId\": \"string\",\n  \"pages\": [\n    {\n      \"pathname\": \"string\",\n      \"name\": \"string\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "siteId": "string",
  "pages": [
    [
      "pathname": "string",
      "name": "string"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.makeswift.com/v6/pages/$bulk")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```