Welcome to the We.Pe API!  We.Pe exposes its data via an Application Programming Interface (API), so developers can interact in a programmatic way with the application. This document is the official reference for that functionality. The current API version is 3.2


You can use this Public API   30d8bf6d86e06ed71a50a5c77696651e297c0892

Daily Limit 5000 URL Max/Day. To remove this limit simply sign up with a We.Pe free account.

API Documentation

For developers We.Pe prepared API which returns responses in JSON or TEXT formats. Currently there is one method which can be used to shorten links on behalf of your account. All you have to do is to send a GET request with your API token and URL Like the following:


You will get a JSON reposnse like the following:


Using Text Response

If you want a TEXT reposnse just add &format=text at the end of your request as the below example. This will return just the short link. Note that if an error occurs, it will not output anything.


Note  api  &  url  are required fields and the other fields like alias, format are optional.

Using the API in PHP

To use the API in your PHP application, you need to send a GET request via file_get_contents or cURL. Please check the below sample examples using file_get_contents Using JSON Response

$long_url = urlencode('yourdestinationlink.com');
$api_token = '30d8bf6d86e06ed71a50a5c77696651e297c0892';
$alias = urlencode('CustomAlias');
$api_url = "https://we.pe/api?api={$api_token}&url={$long_url}&alias={$alias}";
$result = @json_decode(file_get_contents($api_url),TRUE);
if($result["status"] === 'error') {
 echo $result["message"];
} else {
 echo $result["shortenedUrl"];

Using Plain Text Response

$long_url = urlencode('yourdestinationlink.com');
$api_token = '30d8bf6d86e06ed71a50a5c77696651e297c0892';
$alias = urlencode('CustomAlias');
$api_url = "https://we.pe/api?api={$api_token}&url={$long_url}&alias={$alias}&format=text";
$result = @file_get_contents($api_url);
if( $result ){
 echo $result;
That's it