Authentication#
No key is needed: the account's email and password are the credential, and the account's email must be verified. The key you get carries only the abilities you ask for. This route is limited to 5 calls a minute per address. See Authentication.
Request body#
Content type application/json.
| Name | Type | Required | Description |
|---|---|---|---|
abilities | array of string | yes | What the key may do; GET /api/v1/abilities lists the accepted values. at least 1 items; at most 16 items |
code | string | no | A two-factor code, for accounts with two-factor authentication. max length 16 |
device_name | string | yes | A label for this key, shown when listing keys. min length 1; max length 100 |
email | string (email) | yes | The account's email address. min length 1 |
password | string | yes | The account's password. min length 1 |
recovery_code | string | no | A two-factor recovery code, instead of code. max length 32 |
Responses#
201 Created#
Content type application/json. Schema: TokenIssued.
| Name | Type | Required | Description |
|---|---|---|---|
abilities | array of string | - | What this key may do |
expires_at | string (date-time) or null | - | When the key stops working, or null when it never expires |
id | string | - | The key id, used to revoke it |
token | string | - | The secret key. It is shown once; store it now |
type | string | - | The authorization scheme to use, always "Bearer" |
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/tokens" \
-H "Content-Type: application/json" \
-d '{
"abilities": [
"image:convert",
"pdf:compress"
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password"
}'import requests
response = requests.post(
"http://localhost:3000/api/v1/tokens",
json={
"abilities": [
"image:convert",
"pdf:compress",
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password",
},
timeout=30,
)
response.raise_for_status()
print(response.json())const response = await fetch("http://localhost:3000/api/v1/tokens", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"abilities": [
"image:convert",
"pdf:compress"
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password"
}),
});
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(`{
"abilities": [
"image:convert",
"pdf:compress"
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password"
}`)
req, err := http.NewRequest("POST", "http://localhost:3000/api/v1/tokens", 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/tokens");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => '{
"abilities": [
"image:convert",
"pdf:compress"
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password"
}',
]);
$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/tokens"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"abilities": [
"image:convert",
"pdf:compress"
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password"
}
"""))
.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/tokens");
request.Content = new StringContent("""
{
"abilities": [
"image:convert",
"pdf:compress"
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password"
}
""", 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/tokens")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request.body = '{
"abilities": [
"image:convert",
"pdf:compress"
],
"device_name": "cli",
"email": "you@example.com",
"password": "your-account-password"
}'
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",
"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.

