createObject()

Creates a new object on the specified artboard (or the first artboard if no ID is provided). Validates the object against the schema and assigns defaults such as a generated ID and type.

Signature


Parameters

options Object (partial)
The properties of the new object. The id is auto-generated and type defaults to "spot" if not provided.
artboardId string (optional)
The ID of the artboard to attach the object to. If omitted, the object will be created on the first artboard.

Returns

The newly created Object, or null if validation fails or no artboards exist.

Example