Create a short link
curl --request POST \
--url https://api.wavix.com/v1/short-links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"link": "https://your-site.com/long-url",
"expiration_time": "2023-07-19T18:18:34.235Z",
"fallback_url": "https://examples.com/fallback",
"phone": "15155982927",
"utm_campaign": "summer_promo"
}
'import requests
url = "https://api.wavix.com/v1/short-links"
payload = {
"link": "https://your-site.com/long-url",
"expiration_time": "2023-07-19T18:18:34.235Z",
"fallback_url": "https://examples.com/fallback",
"phone": "15155982927",
"utm_campaign": "summer_promo"
}
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({
link: 'https://your-site.com/long-url',
expiration_time: '2023-07-19T18:18:34.235Z',
fallback_url: 'https://examples.com/fallback',
phone: '15155982927',
utm_campaign: 'summer_promo'
})
};
fetch('https://api.wavix.com/v1/short-links', 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://api.wavix.com/v1/short-links",
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([
'link' => 'https://your-site.com/long-url',
'expiration_time' => '2023-07-19T18:18:34.235Z',
'fallback_url' => 'https://examples.com/fallback',
'phone' => '15155982927',
'utm_campaign' => 'summer_promo'
]),
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://api.wavix.com/v1/short-links"
payload := strings.NewReader("{\n \"link\": \"https://your-site.com/long-url\",\n \"expiration_time\": \"2023-07-19T18:18:34.235Z\",\n \"fallback_url\": \"https://examples.com/fallback\",\n \"phone\": \"15155982927\",\n \"utm_campaign\": \"summer_promo\"\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://api.wavix.com/v1/short-links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"link\": \"https://your-site.com/long-url\",\n \"expiration_time\": \"2023-07-19T18:18:34.235Z\",\n \"fallback_url\": \"https://examples.com/fallback\",\n \"phone\": \"15155982927\",\n \"utm_campaign\": \"summer_promo\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wavix.com/v1/short-links")
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 \"link\": \"https://your-site.com/long-url\",\n \"expiration_time\": \"2023-07-19T18:18:34.235Z\",\n \"fallback_url\": \"https://examples.com/fallback\",\n \"phone\": \"15155982927\",\n \"utm_campaign\": \"summer_promo\"\n}"
response = http.request(request)
puts response.read_body{
"short_link": "https://wx.com/hd82Jhs21"
}{
"success": false,
"message": "Missing or invalid parameter <param_name>"
}{
"success": false,
"message": "The service is not provisioned for your account."
}{
"success": false,
"message": "Record not found"
}{
"success": false,
"message": "Expiration time can't be in the past"
}Link shortener
Create a short link
Creates a short link that redirects to the target URL and tracks click metrics.
POST
/
v1
/
short-links
Create a short link
curl --request POST \
--url https://api.wavix.com/v1/short-links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"link": "https://your-site.com/long-url",
"expiration_time": "2023-07-19T18:18:34.235Z",
"fallback_url": "https://examples.com/fallback",
"phone": "15155982927",
"utm_campaign": "summer_promo"
}
'import requests
url = "https://api.wavix.com/v1/short-links"
payload = {
"link": "https://your-site.com/long-url",
"expiration_time": "2023-07-19T18:18:34.235Z",
"fallback_url": "https://examples.com/fallback",
"phone": "15155982927",
"utm_campaign": "summer_promo"
}
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({
link: 'https://your-site.com/long-url',
expiration_time: '2023-07-19T18:18:34.235Z',
fallback_url: 'https://examples.com/fallback',
phone: '15155982927',
utm_campaign: 'summer_promo'
})
};
fetch('https://api.wavix.com/v1/short-links', 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://api.wavix.com/v1/short-links",
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([
'link' => 'https://your-site.com/long-url',
'expiration_time' => '2023-07-19T18:18:34.235Z',
'fallback_url' => 'https://examples.com/fallback',
'phone' => '15155982927',
'utm_campaign' => 'summer_promo'
]),
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://api.wavix.com/v1/short-links"
payload := strings.NewReader("{\n \"link\": \"https://your-site.com/long-url\",\n \"expiration_time\": \"2023-07-19T18:18:34.235Z\",\n \"fallback_url\": \"https://examples.com/fallback\",\n \"phone\": \"15155982927\",\n \"utm_campaign\": \"summer_promo\"\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://api.wavix.com/v1/short-links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"link\": \"https://your-site.com/long-url\",\n \"expiration_time\": \"2023-07-19T18:18:34.235Z\",\n \"fallback_url\": \"https://examples.com/fallback\",\n \"phone\": \"15155982927\",\n \"utm_campaign\": \"summer_promo\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wavix.com/v1/short-links")
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 \"link\": \"https://your-site.com/long-url\",\n \"expiration_time\": \"2023-07-19T18:18:34.235Z\",\n \"fallback_url\": \"https://examples.com/fallback\",\n \"phone\": \"15155982927\",\n \"utm_campaign\": \"summer_promo\"\n}"
response = http.request(request)
puts response.read_body{
"short_link": "https://wx.com/hd82Jhs21"
}{
"success": false,
"message": "Missing or invalid parameter <param_name>"
}{
"success": false,
"message": "The service is not provisioned for your account."
}{
"success": false,
"message": "Record not found"
}{
"success": false,
"message": "Expiration time can't be in the past"
}Authorizations
Wavix API key. Pass as Authorization: Bearer <api_key>. Keys support per-resource scopes (none / read / write). See Restricted keys and scopes.
Body
application/json
Attributes for the new short link.
Target URL to shorten.
Example:
"https://your-site.com/long-url"
Expiration date and time in ISO 8601 format.
Example:
"2023-07-19T18:18:34.235Z"
Fallback URL for expired or invalid links.
Example:
"https://examples.com/fallback"
Phone number for the short link.
Example:
"15155982927"
UTM campaign name for tracking insights.
Example:
"summer_promo"
Response
Returns the created short link.
Generated short URL.
Example:
"https://wx.com/hd82Jhs21"
Was this page helpful?
⌘I