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

List all short links in your workspace

You can list all short links in your workspace using the u301.links.list method. Here's a minimal example to demonstrate how to list links.

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

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

const u301 = new U301({
  apiKey,
  workspaceId,
});
const links = await u301.links.list(); // [!code highlight]
console.log(links);

the response

Request

NameLocationTypeRequiredDefaultDescription
AuthorizationHeaderstringBearer token used for authentication.
workspaceIdQuerystringWorkspace identifier for multi‑tenant routing.
pageQuerynumberPage number for pagination.
perPageQuerynumber10Number of items per page.

Response

NameTypeDescription
linksarrayArray of link objects.
links[].idstringUnique identifier of the link.
links[].domainNamestringDomain used for the short link.
links[].slugstringPath segment of the short link.
links[].isCustomSlugbooleanWhether the slug was provided by the user.
links[].shortUrlstringFully qualified short link ({domainName}/{slug}).
links[].originalUrlstringOriginal destination URL.
links[].allowSearchEngineIndexingbooleanWhether the link is indexable by search engines.
links[].archivedbooleanWhether the link is archived.
links[].suspendedbooleanWhether the link is suspended.
links[].statsClicksnumberTotal number of clicks.
links[].expiresAtstringExpiration timestamp; null if no expiry.
links[].userIdstringIdentifier of the link owner.
links[].workspaceIdstringWorkspace identifier.
links[].commentstringOptional note attached to the link.
links[].createdAtstringTimestamp of link creation.
links[].updatedAtstringTimestamp of last update; null if never updated.
metadataobjectPagination metadata.
metadata.totalnumberTotal number of links.
metadata.perPagenumberNumber of items per page.
metadata.pagenumberCurrent page number.
response-example.json

{
  "links": [
    {
      "id": "019a8869-1700-7333-901b-0bfbc06eae6c",
      "domainName": "u301.co",
      "slug": "CWbEhQ",
      "isCustomSlug": false,
      "shortUrl": "u301.co/CWbEhQ",
      "originalUrl": "https://nextjs.org/docs/app/guides/upgrading/version-16",
      "allowSearchEngineIndexing": false,
      "archived": false,
      "suspended": false,
      "statsClicks": 0,
      "expiresAt": null,
      "userId": "0196684a-3b57-7001-bd58-8c9bb1fcff27",
      "workspaceId": "0196684a-3b57-7000-805b-88c32c3c5dc7",
      "comment": "",
      "createdAt": "2025-11-15T16:46:19.904Z",
      "updatedAt": null
    },
    {
      "id": "019a7dbe-a9ce-7d44-8bb6-2b6ed03aa48a",
      "domainName": "u301.co",
      "slug": "4jnB",
      "isCustomSlug": false,
      "shortUrl": "u301.co/4jnB",
      "originalUrl": "https://example.com",
      "allowSearchEngineIndexing": false,
      "archived": false,
      "suspended": false,
      "statsClicks": 1,
      "expiresAt": null,
      "userId": "0196684a-3b57-7001-bd58-8c9bb1fcff27",
      "workspaceId": "0196684a-3b57-7000-805b-88c32c3c5dc7",
      "comment": "",
      "createdAt": "2025-11-13T15:03:58.670Z",
      "updatedAt": null
    },
    //...
  ],
  "metadata": {
    "total": 48,
    "perPage": 20,
    "page": 1
  }
}

Last updated on

On this page