Guide
Assets

Assets

Asset Properties

const asset = item.asset;
 
console.log(`Asset of type ${asset.type} with name ${asset.name}`);

Asset Properties

uuid

string

The id of the asset.

name

string

The name of the asset.

notes

Query parameter

The notes for the asset, if any.

type

AssetType

The type of asset.

size

number

The size of the file in bytes.

dimensions

string

The dimensions of the asset as width x height.

keywords

string

A comma separated string of keyword tags.

colors

Color[]

An array of colors as HSB values. Currently only used by color assets which will always have 1 color.

fields

string

Custom field data associated with the asset.

fileHash

string

A hash of the file. Two assets with the same file will have equal file_hash values.

fileId

string

A unique identfier for the file. Some assets may share file_id values if they use the same file.

fileUpdated

date

The date and time the file was last updated.

dateAdded

date

The date and time the asset was created.

dateUpdated

date

The date and time the asset metadata was last updated.

status

string

Only 'active' assets are included in the public API.

uploaderId

number

The id of the user that created the asset.

permalink

string

A url to download the original file.

sourceId

string

If set, the asset is from a kit version and cannot be updated. The value references the the version of the asset in a kit draft (v0).

thumbnails

object

An object of thumbnails at 24px, 292px, 480px, and 1232px.

The color list is currently only used for color assets and will always have one color.

Asset Color Properties

color.hue

number

The hue of the color, 0-360.

color.saturation

number

The saturation of the color, 0-100.

color.brightness

number

The brightness of the color, 0-100.

color.alpha

number

The opacity of the color, 0-100.

color.coverage

number

For future use, always set to 100.

The asset.meta object is used to store type specific data. The data included in the meta object depends on the asset type.

Asset Meta Properties

meta.assetProcessing

string

'processing', 'complete', or 'error' indicating the status of asset processing which includes generating thumbnails and extracting metadata.

meta.filecuts

object

Information about the avialable export options for the asset including available_types and presets.

filecuts.availableTypes.enabled

boolean

False if this export option has been disabled using export controls.

filecuts.availableTypes.resizable

boolean

If the export is resizable. Vector exports for example are not.

filecuts.availableTypes.type

string

The type of the export.

filecuts.presets.type

string

The file type of the export preset.

filecuts.presets.size

string

The size of of the export preset.

filecuts.presets.description

string

A user set description for the preset. e.g. 'For web use'

meta.content

object

An object containing url asset data

meta.content.url

string

The full url for url assets

meta.content.fld

string

The first/top level domain for url assets

meta.content.title

string

The page title for url assets.

meta.content.description

string

The page description for url assets.

Creating assets

Create a new asset file. Assets can be created directly in the library or with an item to be instantly added to a kit.

Different asset types have different requirements.

Creating content requires an API token with write access enabled.

File assets

 async createFileAsset(
    file: string,
    data?: {
      name?: string;
      type?: AssetType;
      notes?: string;
      keywords?: string;
    },
    item?: {
        kitId: string;
        sectionId: string;
        displayOrder?: string | number;
    };
  ): Promise<{ item?: Item; asset?: Asset }>

Arguments

file

string • required

A filepath.

data.type

string

The AssetType of the asset. For most types this is inferred from the file extension.

data.name

string

The name of the asset.

data.notes

string

Notes for the asset.

data.keywords

string

Comma separated list of keywords.

item.kitId

string

The kit uuid to place the item in.

item.sectionId

string

The section uuid to place the item in.

item.displayOrder

string | number

A relative number placing the item among others.

// Create an asset directly in the library
const asset = await lingo.createAsset("./logo.png", {
  name: "Logo",
});
 
// Create an asset and add it to a kit
const item = await lingo.createAsset(
  "./logo.png",
  { name: "Logo" },
  { kitId: "kit-id", sectionId: "section-id" }
);

Color assets

Color assets are created without a file. The color data is provided and stored as JSON.

   async createColorAsset(
    color: string,
    data?: {
      name?: string;
      notes?: string;
      keywords?: string;
    },
    item?: {
        kitId: string;
        sectionId: string;
        displayOrder?: string | number;
      };
  ): Promise<{ asset?: Asset; item?: Item }> {

Arguments

color

string • required

A color in a string representation such as hex, rgb/rgba hsv/hsva, hsl/hsla.

data.name

string

The name of the asset.

data.notes

string

Notes for the asset.

data.keywords

string

Comma separated list of keywords.

item.kitId

string

The kit uuid to place the item in.

item.sectionId

string

The section uuid to place the item in.

item.displayOrder

string | number

A relative number placing the item among others.

// Create an asset directly in the library
const asset = await lingo.createColor("#4349DC", {
  name: "Primary",
  notes: "The primary color for the brand.",
});
 
// Create an asset and add it to a kit
const asset = await lingo.createColor(
  "#4349DC",
  { name: "Primary", notes: "The primary color for the brand." },
  { kitId: "kit-id", sectionId: "section-id" }
);

Downloading assets

The download endpoint is currently rate limited to 2000 every 5 minutes.

Download file

Download an asset file.

const fileData = await lingo.downloadAsset("123-asset-id", "PNG");

Arguments

assetID

string • required

The uuid of the asset to download.

options.type

string

A file type to convert the file. Default null for the original.

options.dimensions

string

Dimensions to resize the asset. Default null for original size.

options.dpi

number

A dpi to resize the image with. Default null.

Download URL

You can also retrieve a download URL which can be requested later. This is used internally by downloadAsset.

const downloadUrl = getAssetDownloadUrl("123-asset-id", "png");
// Fetch the url as desired
const file = await fetch(downloadUrl);

Asset types

Type

Notes

JPG

GIF

SVG

PDF

EPS

TIFF

COLOR

TEXT_STYLE

Font assets, the file type and variant are defined in the meta object.

SKETCH_LAYER

SKETCH_SYMBOL

SKETCH_LAYER_STYLE

SKETCH_TEXT_STYLE

TXT

DOCX

DOTX

INDD

KEYNOTE_THEME

KEYNOTE

PAGES_TEMPLATE

PAGES

POTX

PPTX

AI

PSD

MOV

MP4

LOTTIE

URL

Exports

File types

Lingo allows you to convert file types when downloading. The following table contains the available conversions for each file type.

Available exports for a specific asset can also be found in `asset.meta.filecuts`..

Original type

Available conversions

svg

png, pdf, eps

jpg

png

png

jpg

gif

jpg, png

eps

png

pdf

png

tiff

png, jpg

sketch

svg, png, pdf

Resizing images

Image assets can be resized when download. This property supports the following formats:

  • 100w - Set the width of the image. Height will be scaled to maintain aspect ratio.
  • 100h - Set the height of the image. Width will be scaled to maintain aspect ratio.
  • 100x100 - Resize the image to fit in a box of the specified dimensions. The image will be scaled to fit the box while maintaining aspect ratio.
  • @2x - Scale the image by a specified amount. Values can be less than 1 ex. @.5x
  • 100 - Scale the longest side of the image to the specified value. The other side will be scaled to maintain aspect ratio.

DPI

The following asset types allow exports at a specific DPI:

  • JPG
  • PNG
  • TIFF