Short Link API Guide
Create short links, update destinations, control availability, and read click counts with account-scoped link management.
Create and manage short links
Turn a destination URL into a shorter link for sharing. Update its destination, disable it when a campaign ends, or set an expiration time. Management operations require an authorized paid AppKey; visitors do not need your AppKey to follow a short link. Never include your AppKey in a publicly shared URL.
View API details or open the Demo.
Create a link
curl --request POST \
'https://api.gugudata.io/v1/shortLinks?appkey=YOUR_APPKEY' \
--header 'Content-Type: application/json' \
--data '{"longUrl":"https://gugudata.io/list/"}'
longUrl must be a complete HTTP or HTTPS address, up to 8,192 characters. Do
not include embedded login credentials or control characters. Destination paths
and query parameters are retained. A short link cannot point back to its own
short-link domain.
Optionally supply shortLinkId: 4–32 letters, digits, underscores or hyphens.
Reserved and existing identifiers cannot be used. Omit it to receive a generated
identifier. An optional expireTime must be in the future.
Work with an existing link
| Operation | Request |
|---|---|
| Read your link | GET /v1/shortLinks/{code} with query AppKey |
| Update your link | PATCH /v1/shortLinks/{code} with query AppKey and JSON body |
| API redirect | GET /v1/shortLinks/{code}:redirect; no AppKey is needed |
| Follow a link | Open the returned shortUrl; no AppKey is needed |
For updates, provide at least one of longUrl, expireTime or state. State is
ACTIVE or DISABLED. Management is account-scoped: an AppKey does not grant
access to another account’s links. Disabled and expired links do not redirect.
The API redirect responds with HTTP 302 and a Location header. Treat HTTP 410
as an expired or disabled link and HTTP 404 as an unavailable identifier.
Read the response
The data object includes name, shortLinkId, shortUrl, longUrl, state,
expireTime, clickCount, lastAccessTime, createTime and updateTime when
available. Save the returned identifier for later management. Optional timestamps
may be absent when no corresponding event has occurred.
Click counts measure redirect requests, not unique people. Preview bots and automated clients can follow links, so do not treat this count as verified human engagement or a conversion metric.
Handle failures
Correct invalid input before retrying. Choose another identifier after a conflict. Verify account access when management is forbidden or a link cannot be found. Do not repeatedly retry creation after an uncertain network result without first checking whether the requested custom identifier was created.
The public Demo is a reserved shared example link, not an editable customer link. Its count reflects redirects to that shared example, not your campaign traffic. Use your own link’s management response for campaign-specific usage information.
The Demo caches a successful response for 15 minutes. Its count can therefore lag
behind recent redirects. Check X-GuGuData-Demo-Mode and
X-GuGuData-Generated-At for the sample’s source and generation time.