Authentication#
No key is needed: the codes in the exchange are the credential. This route is limited per address. See Authentication.
Request body#
Content type application/json.
| Name | Type | Required | Description |
|---|---|---|---|
device_code | string | yes | The device_code from the call that started the link. min length 1; max length 128 |
Responses#
200 OK#
Content type application/json. Schema: LinkToken.
| Name | Type | Required | Description |
|---|---|---|---|
abilities | array of string | - | What the key may do. Only when approved |
expires_at | string (date-time) or null | - | When the key stops working. Only when approved |
id | string | - | The key id, used to revoke it. Only when approved |
status | string | - | Pending, approved, denied or expired. A link that never existed reads as expired |
token | string | - | The secret key, shown once. Only when approved |
type | string | - | The authorization scheme, always Bearer. Only when approved |
422 Unprocessable Content#
Content type application/problem+json. Validation failed; errors maps each field to its messages and issues lists each problem with its code, key and params. Schema: Problem.
The error follows RFC 9457. See Errors.
Any other status#
Content type application/problem+json. Error (RFC 9457 problem details). Schema: Problem.
The error follows RFC 9457. See Errors.
curl -X POST "http://localhost:3000/api/v1/device-links/token" \
-H "Content-Type: application/json" \
-d '{
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}'import requests
response = requests.post(
"http://localhost:3000/api/v1/device-links/token",
json={
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE",
},
timeout=30,
)
response.raise_for_status()
print(response.json())const response = await fetch("http://localhost:3000/api/v1/device-links/token", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
console.log(await response.json());package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}`)
req, err := http.NewRequest("POST", "http://localhost:3000/api/v1/device-links/token", body)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(out))
}<?php
$ch = curl_init("http://localhost:3000/api/v1/device-links/token");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => '{
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}',
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $response, PHP_EOL;import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:3000/api/v1/device-links/token"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}
"""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System;
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(
HttpMethod.Post, "http://localhost:3000/api/v1/device-links/token");
request.Content = new StringContent("""
{
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}
""", Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");require "net/http"
require "uri"
uri = URI("http://localhost:3000/api/v1/device-links/token")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request.body = '{
"device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts "#{response.code} #{response.body}"Response examples
{
"abilities": [
"image:convert",
"pdf:compress"
],
"expires_at": "2026-02-04T10:00:00Z",
"id": "k_7f3c1b9e",
"status": "approved",
"token": "vk_7f3c1b9e.replace-this-with-the-key-you-receive",
"type": "Bearer"
}{
"detail": "1 field(s) are invalid.",
"errors": {
"abilities": [
"Unknown abilities: image:resize. Allowed: pixels:svg, ..."
]
},
"instance": "/api/v1/tokens",
"request_id": "01JQZ8R4T6WQ2N9K3V5Y7B0C1D",
"status": 422,
"title": "Validation failed",
"type": "about:blank"
}The examples are built from the schemas, so every value is a placeholder of its type. The tables above hold the fields that carry the real values.

