Introduction

This docs will help you to understand the API of LNQ.is.

The API can be used from any backend service, but not from the browser as the API key needs to be private and not exposed to the internet.

API Endpoints

Short Link

Create Short LinkPOST

This endpoint will create a short link for you.

Endpoint -/api/public/v2/create-url

Authorizaiton

To use the API, you need to have a valid API key. You can get one here.

  • Add the following headers to each request
  • Authorization: {APIKEY}required

Parameters

The request body should be a JSON object with the following fields:

  • originalURLrequiredThe URL you want to short. If protocol (http/https) is not provided, https would be automatically added.
  • shortURLCodeoptionalThe short code you want to use. If not provided, a random code will be generated.
  • generateShortCodeIfUnavailableoptionalIf the short code you want to use is already taken, you can set this to true to generate a new random one. Default is false.
  • titleoptionalThe title of the short link.
  • setLinkExpiryoptionalBoolean value to set if the link should expire. Default is false.
  • linkExpiryDateAndTimeoptionalRequired if setLinkExpiry is true. The date and time inISO 8601 format when the link should expire.
  • linkCloakingoptionalBoolean value to set if the link should be cloaked. Default is false.
  • setPasswordoptionalBoolean value to set if the link should be password protected. Default is false.
  • passwordoptionalRequired if setPassword is true. The password you want to use.

Response

  • success - 200Returns the short link object with link properties. Also contains a messages array for any warnings.
  • error - 4xx/5xxReturns the error object with error properties.
REQUEST
1curl -X POST \
2  'https://LNQ.is/api/public/v2/create-url' \
3  -H 'Authorization: xxxxxxxxxxxxxxxxxxxx' \
4  -H 'Content-Type: application/json' \
5  -d '{"originalURL": "https://example.com"}'
RESPONSE

{
  "createdAt": "2022-06-25T12:10:52.031Z",
  "title": "Example Link",
  "isLinkActive": true,
  "isLinkCloaked": true,
  "isPasswordProtected": true,
  "originalURL": "https://example.com",
  "shortURL": "https://LNQ.is/example",
  "shortURLCode": "example",
  "timesOpened": 0,
  "updatedAt": "2022-06-25T12:10:52.031Z",
  "linkExpiry": "2022-06-25T15:08:35.000Z",
  "messages": []
}