Getting started

Developers

Anim aute id magna aliqua ad ad non deserunt sunt. Qui irure qui lorem cupidatat commodo. Elit sunt amet fugiat veniam occaecat fugiat.

Step 1

Authenticate

Before we can start creating any shortened links via the API we first need to authenticate with the link shortener service.

This is quick and easy to do. All you will need is the login details that are provided on signup.

PHP
JavaScript
Go
                  
<?php
// Auth Details
$auth = json_encode(array(
  'email'      => '[email protected]',
  'password'    => 'vgPnpNkuvT',
));

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => array(
      'Content-Type: application/json'
  ),
  CURLOPT_URL => 'http://localhost:3000/auth/login',
  CURLOPT_POSTFIELDS => $auth,
));

$auth = json_decode(curl_exec($curl));
                   
                 

If all goes correctly then this will return the following:

PHP
JavaScript
Go
                  
// Returns the following Object..
// var_dump($auth);
// object(stdClass)#2 (4) {
//   ["access_token"]  => string(305) "eysInR5cCI6Ikp....."
//   ["expires_in"]    => int(3600)
//   ["refresh_token"] => string(44) "kavvzVYXz_uSfe5X...."
//   ["token_type"]    => string(6) "Bearer"
// }
                   
                 

Step 2

Create a Campaign

Now we are authenticated. The next step is to create a Campaign. Then the campaign will contain all the shortened links we require. This is an important concept when using SMS Links. With a campaign we can retrieve campaign statistics.

PHP
JavaScript
Go
                  
// Step 2 Create a Campaign.
$url = $baseUrl . 'api/v1/campaign';

// Here we use the Access Token from our initial authentication
$headers = [
  'Content-Type: application/json',
  'Authorization: Bearer ' . $auth->access_token
];

// Create an array of the required data.
// If no expiry is needed just set it to '0000-00-00T00:00:00.000Z'
$campaignData = [
  'name' => 'Summer Sale 2026',
  'description' => 'Q3 marketing campaign for summer promotions',
  'expiry' => '2026-08-19T16:01:27.657Z'
];

curl_setopt_array($ch, [
  CURLOPT_URL => $url,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode($campaignData),
  CURLOPT_HTTPHEADER => $headers,
]);

$campaign = json_decode(curl_exec($ch));
                   
                 

If successful we have created a campaign we should get the following back.

The important bit to note here is the ID. This is used to for other requests, creating links and getting analytics about a campaign.

Once a campaign is created we can then start to shorten links.

PHP
JavaScript
Go
                  
var_dump($campaign);
object(stdClass)#3 (8) {
  ["id"]=>
  string(8) "0c232e6f"
  ["tenant_id"]=>
  string(36) "400b379b-7ca7-4f8b-9d7b-5b6e283ee139"
  ["name"]=>
  string(16) "Summer Sale 2026"
  ["description"]=>
  string(43) "Q3 marketing campaign for summer promotions"
  ["expiry"]=>
  string(24) "2026-08-19T16:01:27.657Z"
  ["created_at"]=>
  string(27) "2026-02-28T09:48:12.481955Z"
  ["updated_at"]=>
  string(27) "2026-02-28T09:48:12.481955Z"
  ["utm"]=>
  object(stdClass)#4 (9) {
    ["id"]=>
    string(0) ""
    ["source"]=>
    string(0) ""
    ["medium"]=>
    string(0) ""
    ["campaign"]=>
    string(0) ""
    ["source_platform"]=>
    string(0) ""
    ["term"]=>
    string(0) ""
    ["content"]=>
    string(0) ""
    ["creative_format"]=>
    string(0) ""
    ["marketing_tactic"]=>
    string(0) ""
  }
}
                   
                 

Step 3

Create Shortened Links

Now we have a campaign we can start shortening links. We use the Campaign ID we received in the previous request.

PHP
JavaScript
Go
                  
$url = $baseUrl . 'api/v1/campaign/' . $campaign->id . '/links';    // Substitute $campaign->id for your CAMPAIGN_ID

// The minimum we require to shorten a link
$linkData = [
  "link"   => "https://example.com/summer-sale",    // The link we want to shorten
  "count"  => 3,                                    // The number of links we require
  "expiry" => "2027-02-19T14:33:52.815Z"            // A time we want to link to expire by, if not required set to "0000-00-00T00:00:00.000Z"
];

