Free REST API

TinySRC Developer API

Integrate URL shortening into your applications with our simple REST API. Create short links, add password protection, set expiration times, and track analytics — all programmatically.

FREE
No API Key
REST
JSON Format
HTTPS
Secure
8+
Languages

Quick Start — Try it now

curl -X POST "https://api.tinysrc.me/v1/create" -H "Content-Type: application/json" -d '{"url":"https://example.com"}'
Code Examples

Ready-to-Use Code Snippets

Copy and paste these examples into your project. Available in 8 popular programming languages.

bash
curl -X POST "https://api.tinysrc.me/v1/create" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "url": "https://example.com",
    "auth_required": 0,
    "password": "",
    "expiration_time": ""
  }'
javascript
const response = await fetch("https://api.tinysrc.me/v1/create", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: JSON.stringify({
    url: "https://example.com",
    auth_required: 0,
    password: "",
    expiration_time: ""
  })
});

const data = await response.json();
console.log("Short URL:", data.url);
python
import requests

response = requests.post(
    "https://api.tinysrc.me/v1/create",
    json={
        "url": "https://example.com",
        "auth_required": 0,
        "password": "",
        "expiration_time": ""
    },
    headers={"Accept": "application/json"}
)

data = response.json()
print("Short URL:", data["url"])
php
<?php

$ch = curl_init("https://api.tinysrc.me/v1/create");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Content-Type: application/json",
        "Accept: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://example.com",
        "auth_required" => 0,
        "password" => "",
        "expiration_time" => ""
    ])
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo "Short URL: " . $data["url"];
go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "io"
)

func main() {
    payload := map[string]interface{}{
        "url":             "https://example.com",
        "auth_required":   0,
        "password":        "",
        "expiration_time": "",
    }
    body, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", "https://api.tinysrc.me/v1/create", bytes.NewReader(body))
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Accept", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    respBody, _ := io.ReadAll(resp.Body)
    var result map[string]interface{}
    json.Unmarshal(respBody, &result)
    fmt.Println("Short URL:", result["url"])
}
ruby
require "net/http"
require "json"
require "uri"

uri = URI("https://api.tinysrc.me/v1/create")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request.body = {
  url: "https://example.com",
  auth_required: 0,
  password: "",
  expiration_time: ""
}.to_json

response = http.request(request)
data = JSON.parse(response.body)
puts "Short URL: #{data['url']}"
csharp
using System.Net.Http;
using System.Text;
using System.Text.Json;

var client = new HttpClient();
var payload = new {
    url = "https://example.com",
    auth_required = 0,
    password = "",
    expiration_time = ""
};

var content = new StringContent(
    JsonSerializer.Serialize(payload),
    Encoding.UTF8,
    "application/json"
);

var response = await client.PostAsync(
    "https://api.tinysrc.me/v1/create",
    content
);

var json = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize<JsonElement>(json);
Console.WriteLine($"Short URL: {result.GetProperty(\"url\")}");
java
import java.net.http.*;
import java.net.URI;

var client = HttpClient.newHttpClient();
var payload = """
    {
        "url": "https://example.com",
        "auth_required": 0,
        "password": "",
        "expiration_time": ""
    }
    """;

var request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.tinysrc.me/v1/create"))
    .header("Content-Type", "application/json")
    .header("Accept", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(payload))
    .build();

var response = client.send(request,
    HttpResponse.BodyHandlers.ofString());

System.out.println(response.body());
API Reference

POST /v1/create

Create a new shortened URL

POST https://api.tinysrc.me/v1/create

Request Body

{
  "url": "https://example.com/very/long/url",
  "auth_required": 0,
  "password": "",
  "expiration_time": ""
}
url
string • required

The original long URL to shorten

auth_required
int • optional

Set to 1 to require authentication, 0 otherwise

password
string • optional

Password to protect the short link

expiration_time
string • optional

Expiration time for the link

Response

{
  "url": "https://tinysrc.me/abc123",
  "is_free": true,
  "stat_url": "https://tinysrc.me/stats/abc123",
  "stat_password": "",
  "password": "",
  "auth_required": 0
}
url
string

The shortened URL

is_free
boolean

Whether the link was created in free mode

stat_url
string

URL to view click analytics

stat_password
string

Password for the stats page