How lyng knows who you are when you make API requests.
Every request you make to the lyng API needs to include your API key. Think of it like showing your ID at the door. Without it, lyng won't let you in.
You send your key in a special part of the request called a header. Headers are extra pieces of information that travel alongside your request, kind of like the address and return address written on an envelope. The specific header lyng looks for is called Authorization.
The value of the Authorization header must be the word Bearer followed by a space, then your API key. This is a standard format used across most APIs on the internet.
Your API key starts with lk_ and is a long string of random characters. You get it from your Developer dashboard.
What the header looks like
Authorization: Bearer lk_your_api_key_hereExample using curl in terminal
curl https://lyng.my.id/api/v1/links \
-H "Authorization: Bearer lk_your_key"If you send a request without an API key, or with a wrong one, lyng will reject your request and return an error:
{ "error": "Invalid or missing API key" }This comes with an HTTP status code of 401, which means "Unauthorized". Double-check your key is correct and that you haven't accidentally added extra spaces.
process.env.LYNG_API_KEY in Node.js.