API basics & SDKs
Use official Rust, Go, Python, Node.js, .NET, Ruby, and Laravel packages to integrate faster.
The T.LY API is the fastest way to create, manage, and analyze short links from your own apps and scripts. If you are integrating in code, these official packages save time versus building raw HTTP calls from scratch. If you want the broader product overview first, read URL Shortener API.
Start here: docs + API token
- Open the API docs to review endpoints and request shapes.
- Create an API token in Settings > API.
- Store your token in an environment variable (for example,
TLY_API_TOKEN), not in source code.
Prefer a terminal workflow? Install the T.LY CLI with Homebrew or Chocolatey and use the same API token there.
Official API packages
Choose the package that matches your stack. Each one uses the same T.LY API token.
Rust crate
crates.io/crates/tly-api-client
[dependencies]
tly-api-client = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
use tly_api_client::{CreateShortLinkRequest, TlyClient};
#[tokio::main]
async fn main() -> Result<(), Box> {
let client = TlyClient::new("your-api-token")?;
let short_link = client
.create_short_link(&CreateShortLinkRequest {
long_url: "https://example.com".into(),
description: Some("Docs example".into()),
..Default::default()
})
.await?;
println!("Created {}", short_link.short_url);
Ok(())
}
Go SDK
github.com/tlyshortener/t.ly-go-url-shortener-api
go get github.com/timleland/t.ly-go-url-shortener-api
Use the module path above for go get/import (the package currently publishes that module path).
client := tly.NewClient(os.Getenv("TLY_API_TOKEN"))
shortLink, err := client.CreateShortLink(tly.ShortLinkCreateRequest{
LongURL: "https://example.com",
})
Python SDK
pypi.org/project/tly-url-shortener-api
pip install tly-url-shortener-api
import os from tly_url_shortener import TlyClient client = TlyClient(api_token=os.environ["TLY_API_TOKEN"]) created = client.create_short_link(long_url="https://example.com") print(created["short_url"])
Node.js SDK
npm install tly-api
const TlyClient = require('tly-api');
const tly = new TlyClient(process.env.TLY_API_TOKEN);
async function runExample() {
const createdLink = await tly.createShortLink({
long_url: 'https://example.com',
});
console.log(createdLink.short_url);
}
runExample();
.NET / NuGet package
nuget.org/packages/Tly.UrlShortener
dotnet add package Tly.UrlShortener
using Tly;
var client = new TlyClient("YOUR_TLY_API_KEY");
var shortLink = await client.CreateShortLinkAsync(new CreateShortLinkRequest
{
LongUrl = "https://example.com/products/spring-launch",
});
Console.WriteLine(shortLink.ShortUrl);
Ruby gem
rubygems.org/gems/tly-url-shortener-api
github.com/tlyshortener/t.ly-ruby-url-shortener-api
gem install tly-url-shortener-api
# Gemfile gem 'tly-url-shortener-api'
# .env TLY_API_TOKEN=your_api_token_here
require "tly_url_shortener_api"
client = Tly::UrlShortenerApi::Client.new(api_token: ENV.fetch("TLY_API_TOKEN"))
response = client.shorten_link(long_url: "https://example.com")
puts response.status
Laravel package
packagist.org/packages/tly/laravel-url-shortener-api
composer require tly/laravel-url-shortener-api
php artisan vendor:publish --provider="TLY\\LaravelUrlShortener\\TLYServiceProvider" --tag=config
# .env TLY_API_TOKEN=your_api_token_here
use TLY\LaravelUrlShortener\Facades\TLYApi;
$response = TLYApi::create([
'long_url' => 'https://example.com',
]);
What these packages cover
- Core short-link actions: create, get, update, delete, expand, and list.
- Stats/analytics lookups for existing short links.
- Tag and pixel management in SDKs that include those endpoints.
- The client libraries map closely to the same REST endpoints in API docs, so request fields and responses stay consistent across languages.
Helpful integration tips
- Start with one smoke test: create link, then expand it, before wiring full automation.
- Treat tokens like passwords: rotate if exposed and never commit them to git.
- If you need an endpoint not exposed in your package version, use the direct endpoint docs at /docs.
Need more help?
If you still have questions, contact [email protected] or use the contact form. For abuse or suspicious links, use Report Abuse. For feature requests, email [email protected].