Connect your website to Short Link and create short links automatically. The integration is designed to be copy-paste simple — one small function in your PHP code is all you need. No plugins, no libraries, no extra configuration, nothing else to build.
| Requirement | Details |
|---|---|
| 1. An account on our website | Register here (free, takes one minute) |
| 2. An API key | Generated from your Dashboard after you log in |
| 3. A PHP website with cURL | cURL is enabled by default on virtually all PHP hostings |
There is exactly one API address, and it only accepts POST requests:
https://www.uplink.cyou.soshop.cyou/api.php
| Field | Required | Type | Description |
|---|---|---|---|
| api_key | ✅ Yes | string | Your private 32-character API key |
| url | ✅ Yes | string | The long URL to shorten (http/https, max 2048 chars) |
| title | ❌ No | string | Optional label to identify the link |
This is all the code you will ever need. Paste it once (for example in your functions.php or a config file) and use it anywhere:
<?php // ===================================================== // Short Link API connector // Paste this ONCE in your website. Nothing else needed. // ===================================================== function makeShortLink($longUrl, $title = null) { $apiEndpoint = "https://www.uplink.cyou.soshop.cyou/api.php"; $apiKey = "PASTE_YOUR_API_KEY_HERE"; // from your Dashboard $ch = curl_init($apiEndpoint); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query([ 'api_key' => $apiKey, 'url' => $longUrl, 'title' => $title, ]), CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, ]); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); if (($data['status'] ?? '') === 'success') { return $data['short_url']; // ready short link } return false; }
// ✅ CORRECT — one line, done. No other code is needed. $short = makeShortLink("https://example.com/some/very/long/page"); if ($short !== false) { echo "<a href='" . $short . "'>Visit</a>"; }
| Do | Why |
|---|---|
| Send requests with POST to the single endpoint above | The API ignores everything else |
| Send api_key and url as form fields | These are the only two required fields |
| Keep your API key only in server-side PHP code | Keys in HTML/JavaScript can be stolen by visitors |
| Treat the reply as JSON and read short_url | status = success means the link is ready |
| Handle false / error replies quietly | Your site keeps working even if our API is briefly unreachable |
| Use one API key per website | Easier to track usage and revoke if needed |
| Don't | What happens instead |
|---|---|
| Send a GET request or open the endpoint in a browser | 405 METHOD_NOT_ALLOWED — nothing gets shortened |
| Forget the api_key field | 401 MISSING_API_KEY |
| Use a wrong or revoked key | 401/403 error — the key must come from your own Dashboard |
| Send text, FTP, or JavaScript links instead of real URLs | 422 INVALID_URL — only http/https links are accepted |
| Put your API key inside visible page HTML or client-side JS | Anyone can copy it and use your quota |
| Try to create links for other people's accounts or manage keys through the API | That is not possible — key management only happens in your Dashboard |
| Build your own extra plumbing around the API | Not needed — the connector function above already does everything |
On success — new link (HTTP 201):
{
"status": "success",
"short_code": "aB3x9K",
"short_url": "https://www.uplink.cyou.soshop.cyou/aB3x9K",
"long_url": "https://example.com/very/long/url",
"duplicate": false
} On success — same URL sent again (HTTP 200): identical reply, but with "duplicate": true and the same short link as before. Your code does not need to treat these two cases differently — status = "success" always means the short link is ready to use.
On failure (HTTP 401 / 403 / 405 / 422 / 500):
{
"status": "error",
"code": "INVALID_API_KEY",
"message": "This API key does not exist."
}
| HTTP | Code | Meaning |
|---|---|---|
| 405 | METHOD_NOT_ALLOWED | Only POST requests are supported |
| 401 | MISSING_API_KEY | The api_key field was not sent |
| 401 | INVALID_API_KEY | The key is wrong or does not exist |
| 403 | API_KEY_REVOKED | The key was revoked from the Dashboard |
| 403 | ACCOUNT_BLOCKED | The account behind the key is blocked |
| 422 | MISSING_URL | The url field was not sent |
| 422 | INVALID_URL | Not a valid http/https URL, or longer than 2048 chars |
| 429 | RATE_LIMITED | Too many requests — slow down and retry shortly |
| 500 | SERVER_ERROR | Could not generate a short code — retry later |