Skip to main content

SDK reference

Connect the SDK before setting iframe.src, then await editor.ready. See the Browser quickstart for a working page structure.

Connection options​

OptionPurpose
iframeYour iframe element
viewerOriginhttps://www.renderapi.buildcores.com
getGrant()Return a renewed token from your backend for the current visitor session
onReady(message)Receive readiness information; do not use it to authorize access
onChange(state)Receive edits and save-status updates
onError(error)Handle failed token renewal
requestTimeoutMsCommand timeout; defaults to 30 seconds, including readiness

Commands​

MethodAction
getState()Read the current configuration, selected parts, and save status
pc.load({ parts, interactiveConfig })Load a PC from public BuildCores IDs; visual settings are optional
pc.export(), pc.restore(snapshot)Export or restore a PC snapshot; store the JSON unchanged
searchParts({ category, query })Search the public parts catalog
parts.add, parts.replace, parts.removeEdit installed PC parts
cooling.get, cooling.place, cooling.move, cooling.flip, cooling.removeDiscover fan/radiator slots and edit placements
rgb.setChange global or per-part lighting
configuration.discover, configuration.editFind and edit model-specific controls, such as mounts and joints
setup.addProduct, setup.replaceProductAdd or replace a Setup product
setup.copy, setup.remove, setup.setVisibilityCopy, delete, show, or hide a Setup entity
setView, select, resetCameraChange the view, selection, or camera framing
setRenderPreferencesChange rendering and environment settings
flush(), reload()Finish pending edits or reload the configuration
dispose()Remove SDK listeners; your application removes the iframe

Available controls depend on the model. Use discovery results for descriptor IDs, slot keys, and supported values. Commit sliders on release or debounce updates.

Use the right identifier​

IdentifierUse
buildcoresIdPC presets, Setup products, and your SKU mapping
Catalog id as partIdPC add/replace commands; returned by searchParts
instanceIdAn installed part occurrence; returned by getState()
buildIdThe PC being edited, including a PC inside a Setup
entityIdA Setup item

Refresh state after replacing a part because its occurrence ID can change.

await editor.rgb.set({ color: "#4466ff", brightness: 70 });
await editor.setRenderPreferences({ environment: { showGrid: false } });

const state = await editor.getState();
const pc = state.builds[0];
const gpu = pc?.parts.find((part) => part.category === "GPU");
const catalog = await editor.searchParts({ category: "GPU", query: "GeForce" });
// Example: use the first result. Your UI should let the shopper select a product.
const replacement = catalog.parts[0];
if (pc && gpu && replacement) {
await editor.parts.replace({
buildId: pc.id,
instanceId: gpu.instanceId,
partId: replacement.id
});
}

Saved configurations​

The quickstart uses stateless PC mode: edits stay in the browser. To enable BuildCores autosave, register an authorized source instead:

{ "kind": "build", "shareCode": "YOUR_BUILD_SHARE_CODE" }

For Setup Builder (Beta):

{ "kind": "setup", "shareCode": "YOUR_SETUP_SHARE_CODE" }

Your BuildCores account must own the source, including attached PCs, or use an authorized published source. Sources stay unchanged. A different source needs a new embed. Issue access: "edit" tokens with a stable, backend-owned externalBuildId.

Keep the quickstart's connection code. Remove the initial pc.load() call so reopening loads the shopper's saved changes. pc.load and pc.restore can replace a saved PC, but cannot replace a Setup workspace.

Stateless PCSaved PC / Setup
Edit completesAfter local acceptance and model preparationAfter the server saves it
saveStatusidleCurrent save status
flush()Wait for earlier commandsFinish saves or retry a retained uncertain save
reload()Reset to the last loaded preset/snapshotLoad the server version, discarding unsaved changes

Camera and selection stay local. Rendering preferences persist in saved mode.

Use your own controls​

The built-in editor is visible by default. To hide its controls, call PATCH /embed-config?environment=staging from your backend with your API key:

{ "embed": { "hideUi": true } }

This setting applies to your whole BuildCores account, across staging and production, on next open/reload. Branding, disclaimer, save status, and error feedback remain. Your page can then use the SDK commands to provide controls.

Errors​

Catch command promise rejections. RenderEmbedCommandError includes code, message, and an optional HTTP status.

CodeRecovery
CONFLICTAsk before discarding unsaved edits with reload()
SAVE_FAILEDShow the failure; flush() can retry a retained uncertain save
TIMEOUTRead state before retrying; the original edit may still complete

Commands are not automatically replayed. Respect Retry-After for HTTP 429.

Usage​

One accepted viewer opening counts as one admission. A new opening can count again, including when reopening a saved configuration. Renewals, edits, and catalog reads add no admissions. Rendering failures do not undo an admission.

Read GET /embed-usage?environment=staging from your backend; use prod for production. Add month=YYYY-MM for a UTC month. Request limits are not monthly spending caps; confirm commercial terms with BuildCores.