Mon-Fri 10am - 6pm
Create URL Link
Base URL for your account: https://cpaas.studio
POST
/api/v1/urlinks
Creates a new short URL link. Consumes 1 URLinks credit (urlinks.link). Link status starts as pending and requires admin approval before redirection becomes active.
Parameters
| Param | Type | Required | Notes |
|---|---|---|---|
name |
string, max 255 | yes | A descriptive label for the short link. |
slug |
string, max 100 | yes | The unique short link path slug (alpha_dash format). Must be unique within your tenant. |
redirect_url |
url, max 2048 | yes | The destination target URL (http/https). Private IP and loopback hosts are rejected. |
auto_renew |
boolean | no | Whether to automatically renew the link 3 days prior to expiry if credits exist. Default: true. |
Request example
curl -X POST "https://cpaas.studio/api/v1/urlinks" \
-H "X-API-KEY: cpk_xxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Summer Promo Landing Page",
"slug": "summer-promo",
"redirect_url": "https://example.com/promotions/summer-2026",
"auto_renew": true
}'
<?php
$ch = curl_init('https://cpaas.studio/api/v1/urlinks');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-KEY: cpk_xxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type: application/json',
],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Summer Promo Landing Page',
'slug' => 'summer-promo',
'redirect_url' => 'https://example.com/promotions/summer-2026',
'auto_renew' => true,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Success response (data)
{
"id": 15,
"name": "Summer Promo Landing Page",
"slug": "summer-promo",
"redirect_url": "https://example.com/promotions/summer-2026",
"status": "pending",
"auto_renew": true,
"clicks_count": 0,
"expires_at": "2027-09-16T17:46:25+00:00",
"created_at": "2026-09-16T17:46:25+00:00"
}
Errors
| Code | Status | When |
|---|---|---|
REQ_VALIDATION_FAILED |
422 | Missing or invalid parameters, duplicate slug for tenant, or unsafe redirect URL. |
BILLING_INSUFFICIENT_CREDITS |
402 | Account balance has fewer than 1 URLinks credit. |
Notes
- 1 credit is deducted immediately upon creation.
- If rejected by an administrator, the 1 credit is automatically refunded to your account.
Need more context? See Getting started for authentication, the response envelope, and the full error-code reference.