links

Link shortener and analytics endpoint

With the links endpoint your can shorten links to include in social posts.

The Ayrshare link shortener offers several valuable benefits social publishing.

  • Condense long and complex URLs for more visually appealing, concise, and memorable.

  • Analytics and tracking capabilities, allowing you to monitor link performance, engagement, and audience insights.

  • Save valuable character space, especially on platforms like Twitter where character limits are stringent.

  • Add a custom link domain with your own url.

POST https://app.ayrshare.com/api/links

Provide a URL and a shortened link will be returned. Analytics can then be gathered on the clicks, browser type, etc.

Submitting the same URL for shortening will always result in the same shortened link. To generate a unique shortened link for the same URL, you can add extra query parameters to it. For example, appending a unique identifier like https://ayrshare.com?uniqueId=123 will create a distinct shortened link.

You may also include UTM parameters, which will be embedded in the shortened URL link.

Headers

Request Body

{
    "created": "2023-07-17T15:20:51.118Z",
    "id": "yC0fTl",
    "originalUrl": "https://www.ayrshare.com/?utm_source=looking",
    "shortUrl": "https://ayrs.io/yC0fTl",
    "status": "success",
    "utmSource": "looking"
}

Request Examples

curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url": "https://www.ayrshare.com", "utmSource": "google_ads"}' \
-X POST https://app.ayrshare.com/api/links

GET https://app.ayrshare.com/api/links/:id

Return analytics for all shortened links or a single link for a given link ID. For example:

https://app.ayrshare.com/api/links/yC0fTl returns analytics for ID yC0fTl

https://app.ayrshare.com/api/links returns all link analytics.

Path Parameters

Query Parameters

Headers

{
    "status": "success",
    "analytics": {
        "browserCounts": {
            "chrome": 15
        },
        "created": "2023-06-29T00:57:12.220Z",
        "id": "yC0fTl",
        "originalUrl": "https://www.ayrshare.com/?utm_source=google_ads",
        "refererCounts": {},
        "shortUrl": "https://ayrs.io/yC0fTl",
        "socialClicks": {},
        "status": "success",
        "totalClicks": 15,
        "utmSource": "google_ads"
    }
}

Request Examples

curl \
-H "Authorization: Bearer API_Key" \
-H 'Content-Type: application/json' \
-X GET https://app.ayrshare.com/api/links/yC0fTl

A custom link domain allows you to personalize and brand the domain name used for link shortening and redirection. Instead of using a generic link shortener domain (e.g., bit.ly, ayr.app), a custom link domain allows you to use own domain name to create shortened links.

Please contact us to set up your custom domain.

Last updated