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:
originalURL
requiredThe URL you want to short. If protocol (http/https) is not provided, https would be automatically added.shortURLCode
optionalThe short code you want to use. If not provided, a random code will be generated.generateShortCodeIfUnavailable
optionalIf 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.title
optionalThe title of the short link.setLinkExpiry
optionalBoolean value to set if the link should expire. Default is false.linkExpiryDateAndTime
optionalRequired ifsetLinkExpiry
is true. The date and time inISO 8601 format when the link should expire.linkCloaking
optionalBoolean value to set if the link should be cloaked. Default is false.setPassword
optionalBoolean value to set if the link should be password protected. Default is false.password
optionalRequired ifsetPassword
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": []
}