How to set the Page URL with the Write API

Hello @AQuirky

Thank you for reaching out — I understand how frustrating it can be when documentation isn’t clear, and I appreciate your persistence in getting this working.

To set the Page URL when creating content via the Write API, you’ll need to include a query property in your request body. This is what defines the page’s routing and associates a URL path with the content entry.

Here’s an example of a full payload that works for us:

{
  "ownerId": "db60bf3db7fa4db7be81ef05b72bd720",
  "lastUpdateBy": null,
  "@version": 4,
  "name": "Write API test - URL parameter",
  "published": "published",
  "query": [
    {
      "@type": "@builder.io/core:Query",
      "property": "urlPath",
      "operator": "is",
      "value": "/write-api-test-url-parameter"
    }
  ],
  "data": {
    "themeId": false,
    "title": "Write API test - URL parameter"
  },
  "metrics": {
    "clicks": 0,
    "impressions": 0
  },
  "folders": []
}

In this structure:

  • The query array is where you define the urlPath using a type of @builder.io/core:Query.

  • This is the required way to bind a URL to a page model in Builder.

You can update your existing postData in the code like so:

const postData = {
  name: data.name,
  published: "published",
  query: [
    {
      "@type": "@builder.io/core:Query",
      property: "urlPath",
      operator: "is",
      value: '/' + data.name,
    }
  ],
  data: {
    title: data.title,
    description: data.description,
  }
};

Let us know if that works for you — and again, thank you for your patience. I’ll also pass this feedback along so we can improve the documentation around the Write API.

Thanks,