🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@builder.io/admin-sdk

Package Overview
Dependencies
Maintainers
21
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@builder.io/admin-sdk

Builder.io Admin API SDK

0.0.8
latest
npm
Version published
Weekly downloads
1.2K
-27.55%
Maintainers
21
Weekly downloads
 
Created
Source

Builder.io Admin API SDK.

Nodejs SDK to interact with Builder.io Graphql Admin API (beta).

How to use

  • Install using your favorite package manager:
npm install @builder.io/admin-sdk
  • get a private key of the space you want to administer bpk-xxx
import { createAdminApiClient } from '@builder.io/admin-sdk';
const adminSDK = createAdminApiClient(process.env.BUILDER_PRIVATE_KEY);

// example getting space settings:
const res = await adminSDK.query({
  settings: true,
});

// example getting all models fields on a space:
const res = await adminSDK.query({
  models: {
    id: true,
    fields: true,
  },
});

// example creating a model from admin api
await adminSDK.chain.mutation
  .addModel({
    body: {
      defaultQuery: [],
      kind: 'component',
      showTargeting: true,
      allowHeatmap: true,
      id: 'xxxxxx',
      showMetrics: true,
      publicReadable: true,
      name: 'announcement-bar',
      useQueryParamTargetingClientSide: false,
      fields: [
        {
          type: 'uiBlocks',
          '@type': '@builder.io/core:Field',
          required: true,
          hideFromFieldsEditor: true,
          name: 'blocks',
          showTemplatePicker: true,
        },
      ],
      helperText: 'This model is for announcement bars',
      allowBuiltInComponents: true,
      bigData: false,
      strictPrivateWrite: false,
      requiredTargets: [],
      schema: {},
      examplePageUrl: 'https://my.site.com/preview',
      webhooks: [],
      apiGenerated: true,
      showScheduling: true,
      showAbTests: true,
      pathPrefix: '/',
      componentsOnlyMode: false,
    },
  })
  .execute({});

More info:

  • check the graphiql explorer on beta.builder.io/api/v2/admin, add your private key to the http headers section and inspect available queries / mutations:

BUILDER

Keywords

builder.io

FAQs

Package last updated on 07 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts