Access to a terminal (Command Prompt or PowerShell on Windows, Terminal on Mac)
Node.js installed on your computer (needed for the JavaScript and SDK examples)
01
Create an API key
An API key is like a password that identifies you when your code talks to lyng. Without it, lyng won't know who is making the request and will reject it.
2.Click New project and give it a name (e.g. "My first project")
3.Inside the project, click Create key
4.Copy the key that appears. It starts with lk_
Save your key somewhere safe. It is only shown once. If you lose it, you will need to create a new one. Never share it or put it in code that others can see.
02
Send your first request
Now you'll send a request to lyng asking it to shorten a URL. Replace lk_your_key in the code below with your actual API key.
Using Node.js v18+, install the @lyng/sdk package for full TypeScript support. Save your file as index.mjs and run it with node --env-file=.env index.mjs.
shortUrl is the complete short link, ready to share with anyone
slug is the short unique code at the end of the URL (e.g. abc123)
Got an error instead? The most common issues are a wrong API key (double-check you copied it correctly) or forgetting to replace lk_your_key. See the Error codes page for a full list.
What's next
You've made your first API call. Here's where to go from here: