The SDK is currently in active development. For more details, see the U301 Postman docs.

Retrieve details of a short link

Retrieve the details of a short link using its domain and slug.

u301.links.get
import { U301 } from 'u301';

const apiKey = '<YOUR_API_KEY>';
const workspaceId = '<YOUR_WORKSPACE_ID>';

const u301 = new U301({
  apiKey,
  workspaceId,
});

// Retrieve a link by its short URL (domain/slug)
const link = await u301.links.get('u301.co/abc123');
console.log(link);

Request

NameLocationTypeRequiredDescription
AuthorizationHeaderstringBearer token used for authentication.
shortlinkPathstringThe short link (e.g., u301.co/abc123).

Response

NameTypeDescription
idstringUnique identifier of the link.
domainstringDomain used for the short link.
slugstringPath segment of the short link.
isCustomSlugbooleanWhether the slug was custom defined.
shortUrlstringThe full short URL (e.g., https://u301.co/abc123).
originalUrlstringThe original destination URL.
allowSearchEngineIndexingbooleanWhether search engines are allowed to index the link.
archivedbooleanWhether the link is archived.
suspendedbooleanWhether the link is suspended.
userIdstringID of the user who created the link.
workspaceIdstringID of the workspace the link belongs to.
commentstringOptional comment or note.
createdAtstringCreation date in ISO 8601 format.
updatedAtstringLast update date in ISO 8601 format.
response-example.json
{
  "id": "019a7d8c-4a85-7aa4-9862-ee2008f54854",
  "domain": "u301.co",
  "slug": "abc123",
  "isCustomSlug": false,
  "shortUrl": "https://u301.co/abc123",
  "originalUrl": "https://example.com",
  "allowSearchEngineIndexing": true,
  "archived": false,
  "suspended": false,
  "userId": "0196684a-3b57-7000-805b-88c32c3c5dc7",
  "workspaceId": "019aa063-4900-7304-8d51-3ca1294d0afb",
  "comment": "Marketing campaign",
  "createdAt": "2023-11-14T10:00:00.000Z",
  "updatedAt": "2023-11-15T12:00:00.000Z"
}

Last updated on

On this page