> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linquid.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Link Advanced Endpoints

> Additional link endpoints for aggregate stats, external-ID lookup, and upsert workflows

# Link Advanced Endpoints

## Endpoints

* `GET /api/links/stats`
* `GET /api/links/ext/:externalId`
* `PUT /api/links/upsert`
* `POST /api/links/:linkId/transfer`

## Access

* `links:read` for stats and external-id lookup
* `links:create` for upsert
* `links:delete` for transfer

## `GET /api/links/stats`

Returns workspace-level aggregate link stats:

* `totalLinks`
* `totalClicks`
* `totalUniqueClicks`

## `GET /api/links/ext/:externalId`

Looks up a link by external identifier in workspace scope.

Supports `ext_` prefixed identifiers and returns link object with resolved `shortUrl`.

## `PUT /api/links/upsert`

Upserts by link identity rules using create-link schema payload.

Use this when external systems should safely create-or-update link records in one call.

## `POST /api/links/:linkId/transfer`

Transfers a link to another campaign/workspace context according to route policy and permission checks.

## Common errors

* `404`: link not found by `externalId` or `linkId`
* `400`: invalid upsert/transfer payload
* `403`: missing permission or feature gate
