Copié!
L i e n s

API

Documentation API

Créez un compte, ouvrez Développeurs, générez votre clé API, puis raccourcissez des liens et générez des codes QR à « lightspeed » directement depuis vos applications et sites web.

Authenticate with Authorization: Bearer YOUR_API_KEY (preferred). Query ?key= works for scripts — never embed keys in public pages or image URLs.

Overview

URLZ gives each account one resource pool. Links created on the website appear in the API. Links created through the API appear in My Links, URL performance, and QR tools. Ownership is always the account that owns the API key — never a client-supplied identifier alone.

Authentication

One API key per account. Create or rotate it on Developers. The full secret is shown once at creation. After that, URLZ only stores a SHA-256 hash and shows the prefix.

Preferred: Authorization: Bearer YOUR_API_KEY. Query ?key= is for scripts and browser GET tests only. If both are sent, Bearer wins. Optional IP and Origin allowlists: when set, every request must match.

Command-line (Bash)

curl -H "Authorization: Bearer YOUR_API_KEY" "https://urlz.ca/api/v1/shorten?url=https%3A%2F%2Fexample.com"

Browser

https://urlz.ca/api/v1/shorten?url=https%3A%2F%2Fexample.com&key=YOUR_API_KEY

Quick Start

  1. Create a URLZ account and open Developers.
  2. Generate your one API key and store it privately.
  3. Call GET /api/v1/shorten?url=https://example.com with the Bearer header.
  4. Open the returned short_url. Manage it later from My Links or /api/v1/links/{identifier}.

Browser

GET endpoints can be opened in the address bar for quick tests. Do not ship a production website that puts the key in HTML, JavaScript, or img src. Use a backend proxy instead.

Browser

https://urlz.ca/api/v1/shorten?url=https%3A%2F%2Fexample.com&alias=my-clean-link&key=YOUR_API_KEY

PHP

PHP

$ch = curl_init('https://urlz.ca/api/v1/shorten?url=' . rawurlencode('https://example.com'));
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('URLZ_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);

Python

Python

import os, requests
print(requests.get(
  'https://urlz.ca/api/v1/shorten',
  params={'url': 'https://example.com'},
  headers={'Authorization': 'Bearer ' + os.environ['URLZ_API_KEY']},
).json())

JavaScript

Run this from a server or trusted backend. Do not embed YOUR_API_KEY in a public frontend bundle.

JavaScript

const response = await fetch('https://urlz.ca/api/v1/shorten?url=' + encodeURIComponent('https://example.com'), {
  headers: { Authorization: 'Bearer ' + process.env.URLZ_API_KEY }
});
const data = await response.json();

Command-line (Bash)

Command-line (Bash)

curl -H "Authorization: Bearer $URLZ_API_KEY" \
  "https://urlz.ca/api/v1/shorten?url=https%3A%2F%2Fexample.com&alias=optional"

Shorten URLs

GET or POST /api/v1/shorten. Authentication required. Counts as 1 Action.

Parameters: url (required), alias (optional, 7–64 chars), expires (never, 1h, 1d, 7d, 30d, 90d, 1y, custom), custom_expires_at, max_clicks (1–1000000 or empty).

Success: 201. Fields: success, short_url, identifier, expires_at, risk_status, usage.

Command-line (Bash)

curl -H "Authorization: Bearer YOUR_API_KEY" "https://urlz.ca/api/v1/shorten?url=https%3A%2F%2Fexample.com&alias=my-clean-link"

JSON

{
  "success": true,
  "short_url": "https://urlz.ca/my-clean-link",
  "identifier": "my-clean-link",
  "expires_at": null,
  "risk_status": "SAFE",
  "usage": { "used": 1, "limit": 600, "label": "1/600 Actions" }
}

QR Codes

GET /api/v1/qr or /api/v1/qr/{id}. Returns a PNG or SVG image. API key required on every request. Counts as 1 Action. URLZ never fetches the destination.

Parameters: url (on /qr), format=png|svg, download=1. Path style encodes a website, or an existing short identifier as https://urlz.ca/{identifier} (the public short URL, not the private destination).

Browser

https://urlz.ca/api/v1/qr?url=quebecstore.ca&format=png&key=YOUR_API_KEY

Command-line (Bash)

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://urlz.ca/api/v1/qr?url=quebecstore.ca&format=png" -o qr.png

Analytics

There is no standalone analytics route. GET /api/v1/links/{identifier} includes stats for that owned link only:

total_clicks, unique_visitors, daily, devices, browsers, os, referrers, countries.

Command-line (Bash)

curl -H "Authorization: Bearer YOUR_API_KEY" "https://urlz.ca/api/v1/links/my-clean-link"

Errors

JSON

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

Common codes: INVALID_API_KEY (401), NOT_FOUND (404), RATE_LIMITED / DAILY_QUOTA_EXCEEDED (429 + Retry-After), INVALID_URL, INVALID_STATUS, INVALID_MAX_CLICKS, ALIAS_TAKEN (422).

Limites

Qui Limite
Utilisation anonyme du site 300 Actions / jour
Comptes connectés et clés API 600 Actions / jour
Limites de débit API (offre gratuite) 2 / seconde, 30 / minute, 100 / heure, 600 Actions / jour par compte
Clés API 1 clé par compte
API QR Clé API requise à chaque requête
Authentification Bearer recommandé ; ?key= seulement pour les scripts

An Action is one shorten, one QR generation, or one link-management call (list, get, update, delete). Limits are enforced server-side per account, not per API key. Rotating a key does not reset the daily quota. 429 responses include Retry-After.

Security

Examples

Replace YOUR_API_KEY with the secret shown once on Developers. In production, read it from an environment variable.

PHP

$ch = curl_init('https://urlz.ca/api/v1/links');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . getenv('URLZ_API_KEY')]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Python

import os, requests
print(requests.get('https://urlz.ca/api/v1/links', headers={'Authorization': 'Bearer ' + os.environ['URLZ_API_KEY']}).json())

JavaScript

const res = await fetch('https://urlz.ca/api/v1/links', {
  headers: { Authorization: 'Bearer ' + process.env.URLZ_API_KEY }
});
console.log(await res.json());

Command-line (Bash)

curl -H "Authorization: Bearer $URLZ_API_KEY" "https://urlz.ca/api/v1/links"