Copied!
M y L i n k s

API

API documentation

Create an account, open Developers, generate your single API key (optional 2 IPs + 2 websites allowlist), then authenticate with Authorization: Bearer urlz_....

Authentication

One API key per account. Create it in Developers after signup. Optional allowlists restrict which client IPs and website origins may use the key.

POST /api/v1/shorten

Create a short URL. Adult/sensitive destinations may return risk_status: WARNING but still create the link.

bash

curl -X POST https://urlz.ca/api/v1/shorten \
  -H 'Authorization: Bearer urlz_your_key' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com","alias":"optional"}'

php

<?php
$response = file_get_contents('https://urlz.ca/api/v1/shorten', false, stream_context_create([
  'http' => [
    'method' => 'POST',
    'header' => "Authorization: Bearer urlz_your_key\r\nContent-Type: application/json",
    'content' => json_encode(['url' => 'https://example.com']),
  ],
]));
$data = json_decode($response, true);

javascript

const response = await fetch('https://urlz.ca/api/v1/shorten', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer urlz_your_key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ url: 'https://example.com' }),
});
const data = await response.json();

python

import requests

response = requests.post(
    'https://urlz.ca/api/v1/shorten',
    headers={'Authorization': 'Bearer urlz_your_key'},
    json={'url': 'https://example.com'},
)
print(response.json())

GET /api/v1/qr

Encode a short identifier or any http(s) URL as a QR. URLZ never fetches the destination.

By identifier

curl "https://urlz.ca/api/v1/qr/a7K"

By URL query

curl "https://urlz.ca/api/v1/qr?url=https://urlz.ca/a7K"

Errors

{
  "success": false,
  "error": {
    "code": "INVALID_URL",
    "message": "The supplied URL is invalid."
  }
}

Common codes: INVALID_URL, RATE_LIMITED, DAILY_QUOTA_EXCEEDED, INVALID_API_KEY, API_IP_NOT_ALLOWED, API_ORIGIN_NOT_ALLOWED.