Getting started
You'll create an API key on your RoutePath.to account, send one authenticated request, and open the short link you get back. It takes a few minutes.
1. Get an API key
API keys belong to your RoutePath.to account. There is no separate developer login. Create a free account (or sign in), then open Settings and create a key. Give it the links.write scope to create links. The key is shown once, so copy it into an environment variable.
Shell
export ROUTEPATH_API_KEY="rpto_..."2. Create a short link
curl
curl -X POST https://www.routepath.to/links-api/api/v1/links \
-H "Authorization: Bearer $ROUTEPATH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"destination_url":"https://example.com/launch","label":"Launch page"}'JavaScript (Node 18+)
const res = await fetch("https://www.routepath.to/links-api/api/v1/links", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ROUTEPATH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ destination_url: "https://example.com/launch", label: "Launch page" }),
});
const body = await res.json();
if (!res.ok) throw new Error(`${res.status}: ${body.error}`);
console.log(body.link.short_url);A successful request returns 201 with the link:
Response (shortened)
{
"link": {
"id": "0d3c…",
"slug": "4ngjbwk",
"short_url": "https://routepath.to/4ngjbwk",
"destination_url": "https://example.com/launch",
"label": "Launch page",
"status": "active",
"click_count": 0
}
}3. Use the link
Open short_url. It redirects to your destination_url. You can change the destination later and the short link stays the same.
4. What next
- Read the authentication notes on scopes and revoking keys.
- Browse every endpoint in the API reference.
- Check your allowances in limits & errors.