Create a new short URL
curl --request POST \
--url https://pref.rio/link/api/urls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": "https://example.com",
"description": "A great website",
"expires_at": "2024-12-31T23:59:59Z",
"image_url": "https://example.com/image.jpg",
"short_path": "custom-path",
"title": "My Website"
}
'import requests
url = "https://pref.rio/link/api/urls"
payload = {
"destination": "https://example.com",
"description": "A great website",
"expires_at": "2024-12-31T23:59:59Z",
"image_url": "https://example.com/image.jpg",
"short_path": "custom-path",
"title": "My Website"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
destination: 'https://example.com',
description: 'A great website',
expires_at: '2024-12-31T23:59:59Z',
image_url: 'https://example.com/image.jpg',
short_path: 'custom-path',
title: 'My Website'
})
};
fetch('https://pref.rio/link/api/urls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pref.rio/link/api/urls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'destination' => 'https://example.com',
'description' => 'A great website',
'expires_at' => '2024-12-31T23:59:59Z',
'image_url' => 'https://example.com/image.jpg',
'short_path' => 'custom-path',
'title' => 'My Website'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pref.rio/link/api/urls"
payload := strings.NewReader("{\n \"destination\": \"https://example.com\",\n \"description\": \"A great website\",\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"image_url\": \"https://example.com/image.jpg\",\n \"short_path\": \"custom-path\",\n \"title\": \"My Website\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pref.rio/link/api/urls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": \"https://example.com\",\n \"description\": \"A great website\",\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"image_url\": \"https://example.com/image.jpg\",\n \"short_path\": \"custom-path\",\n \"title\": \"My Website\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pref.rio/link/api/urls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"destination\": \"https://example.com\",\n \"description\": \"A great website\",\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"image_url\": \"https://example.com/image.jpg\",\n \"short_path\": \"custom-path\",\n \"title\": \"My Website\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-01T12:00:00Z",
"description": "A great website",
"destination": "https://example.com",
"expires_at": "2024-12-31T23:59:59Z",
"id": "550e8400-e29b-41d4-a716-446655440000",
"image_url": "https://example.com/image.jpg",
"short_path": "abc123",
"title": "My Website",
"updated_at": "2024-01-01T12:00:00Z"
}{}{}{}urls
Create a new short URL
Create a new short URL with optional custom path and metadata
POST
/
urls
Create a new short URL
curl --request POST \
--url https://pref.rio/link/api/urls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": "https://example.com",
"description": "A great website",
"expires_at": "2024-12-31T23:59:59Z",
"image_url": "https://example.com/image.jpg",
"short_path": "custom-path",
"title": "My Website"
}
'import requests
url = "https://pref.rio/link/api/urls"
payload = {
"destination": "https://example.com",
"description": "A great website",
"expires_at": "2024-12-31T23:59:59Z",
"image_url": "https://example.com/image.jpg",
"short_path": "custom-path",
"title": "My Website"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
destination: 'https://example.com',
description: 'A great website',
expires_at: '2024-12-31T23:59:59Z',
image_url: 'https://example.com/image.jpg',
short_path: 'custom-path',
title: 'My Website'
})
};
fetch('https://pref.rio/link/api/urls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pref.rio/link/api/urls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'destination' => 'https://example.com',
'description' => 'A great website',
'expires_at' => '2024-12-31T23:59:59Z',
'image_url' => 'https://example.com/image.jpg',
'short_path' => 'custom-path',
'title' => 'My Website'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pref.rio/link/api/urls"
payload := strings.NewReader("{\n \"destination\": \"https://example.com\",\n \"description\": \"A great website\",\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"image_url\": \"https://example.com/image.jpg\",\n \"short_path\": \"custom-path\",\n \"title\": \"My Website\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pref.rio/link/api/urls")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": \"https://example.com\",\n \"description\": \"A great website\",\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"image_url\": \"https://example.com/image.jpg\",\n \"short_path\": \"custom-path\",\n \"title\": \"My Website\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pref.rio/link/api/urls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"destination\": \"https://example.com\",\n \"description\": \"A great website\",\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"image_url\": \"https://example.com/image.jpg\",\n \"short_path\": \"custom-path\",\n \"title\": \"My Website\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-01T12:00:00Z",
"description": "A great website",
"destination": "https://example.com",
"expires_at": "2024-12-31T23:59:59Z",
"id": "550e8400-e29b-41d4-a716-446655440000",
"image_url": "https://example.com/image.jpg",
"short_path": "abc123",
"title": "My Website",
"updated_at": "2024-01-01T12:00:00Z"
}{}{}{}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
URL creation request
Response
Created
Example:
"2024-01-01T12:00:00Z"
Example:
"A great website"
Example:
"https://example.com"
Example:
"2024-12-31T23:59:59Z"
Example:
"550e8400-e29b-41d4-a716-446655440000"
Example:
"https://example.com/image.jpg"
Example:
"abc123"
Example:
"My Website"
Example:
"2024-01-01T12:00:00Z"
⌘I
