Retrieve the details of a short link using its domain and slug.
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
| Name | Location | Type | Required | Description |
|---|---|---|---|---|
| Authorization | Header | string | Bearer token used for authentication. | |
| shortlink | Path | string | The short link (e.g., u301.co/abc123). |
Response
| Name | Type | Description |
|---|---|---|
| id | string | Unique identifier of the link. |
| domain | string | Domain used for the short link. |
| slug | string | Path segment of the short link. |
| isCustomSlug | boolean | Whether the slug was custom defined. |
| shortUrl | string | The full short URL (e.g., https://u301.co/abc123). |
| originalUrl | string | The original destination URL. |
| allowSearchEngineIndexing | boolean | Whether search engines are allowed to index the link. |
| archived | boolean | Whether the link is archived. |
| suspended | boolean | Whether the link is suspended. |
| userId | string | ID of the user who created the link. |
| workspaceId | string | ID of the workspace the link belongs to. |
| comment | string | Optional comment or note. |
| createdAt | string | Creation date in ISO 8601 format. |
| updatedAt | string | Last update date in ISO 8601 format. |
{
"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