Vivoldi Developer API

Vivoldi API lets you automate link creation & management & analytics across websites, apps, and internal systems.

It uses JSON responses and easily integrates with JavaScript, Python, Java, Android, iOS, and more.

API Authentication

All API requests require an API key in the Authorization header.
You can generate your API key from the Developer API page in the dashboard.

Authorization: APIKey {Your API Key}

How to call the API

Request
Host: https://vivoldi.com/api/{uri}
Authorization: APIKey {Your API Key}
Content-type: application/json
User-Agent: {Your User-Agent}
Accept-Language: en
Response
{
	"code": 0,
	"message": "",
	"result": Object
}
FieldsDescriptionType
codeResponse code. A value of 0 indicates success; any non-zero value indicates failure.
This code is independent of the HTTP status and is returned only when the HTTP status is in the 2xx or 3xx range.
int
messageIncluded only when code is not 0. Provides an error message describing the failure.
May be empty or omitted when the response is successful.
string
resultThe actual response data returned by the API. Depending on the API type, the format may be a String or a JSON Object.object

Examples:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
	<script src="https://code.jquery.com/jquery-3.4.1.min.js" crossorigin="anonymous"></script>
</head>

<body>

<form id="exampleForm">
	<button id="btnCreateLink" type="button">Create Link</button>
</form>

<script type="text/javascript">
$(function(){
	$("#btnCreateLink").on('click', function(evt){
		evt.preventDefault();

		$.ajax({
			type: 'POST',
			url: 'https://vivoldi.com/api/link/v2/create',
			data: JSON.stringify({'url':'https://google.com','domain':'https://vvd.bz'}),
			headers: {'Authorization':'APIKey oc3w9m4ytso9mv5e8yse9XXXXXXXXXX'},
			contentType: 'application/json; charset=utf-8',
			dataType: 'json',
			timeout: 5000
		}).done(function(res){
			if (res.code === 0) {
				alert('short url: ' + res.result);
			} else {
				alert('code: ' + res.code + ', message: ' + res.message);
			}
		}).fail(function(xhr, textStatus, e){
			alert('error: ' + e);
		});
	});
});
</script>

</body>
</html>
<?php
$url = "https://vivoldi.com/api/link/v2/create";
$params = array (
	"url" => "https://www.facebook.com/vivoldi365",
	"domain" => "https://vvd.bz",
);
$body = json_encode($params);

$headers = array(
	"Authorization: APIKey oc3w9m4ytso9mv5e8yse9XXXXXXXXXX",
	"Content-Type: application/json"
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10000);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$result = curl_exec($ch);

if ($result === FALSE) {
     echo "Error sending: " . curl_error($ch);
} else {
     print_r($result);
}
curl_close($ch);
?>
package com.example;

import org.json.JSONObject;
import org.springframework.http.HttpStatus;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class CreateLink {
    public static void main(String[] args) {
        try (HttpClient client = HttpClient.newBuilder().build()) {
            JSONObject params = new JSONObject();
            params.put("url", "https://www.facebook.com/vivoldi365");
            params.put("domain", "https://vvd.bz");

            HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://vivoldi.com/api/link/v2/create"))
                .header("Content-Type", "application/json")
                .header("Authorization", "APIKey oc3w9m4ytso9mv5e8yse9XXXXXXXXXX")
                .POST(HttpRequest.BodyPublishers.ofString(params.toString()))
                .build();

            HttpResponse<String> response;
            try {
                response = client.send(request, HttpResponse.BodyHandlers.ofString());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            if (response != null) {
                if (response.statusCode() == HttpStatus.OK.value()) {
                    String jsonString = response.body();
                    if (jsonString != null && !jsonString.isEmpty()) {
                        JSONObject json = new JSONObject(jsonString);
                        if (json.getInt("code") == 0) {
                            System.out.println("Short URL: " + json.getString("result"));
                        } else {
                            System.out.println("Failed: " + String.format("[%d] %s", json.getInt("code"), json.getString("message")));
                        }
                    }
                }
            }
        }
    }
}
Please contact Vivoldi if you need REST API improvements or modifications.