The Shorturlx API supports both authenticated and anonymous requests. Authentication is optional for basic URL shortening, but required for custom slugs and provides a higher rate limit.
API keys use the sk_ prefix followed by 48 hex characters, for example:
sk_a3f2c1d9e8b74a056f2e1c3d9b8a7f4e2c1d9e8b74a056f2e1c3
Getting an API key
Open API Key Management
Navigate to API Key Management in your dashboard.
Create a key
Click Create key, enter a name, and optionally set an expiration date. Copy the key immediately — it will not be shown again.
Using your API key
Include your API key as a Bearer token in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEY
Never expose your API key in client-side code or public repositories. Store it in an environment variable and access it server-side only.
The following examples show how to include the header in common environments:
curl -X POST "https://www.shorturlx.xyz/api/shorten" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/very-long-url"}'
Anonymous requests
You can call the API without an API key. Anonymous requests are identified by IP address and have a lower rate limit (10 requests per 10 minutes). Custom slugs are not available without authentication.
Error response
If you provide an invalid or revoked API key, the API returns:
HTTP 401
{
"error": "Invalid API key"
}