Anchor to pageCreatepage
pageCreate
mutation
Requires Any of ,
access scopes.
Creates a page.
Anchor to Arguments
Arguments
- Anchor to pagepage•Page
Create requiredInput! The properties of the new page.
Was this section helpful?
Anchor to PageCreatePayload returnsPageCreatePayload returns
- Anchor to pagepage•
The page that was created.
- Anchor to userErrorsuser•
Errors [PageCreate non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Creates a page
- pageCreate reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation CreatePage($page: PageCreateInput!) {
pageCreate(page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"page": {
"title": "New Page Title",
"handle": "new-page-title",
"body": "This is the content of the page.",
"isPublished": true,
"templateSuffix": "custom"
}
},
},
);
const data = await response.json();
mutation CreatePage($page: PageCreateInput!) {
pageCreate(page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation CreatePage($page: PageCreateInput!) { pageCreate(page: $page) { page { id title handle } userErrors { code field message } } }",
"variables": {
"page": {
"title": "New Page Title",
"handle": "new-page-title",
"body": "This is the content of the page.",
"isPublished": true,
"templateSuffix": "custom"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation CreatePage($page: PageCreateInput!) {
pageCreate(page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"page": {
"title": "New Page Title",
"handle": "new-page-title",
"body": "This is the content of the page.",
"isPublished": true,
"templateSuffix": "custom"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation CreatePage($page: PageCreateInput!) {
pageCreate(page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"page": {
"title": "New Page Title",
"handle": "new-page-title",
"body": "This is the content of the page.",
"isPublished": true,
"templateSuffix": "custom"
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation CreatePage($page: PageCreateInput!) {
pageCreate(page: $page) {
page {
id
title
handle
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"page": {
"title": "New Page Title",
"handle": "new-page-title",
"body": "This is the content of the page.",
"isPublished": true,
"templateSuffix": "custom"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"page": {
"title": "New Page Title",
"handle": "new-page-title",
"body": "This is the content of the page.",
"isPublished": true,
"templateSuffix": "custom"
}
}
Response
JSON{
"pageCreate": {
"page": {
"id": "gid://shopify/Page/1025371368",
"title": "New Page Title",
"handle": "new-page-title"
},
"userErrors": []
}
}