curl_setopt_array($ch, [
  CURLOPT_URL => $url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode($linkData),
  CURLOPT_HTTPHEADER => $headers
]);

$links = json_decode(curl_exec($ch));
                   
                 

This will now give us some shortened links that we can use :D

That's how we get shortened links. Remember if at any point you feel stuck please do not hesitate to get in touch and we will gladly assist in any way we can.

Ok, the link has been shortened now let's carry on and see how the links are performing and get some campaign analytics.

PHP
JavaScript
Go
                  
object(stdClass)#5 (2) {
  ["count"]=>
  int(3)
  ["links"]=>
  array(3) {
    [0]=>
    object(stdClass)#6 (11) {
      ["id"]=>
      string(36) "45a1f80c-aea9-469a-bd65-6a68a8841482"
      ["tenant_id"]=>
      string(36) "400b379b-7ca7-4f8b-9d7b-5b6e283ee139"
      ["campaign_id"]=>
      string(8) "0c232e6f"
      ["tenant_user_id"]=>
      string(36) "10240ac5-aa60-4f63-9396-918b258cb2f8"
      ["hash"]=>
      string(8) "QcFNUMLm"
      ["link"]=>
      string(31) "https://example.com/summer-sale"
      ["click_count"]=>
      int(0)
      ["expiry"]=>
      string(24) "2027-02-19T14:33:52.815Z"
      ["created_at"]=>
      string(27) "2026-02-28T09:48:12.491204Z"
      ["updated_at"]=>
      string(27) "2026-02-28T09:48:12.491204Z"
      ["short_url"]=>
      string(31) "https://localhost:3001/QcFNUMLm"
    }
    [1]=>
    object(stdClass)#7 (11) {
      ["id"]=>
      string(36) "63625f66-1990-471d-b910-13316756e7ce"
      ["tenant_id"]=>
      string(36) "400b379b-7ca7-4f8b-9d7b-5b6e283ee139"
      ["campaign_id"]=>
      string(8) "0c232e6f"
      ["tenant_user_id"]=>
      string(36) "10240ac5-aa60-4f63-9396-918b258cb2f8"
      ["hash"]=>
      string(8) "mzmuStCT"
      ["link"]=>
      string(31) "https://example.com/summer-sale"
      ["click_count"]=>
      int(0)
      ["expiry"]=>
      string(24) "2027-02-19T14:33:52.815Z"
      ["created_at"]=>
      string(27) "2026-02-28T09:48:12.493779Z"
      ["updated_at"]=>
      string(27) "2026-02-28T09:48:12.493779Z"
      ["short_url"]=>
      string(31) "https://localhost:3001/mzmuStCT"
    }
    [2]=>
    object(stdClass)#8 (11) {
      ["id"]=>
      string(36) "bbf7b85e-06a4-477d-a0dc-e0bb21705436"
      ["tenant_id"]=>
      string(36) "400b379b-7ca7-4f8b-9d7b-5b6e283ee139"
      ["campaign_id"]=>
      string(8) "0c232e6f"
      ["tenant_user_id"]=>
      string(36) "10240ac5-aa60-4f63-9396-918b258cb2f8"
      ["hash"]=>
      string(8) "dQjHKIMc"
      ["link"]=>
      string(31) "https://example.com/summer-sale"
      ["click_count"]=>
      int(0)
      ["expiry"]=>
      string(24) "2027-02-19T14:33:52.815Z"
      ["created_at"]=>
      string(27) "2026-02-28T09:48:12.496403Z"
      ["updated_at"]=>
      string(27) "2026-02-28T09:48:12.496403Z"
      ["short_url"]=>
      string(31) "https://localhost:3001/dQjHKIMc"
    }
  }
                   
                 

Step 4

Get Campaign Analytics

We have shorted links for our campaign. It's been running wild all weeknend. Now you want to see how it is performing. This is really simple to do via the API. All we need is the Campaign ID.

PHP
JavaScript
Go
                  
$url = $baseUrl . 'api/v1/campaign/' . $campaign->id . '/analytics';    // Substitute $campaign->id for your CAMPAIGN_ID

curl_setopt_array($ch, [
  CURLOPT_URL => $url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => $headers
]);

$analytics = json_decode(curl_exec($ch));
                   
                 

This will retrieve the analytics and show the following response.

PHP
JavaScript
Go
                  
