Skip to content
Skip to main contentWhere does your team stand on AI adoption?
CONTACT SALESSTART BUILDING

Models, folders, and content

Define and organize the structure of content within your Builder Space. Use these operations to create and manage models and folders that determine how content is stored and grouped.

Get models

Retrieve one or more data models from your Builder Space. For more details on models in Builder, see Models Intro.

Framework

To get all models from your Builder Space, use the following query.

Query

const response = await adminSDK .query({ models: { id: true, fields: true, }, });

Response

{ "data": { "models": [ ... ] } }

To get one model by ID from your Builder Space, use the following query replacing "your-model-id" with your model's unique ID.

Query

const response = await adminSDK .query({ model: { id: 'your-model-id', arguments: { id: 'your-model-id' }, properties: { id: true, name: true, fields: true } }, });

Response

{ "data": { "models": { "id": "MODEL-ID", "name": "headline", "kind": "component", "fields": [ { name: "Headline", type: "text", required: true, } ] } } }

Create a model

Create a new model within your Builder Space.

Framework

When creating a new model, you must include a name and kind. The fields key must also be present and have a value that is an array.

Query

const result = await adminSDK .chain.mutation.addModel({ body: { name: "headline", kind: "component", fields: [ { name: "Headline", type: "text", required: true } ] } }) .execute();

Response

{ "data": { "addModel": { "id": "...", "name": "headline", "kind": "component", "fields": [ { name: "Headline", type: "text", required: true, } ] } } }

Update a model

Update an existing model within your Builder Space.

Framework

To update a model by ID from your Builder Space, use the following query replacing "your-model-id" with your model's unique ID. With this query, you may update any fields within the model.

Query

const result = await adminSDK .chain.mutation.updateModel({ body: { id: "your-model-id", data: { fields: [ { name: "Headline", type: "text", required: true }, { name: "Subheadline", type: "text", required: false } ] } } }) .execute();

Response

{ "data": { "updateModel": { "id": "MODEL-ID", "name": "headline", "fields": [ { "name": "Headline", "type": "text", "required": true }, { "name": "Subheadline", "type": "text", "required": false } ] } } }

Delete a model

Delete an existing model within your Builder Space. This operation is not reversible.

Framework

To delete a model by ID from your Builder Space, use the following query replacing "your-model-id" with your model's unique ID.

Query

const result = await adminSDK .chain.mutation.deleteModel({ id: "your-model-id" }) .execute();

Response

{ "data": { "deleteModel": null } }

Get folders and contents

Folders are used within Builder to organize content entries. For more details, see Managing Content.

Framework

To get all folders and their content entries' IDs from your Builder Space, use the following query.

Query

const response = await adminSDK .query({ getFolders: { id: true, name: true, description: true, entries: true } });

Response

{ "data": { "getFolders": [ { "id": "...", "name": "My Folder", "description": "...", "entries": [ "...", "..." ] } ] } }

To get one folder by ID from your Builder Space, use the following query replacing "your-folder-id" with your model's unique ID.

Query

const response = await adminSDK .query({ getFolder: { arguments: { id: "your-folder-id" }, properties: { name: true, entries: true } } });

Response

{ "data": { "getFolder": { "id": "FOLDER-ID", "name": "My Folder", "description": "...", "entries": [ "...", "..." ] } } }

What's next

Continue to explore the Admin API documentation or use the GraphQL Explorer to try out these queries with your own Space and Organization. Then, visit the Admin API GraphQL Schema for more details on how to modify your queries.

Was this article helpful?