Documentation

    Amazon Web Services

    Microsoft Azure

    RapidAPI

    APILayer

Last Update: 2024-04-16

URL Shortener (RapidAPI)


Table of Content


API endpoint: Shorten
API endpoint: Remove
API endpoint: Track
Custom Domain Integration

API endpoint: Shorten


URL endpoint: https://url-shortener-by-silverlining-cloud.p.rapidapi.com/urlshortener/shorten


Method: POST


"header": {
  "X-RapidAPI-Key": STRING,
  "X-RapidAPI-Host": STRING,
  "Content-Type": "text/plain"
}


"body": {
  "longUrl": STRING,
  "customKey": STRING,
  "expireHours": NUMBER,
  "customDomain": STRING
}



Required

"longUrl": The destination URL to which you want to redirect. The protocol (e.g., http, https) must be included. The maximum supported length is 2000 characters.

 
Optional

"customKey": Define a custom key ("aws3.link/customKey"). Passing no customKey will generate a random string as key.

 "expireHours": Define after how many hours the shortened URL will expire. Needs to be between 1 and 8760 (= 1 year). Default is 0, which means non-expiring link.

"customDomain": Pass the domain name you want to shorten your URL. Please see paragraph 'Custom domain integration' below before using it.
Public facing custom domain: an.si - Try it out by passing 'an.si' to customDomain parameter.

Response:


"body": {
  "shortUrl": STRING,
  "metadata": {
    "longUrl": STRING,
    "domain": STRING,
    "key": STRING,
    "expiration": DATE,
  }
}
API endpoint: Remove


URL endpoint: https://url-shortener-by-silverlining-cloud.p.rapidapi.com/urlshortener/remove


Method: POST


"header": {
  "X-RapidAPI-Key": STRING,
  "X-RapidAPI-Host": STRING,
  "Content-Type": "text/plain"
}


"body": {
  "key": STRING,
  "customDomain": STRING
}


Required
 
"key": The key of the short URL you want to delete. 'myKey' for aws3.link/myKey e.g.

Optional

"customDomain": If you are using a custom domain, specify to which domain the provided key belongs to.


Response:


"body": {
  "message": "Provided key has been removed",
  "metadata": {
    "longUrl": STRING,
    "domain": STRING,
    "key": STRING
  }
}

API endpoint: Track


URL endpoint: https://url-shortener-by-silverlining-cloud.p.rapidapi.com/urlshortener/track


Method: POST


"header": {
  "X-RapidAPI-Key": STRING,
  "X-RapidAPI-Host": STRING,
  "Content-Type": "text/plain"
}


"body": {
  "key": STRING,
  "customDomain": STRING
}

Required 
"key": The key of the short URL you want to track. 'myKey' for aws3.link/myKey e.g.

Optional

"customDomain": If you are using a custom domain, specify to which domain the provided key belongs to.

Response:


"body": {
  "totalHits": NUMBER,
  "hits": [{
    "date": DATE,
    "time": TIME,
    "ip": STRING,
    "method": STRING,
    "resource": STRING,
    "referrer": STRING,
    "user": {
      "platform": {
        "name": STRING,
        "version": STRING,
      },
      "os": {
        "name": STRING,
      },
      "bot": BOOLEAN,
      "flavour": {
        "name": STRING,
        "version": STRING,
      },
      "browser": {
        "name": STRING,
        "version": STRING
      }
    },
    "rawUserAgent": STRING,
    "timeTaken": FLOAT
  }],
  "metadata": {
    "longUrl": STRING,
    "domain": STRING,
    "key": STRING
  }
}

"totalHits": Number of successfully registered clicks

"hits: List of actual click. Consists of: date and time that URL was clicked, IP address click, referring URL and detailed information of the users device.

"metadata": Long URL, (custom) domain and key of the request

Custom Domain Integration


Our URL shortening service offers flexibility through our Pay-Per-Use subscription, allowing access to publicly available domains such as aws3.link, azr.link, goog.link, and an.si. For users seeking a more personalized approach, our Pro plan enables the integration of your own domain or subdomain. Choosing the Pro plan allows you to use your custom domain with our service. The integration process requires you to add specific DNS records to your domain's settings. Our team will provide guidance on these settings once you subscribe to the Pro plan, ensuring a smooth integration process. This feature not only enhances your branding but also provides a more cohesive user experience by using a domain familiar to your audience.

Troubleshooting

"message": "Invalid Input: The request contains incorrectly formatted parameters"

This error message means that the body parameters you have passed are malformed. Please follow the instructions given in the endpoint descriptions. Common issues include forgetting to add a comma (',') after every parameter line or missing a parenthesis somewhere.

"message": "Endpoint request timed out"

You receive this error message when the code execution exceeds the maximum timeout (usually 29 seconds).