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.
Create a short link from a URL
POSThttps://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.
Max Pack Required
Headers
Name
Type
Description
Authorization*
string
Format: Authorization: Bearer API_KEY. See Overview for more information.
Request Body
Name
Type
Description
url*
string
URL to be shortened. Must be a valid URL starting with https://
utmId
string
Used to identify which Google Analytics ads campaign this referral references. Use utm_id to identify a specific ads campaign.
utmSource
string
Used to identify a search engine, newsletter name, or other source.
utmMedium
string
Used to identify a medium such as email or cost-per-click.
utmCampaign
string
Used for keyword analysis. Used to identify a specific product promotion or strategic campaign.
utmTerm
string
Used for paid search. Used to note the keywords for this ad.
utmContent
string
Used for A/B testing and content-targeted ads. Used to differentiate ads or links that point to the same URL.
{"action":"request","status":"error","code":126, "message": "Shorten URL failed. Please verify the URL is properly formatted and the correct UTM parameters are used."
}
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.
Max Pack Required
Path Parameters
Name
Type
Description
id
string
Provide the shortened link ID returned from the POST /links request as a path parameter. For example: https://app.ayrshare.com/api/links/yC0fTl
If no link ID is provided, all links are returned.
Query Parameters
Name
Type
Description
fromCreatedDate
string
Get history of links shortened after this date. Accepts a UTC date time. For example, use format "YYYY-MM-DDThh:mm:ssZ" and send as "2023-07-08T12:30:00Z".
toCreatedDate
string
Get history of links shortened before this date. Accepts a UTC date time. For example, use format "YYYY-MM-DDThh:mm:ssZ" and send as "2023-07-08T12:30:00Z".
fromClickDate
string
Get history of links clicked after this date. Accepts a UTC date time. For example, use format "YYYY-MM-DDThh:mm:ssZ" and send as "2023-07-08T12:30:00Z".
toClickDate
string
Get history links clicked after this date. Accepts a UTC date time. For example, use format "YYYY-MM-DDThh:mm:ssZ" and send as "2023-07-08T12:30:00Z".
Headers
Name
Type
Description
Authorization*
string
Format: Authorization: Bearer API_KEY. See Overview for more information.
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.