SketchAPI.Document

The SketchAPI.Document JSON format outlines everything about your documents, like layers, vector data, metadata, configuration, permissions, and template connections.

Note: You can use a SketchAPI.Document as a template by linking to its ID. This way, you can create a chain of connected documents where each document can link back to its parent template.

Table of Contents


SketchAPI.Document

namespace SketchAPI {
	export interface Document {
		/** API version identifier (2024.10.26.10) */
		sketchApi: string

		/** Ancestry of the document (original, fork1, fork2) */
		ancestry: string[]
		/** Unique sketch identifier (UUID) */
		id: string

		/** Creation timestamp (2024-10-26T10:00:00Z) */
		dateCreated: string
		/** Last update timestamp (2024-11-05T12:00:00Z) */
		dateUpdated: string
		/** Document version identifier (checkpoint-1) */
		version: string

		/** Display name */
		name: string
		/** Content purpose and description */
		description: string
		/** Document metadata and tagging */
		metadata: {
			/** User-defined fields... */
			[key: string]: any
		}

		/** Sketch content layers */
		layers: SketchLayer[]

		/** Page dimensions */
		pages: {
			/** Width in pixels */
			width: number
			/** Height in pixels */
			height: number
		}[]

		/** Document configuration */
		settings: {
			/** Canvas width in pixels */
			width: number
			/** Canvas height in pixels */
			height: number
			/** Measurement units (px, mm, in) */
			units: string
			/** Export DPI resolution */
			exportDPI: number
			/** Export file type (png, jpg, svg) */
			exportFormat: string
			/** Export quality (0-1) */
			exportQuality: number

			/** Clipping path configuration */
			clipPath: {
				/** Enable/disable clipping */
				enabled: boolean
				/** Path styling */
				style: {
					/** Stroke color value */
					strokeStyle: string
					/** Stroke width value */
					lineWidth: number
				}
			}

			/** Surface rendering settings */
			surface: {
				/** Blend mode (normal, multiply, screen) */
				blend: string
				/** Drawing method (fill, stroke, pattern) */
				method: string
				/** Surface opacity (0-1) */
				opacity: number
				/** Surface type (pattern, gradient) */
				type: string
			}
		}

		/** Access control settings */
		sharing: {
			/** Access scope ID (public, user123) */
			id: string
			/** Edit permission flag */
			canEdit: boolean
			/** Fork permission flag */
			canFork: boolean
			/** View permission flag */
			canView: boolean
		}[]

		/** Tags for the document */
		tags: string[]

		/** Template configuration */
		template: {
			/** Template identifier */
			id: string
			/** Template version */
			version: number
			/** Template metadata */
			metadata: {
				/** User-defined fields... */
				[key: string]: any
			}
		} | null
	}
}

Example

{
	"sketchApi": "2024.10.26.10",
	"version": "checkpoint-1",
	"id": "sketch-UUID",
	"name": "My Homework Assignment",
	"description": "Draw a picture of your favorite animal.",
	"dateCreated": "2024-10-26T10:00:00Z",
	"dateUpdated": "2024-10-30T08:30:00Z",

	"ancestry": ["originalSketchUUID", "fork1UUID", "fork2UUID"],

	"template": {
		"id": "UUID",
		"version": 2,
		"metadata": {
			"creatorName": "Teacher Name",
			"intendedAudience": "Beginner artists",
			"usageGuidelines": "This template is for practice purposes.",
			"license": "Creative Commons"
		}
	},

	"sharing": [
		{
			"id": "public",
			"canEdit": false,
			"canFork": true,
			"canView": true
		},
		{
			"id": "user123",
			"canEdit": true,
			"canFork": true,
			"canView": true
		}
	],

	"metadata": {},

	"layers": [
		{
			"id": "layer1",
			"type": "rectangle",
			"editable": false,
			"bbox": {
				"x": 0,
				"y": 0,
				"width": 1504,
				"height": 1013
			},
			"fill": {
				"color": "#cef28f",
				"opacity": 1
			}
		}
	],

	"pages": [
		{
			"width": 1504,
			"height": 1013
		}
	],

	"tags": ["classwork", "art"],

	"settings": {
		"width": 1504,
		"height": 1013,
		"units": "px",
		"exportDPI": 72,
		"exportFormat": "png",
		"exportQuality": 0.95,
		"surface": {
			"blend": "normal",
			"method": "fill",
			"opacity": 1,
			"type": "pattern"
		},
		"clipPath": {
			"enabled": true,
			"style": {
				"strokeStyle": "black",
				"lineWidth": 1
			}
		}
	}
}