Links API

Create, retrieve, update, and delete short links. The Links API supports custom slugs, custom domains, UTM parameters, device targeting, password protection, expiration, and tags.

A link represents a short URL that redirects to a destination. Links belong to a workspace and can be tagged, password-protected, and configured with UTM parameters and device-specific targets.

FieldTypeDescription
idstringUnique link identifier (e.g. lnk_abc123)
urlstringThe destination URL
short_urlstringThe full short URL including domain
slugstringThe slug portion of the short URL
domainstringThe domain used for the short link
titlestring | nullOptional title for the link
tagsstring[]Array of tag strings
clicksnumberTotal click count
utm_sourcestring | nullUTM source parameter
utm_mediumstring | nullUTM medium parameter
utm_campaignstring | nullUTM campaign parameter
expires_atstring | nullISO 8601 expiration timestamp
passwordstring | nullPassword protection (write-only, never returned in responses)
ios_targetstring | nulliOS-specific redirect URL
android_targetstring | nullAndroid-specific redirect URL
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last update timestamp

Retrieve a paginated list of links in the workspace. Supports filtering by tag, domain, search query, and date range.

GET/api/v1/links

Query parameters

ParameterTypeDefaultDescription
limitinteger25Number of items per page (max: 100)
cursorstringCursor from a previous response for pagination
searchstringSearch links by URL, slug, or title
tagstringFilter by tag name
domainstringFilter by domain
sortstringcreated_atSort field: created_at, clicks, updated_at
orderstringdescSort order: asc or desc
Request
curl "https://mask.pk/api/v1/links?limit=10&tag=campaign-q1" \
  -H "Authorization: Bearer mk_live_abc123def456"
Response
{
  "data": [
    {
      "id": "lnk_abc123",
      "url": "https://example.com/my-page",
      "short_url": "https://go.yourbrand.com/my-link",
      "slug": "my-link",
      "domain": "go.yourbrand.com",
      "title": "My Campaign Link",
      "tags": ["campaign-q1", "social"],
      "clicks": 142,
      "utm_source": "twitter",
      "utm_medium": "social",
      "utm_campaign": null,
      "expires_at": "2026-12-31T23:59:59Z",
      "ios_target": null,
      "android_target": null,
      "created_at": "2026-03-13T10:00:00Z",
      "updated_at": "2026-03-13T10:00:00Z"
    }
  ],
  "pagination": {
    "has_more": true,
    "cursor": "eyJpZCI6Imxua19hYmMxMjMifQ"
  }
}

Create a new short link. If no slug is provided, a random one is generated. If no domain is specified, the workspace default domain is used.

POST/api/v1/links

Request body

FieldTypeRequiredDescription
urlstringYesThe destination URL (must start with https://)
slugstringNoCustom slug (4-64 chars). Auto-generated if omitted.
domainstringNoCustom domain. Defaults to workspace domain.
titlestringNoDescriptive title for the link
tagsstring[]NoArray of tag strings for organizing links
utm_sourcestringNoAppended to the destination URL as a UTM parameter
utm_mediumstringNoUTM medium parameter
utm_campaignstringNoUTM campaign parameter
expires_atstringNoISO 8601 timestamp after which the link expires
passwordstringNoRequire this password before redirecting
ios_targetstringNoRedirect iOS users to this URL instead
android_targetstringNoRedirect Android users to this URL instead
Request
curl -X POST https://mask.pk/api/v1/links \
  -H "Authorization: Bearer mk_live_abc123def456" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/my-page",
    "slug": "my-link",
    "domain": "go.yourbrand.com",
    "title": "My Campaign Link",
    "tags": ["campaign-q1", "social"],
    "utm_source": "twitter",
    "utm_medium": "social",
    "expires_at": "2026-12-31T23:59:59Z"
  }'
Response — 201 Created
{
  "id": "lnk_abc123",
  "url": "https://example.com/my-page",
  "short_url": "https://go.yourbrand.com/my-link",
  "slug": "my-link",
  "domain": "go.yourbrand.com",
  "title": "My Campaign Link",
  "tags": ["campaign-q1", "social"],
  "clicks": 0,
  "utm_source": "twitter",
  "utm_medium": "social",
  "utm_campaign": null,
  "expires_at": "2026-12-31T23:59:59Z",
  "ios_target": null,
  "android_target": null,
  "created_at": "2026-03-13T10:00:00Z",
  "updated_at": "2026-03-13T10:00:00Z"
}

Retrieve a single link by its ID. Returns all link fields including UTM parameters and device targets.

GET/api/v1/links/:id
Request
curl https://mask.pk/api/v1/links/lnk_abc123 \
  -H "Authorization: Bearer mk_live_abc123def456"
Response
{
  "id": "lnk_abc123",
  "url": "https://example.com/my-page",
  "short_url": "https://go.yourbrand.com/my-link",
  "slug": "my-link",
  "domain": "go.yourbrand.com",
  "title": "My Campaign Link",
  "tags": ["campaign-q1", "social"],
  "clicks": 142,
  "utm_source": "twitter",
  "utm_medium": "social",
  "utm_campaign": null,
  "expires_at": "2026-12-31T23:59:59Z",
  "ios_target": null,
  "android_target": null,
  "created_at": "2026-03-13T10:00:00Z",
  "updated_at": "2026-03-13T10:00:00Z"
}

Update one or more fields on an existing link. Only the fields you include in the request body are modified. The slug and domain cannot be changed after creation.

PATCH/api/v1/links/:id
Request
curl -X PATCH https://mask.pk/api/v1/links/lnk_abc123 \
  -H "Authorization: Bearer mk_live_abc123def456" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/updated-page",
    "tags": ["campaign-q2", "email"],
    "expires_at": "2027-06-30T23:59:59Z"
  }'
Response
{
  "id": "lnk_abc123",
  "url": "https://example.com/updated-page",
  "short_url": "https://go.yourbrand.com/my-link",
  "slug": "my-link",
  "domain": "go.yourbrand.com",
  "title": "My Campaign Link",
  "tags": ["campaign-q2", "email"],
  "clicks": 142,
  "utm_source": "twitter",
  "utm_medium": "social",
  "utm_campaign": null,
  "expires_at": "2027-06-30T23:59:59Z",
  "ios_target": null,
  "android_target": null,
  "created_at": "2026-03-13T10:00:00Z",
  "updated_at": "2026-03-13T12:00:00Z"
}

Permanently delete a link. The short URL stops redirecting immediately. This action cannot be undone.

DELETE/api/v1/links/:id
Request
curl -X DELETE https://mask.pk/api/v1/links/lnk_abc123 \
  -H "Authorization: Bearer mk_live_abc123def456"
Response — 200 OK
{
  "deleted": true,
  "id": "lnk_abc123"
}