Api-documentation-beta-v1

Automate and enhance your links with the powerful Lnk8 API

Vishnu
Vishnu

Aug 6, 2024 - 5 min read

Automate and enhance your links with the powerful Lnk8 API

Endpoint

https://lnk8.co/api/public/v1


Authorization

To get the API Key, email [email protected] with associated email id.

Include the api key in headers with custom property 'x-api-key'

x-api-key : <Your API Key>

All the endpoints require this header


Error Responses

On erroring you will get an appropriate status code with the reason in the following structure

{
  error:<Reason for error>
}


Create Short Url

This will let you create new short urls.

Method - POST Path - /url/create

Payload -

{
  "url":url,
  "slug"?:string,
  "domain"?:string,
  "expiry"?:ISODateString
}

url - is compulsory and should be a valid url and should start with https://

domain - is optional, if not provided will default to lnk8.io . domain should not include the protocol. only domains which are verified in your account are accepted.

slug - is optional, if not provided will default to random 6 digit string. you can provide any valid slug which matches this regex ^[a-z0-9]+(?:-[a-z0-9]+)*$

expiry - is optional, if not provided, the shortened link will stay forever unless deleted. expiry should be an ISO Date string YYYY-MM-DDTHH:mm:ss.sssZ with at-least 1 minute from current time

Response -

{
  "shortUrl": string,
  "url": url,
  "expiry":ISODateString
}

In response you will get the created short url and the original long url


 

Update Short Url

This will let you update target urls for already created short urls

Method - PUT Path - /url/update

Payload -

{
  "url":url,
  "shortUrl":string,
  "expiry"?:ISODateString
}

url - is compulsory and should be a valid url and should start with https://

shortUrl - is compulsory, in the format domain/slug, it should not include any protocol, shortUrl should be associated with your account .

expiry - is optional, if not provided, the shortened link will retain previous expiry setting. expiry should be an ISO Date string YYYY-MM-DDTHH:mm:ss.sssZ with at-least 1 minute from current time. To remove previously set expiry, pass an empty string, expiry:"" .

Response -

{
  "shortUrl": string,
  "url": url,
  "expiry":ISODateString
}

In response you will get the same short url and the updated long url


Delete Short Url

This will let you delete short urls from your account

Method - DELETE Path - /url/delete

Search Params -

?shortUrl=<your-short-url>

shortUrl - is compulsory, in the format domain/slug, it should not include any protocol, shortUrl should be associated with your account

Response -

{
  "shortUrl": string,
  "url": url,
  "expiry":ISODateString
}

In response you will get the deleted short url and its long url


Read Short Url

This will let you read a short url and its target url

Method - GET Path - /url/read

SearchParams -

?shortUrl=<your-short-url>

shortUrl - is compulsory, in the format domain/slug, it should not include any protocol, shortUrl should be associated with your account

Response -

{
  "shortUrl": string,
  "url": url,
  "expiry":ISODateString
}

In response you will get the short url and its associated long url


List Domains

This will let you get the list of domains associated with your account

Method - GET Path - /domains

Response -

{
    "domains": [
        {
            "name": string,
            "active": boolean,
            "verified": boolean,
            "fallbackUrl": string,
            "domainRedirect": string
        }
    ]
}

In response you will get the list of domains associated with your account 

Explore other blogs

View all blogs

Lnk8 is a growing database of experts across industries. Sign up as an expert or book a service with an expert on Lnk8.

E mail : [email protected]

© lnk8.co - 2024