Language
Direct links are stable CDN URLs that point to an asset's file. Unlike download URLs, a direct link's URL remains the same even when the underlying asset file is updated, making them ideal for embedding assets in external websites, tools, or documents.
Each direct link can optionally be given a name to help identify its purpose. Only one active direct link per asset can have the same name.
Typescript
const directLinks = await lingo.getDirectLinksForAsset("asset-uuid");
const link = directLinks[0];
console.log(`Direct link: ${link.url}`);
Direct Link Properties
id
number
The unique identifier of the direct link.
assetId
string
The uuid of the asset this direct link points to.
spaceId
number
The id of the space the asset belongs to.
name
string
An optional name for the direct link.
url
string
The CDN URL for the asset file.
dateAdded
date
The date and time the direct link was created.
dateUpdated
date
The date and time the direct link was last updated.
Retrieve all direct links for an asset.
Typescript
async getDirectLinksForAsset(assetId: string): Promise<DirectLink[]>
Arguments
assetId
string • required
The uuid of the asset to fetch direct links for.
Typescript
const directLinks = await lingo.getDirectLinksForAsset("1C6A4A2F-3C6B-4DF1-B321-3FC77FD8185D");
console.log(directLinks);
// [{ id: 42, url: "https://assets.lingoapp.com/abc1234/logo.png", ... }]
Create a new direct link for an asset. The link will point to the asset's current file and the URL will persist across file updates.
Creating content requires an API token with write access enabled.
Typescript
async createDirectLink(assetId: string, name?: string): Promise<DirectLink>
Arguments
assetId
string • required
The uuid of the asset to create a direct link for.
name
string
An optional name for the direct link.
Typescript
const directLink = await lingo.createDirectLink(
"1C6A4A2F-3C6B-4DF1-B321-3FC77FD8185D",
"Website embed"
);
console.log(directLink.url);
// "https://assets.lingoapp.com/abc1234/logo.png"