Click the above button to generate a token, and make sure to copy it from the popup because this token won't be visible afterward. However, you can regenerate a token.
fetch('https://tini.fyi/api/v1/url/create', {
method: 'POST',
headers: {
"Authorization": 'Bearer YOUR_TOKEN',
"Content-Type": 'application/json'
},
body: JSON.stringify({
destination: YOUR_URL,
}),
}).then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error(error))
{
"status": "success",
"data": {
"id": "b6a07635-dfaf-4eef-b818-705549fd3735",
"destination": "https://app.tini.fyi",
"shortUrl": "https://tini.fyi/new",
"createdAt": "2023-04-29T05:15:58.085Z"
}