object(stdClass)#11 (7) {
  ["total_clicks"]=>
  int(4)
  ["unique_clicks"]=>
  int(3)
  ["unique_user_agents"]=>
  int(3)
  ["clicked_links"]=>
  int()
  ["total_links"]=>
  int(5)
  ["engagement_rate"]=>
  int(0)
  ["country_breakdown"]=>
  array(0) {
  }
}
                   
                 

We now have an overall summary of the campaign that we can use for overall analysis.

If we want to go deeper we also have access to more detailed level of link clicking.

PHP
JavaScript
Go
                  
$url = $baseUrl . 'api/v1/campaign/' . $campaign->id . '/links'; // Substitute $campaign->id for your CAMPAIGN_ID

curl_setopt_array($ch, [
  CURLOPT_URL => $url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => $headers
]);

$links = json_decode(curl_exec($ch));
                   
                 

We get a paginated result set back from the api/v1/campaign/CAMPAIGN_ID/links endpoint.

PHP
JavaScript
Go
                  
object(stdClass)#13 (2) {
  ["links"]=>
  array(3) {
    [0]=>
    object(stdClass)#10 (11) {
      ["id"]=>
      string(36) "59d84b26-47a5-4ec0-b854-c7e801c94887"
      ["tenant_id"]=>
      string(36) "400b379b-7ca7-4f8b-9d7b-5b6e283ee139"
      ["campaign_id"]=>
      string(8) "b22db3c4"
      ["tenant_user_id"]=>
      string(0) ""
      ["hash"]=>
      string(8) "zPkZuYZT"
      ["link"]=>
      string(31) "https://example.com/summer-sale"
      ["click_count"]=>
      int(0)
      ["expiry"]=>
      string(24) "2027-02-19T14:33:52.815Z"
      ["created_at"]=>
      string(27) "2026-03-01T20:08:16.394765Z"
      ["updated_at"]=>
      string(27) "2026-03-01T20:08:16.394765Z"
      ["short_url"]=>
      string(31) "https://localhost:3001/zPkZuYZT"
    }
    [1]=>
    object(stdClass)#11 (11) {
      ["id"]=>
      string(36) "531765e1-9a50-48f9-81cb-6c93244ef830"
      ["tenant_id"]=>
      string(36) "400b379b-7ca7-4f8b-9d7b-5b6e283ee139"
      ["campaign_id"]=>
      string(8) "b22db3c4"
      ["tenant_user_id"]=>
      string(0) ""
      ["hash"]=>
      string(8) "gzbHrBer"
      ["link"]=>
      string(31) "https://example.com/summer-sale"
      ["click_count"]=>
      int(0)
      ["expiry"]=>
      string(24) "2027-02-19T14:33:52.815Z"
      ["created_at"]=>
      string(26) "2026-03-01T20:08:16.39231Z"
      ["updated_at"]=>
      string(26) "2026-03-01T20:08:16.39231Z"
      ["short_url"]=>
      string(31) "https://localhost:3001/gzbHrBer"
    }
    [2]=>
    object(stdClass)#12 (11) {
      ["id"]=>
      string(36) "91c69632-cafc-4a44-83e9-a9ce122ce2f9"
      ["tenant_id"]=>
      string(36) "400b379b-7ca7-4f8b-9d7b-5b6e283ee139"
      ["campaign_id"]=>
      string(8) "b22db3c4"
      ["tenant_user_id"]=>
      string(0) ""
      ["hash"]=>
      string(8) "pTfnmWqV"
      ["link"]=>
      string(31) "https://example.com/summer-sale"
      ["click_count"]=>
      int(0)
      ["expiry"]=>
      string(24) "2027-02-19T14:33:52.815Z"
      ["created_at"]=>
      string(27) "2026-03-01T20:08:16.390288Z"
      ["updated_at"]=>
      string(27) "2026-03-01T20:08:16.390288Z"
      ["short_url"]=>
      string(31) "https://localhost:3001/pTfnmWqV"
    }
  }
  ["pagination"]=>
  object(stdClass)#14 (6) {
    ["has_next"]=>
    bool(false)
    ["has_prev"]=>
    bool(false)
    ["page"]=>
    int(1)
    ["page_size"]=>
    int(1000)
    ["total_count"]=>
    int(3)
    ["total_pages"]=>
    int(1)
  }
}