Manage your branded links

How to manage and organize your branded short links

Every time you create a new branded short link, it becomes part of your personal branded short links collection. This is only visible to you.

Prerequisites

  • You have already created a Rebrandly account
    If you have not, please read Signup to Rebrandly guide.

  • You already have a valid API Key or an OAuth token to authenticate your API requests
    If you don't know how to authenticate your API requests, please read the Authentication guide

  • You have added at least one branded short link to your collection.
    If you have not, please read the Rebrand your first link guide.

  • You understood how Rebrandly manages pagination and sortings for a collection of branded short links.
    If you have not, please read the Paginating and the Sorting guide.

Simple Use Case

Example: How to render the first page of your branded short links collection.
Default values for pagination and sorting parameters in branded short links collection listing, are:

Parameter name

Parameter default value

orderBy

"createdAt"

orderDir

"desc"

limit

25

Endpoint to list your collection of branded short links is http://api.rebrandly.com/v1/links.
You should perform a GET API call to this endpoint to get the first page of branded short links:

curl \
  -H 'apikey: YOUR_API_KEY' \
  -X GET 'https://api.rebrandly.com/v1/links'

You will get the first 25 links of your collection:

[
  {
    "id": "ffs24cc5b6ee4a5gh7897b06ac2d16d4",
    "title": "The LaFerrari Supercar Convertible Is the New Best Way to Burn $1M | WIRED",
    "slashtag": "burn10M",
    "destination": "https://www.wired.com/2016/07/ferrari-laferrari-spider-convertible-photos-specs/",
    "createdAt": "2016-07-13T10:54:12.000Z",
    "updatedAt": "2016-07-13T10:54:12.000Z",
    "shortUrl": "rebrand.ly/burn10M",
    "domain": {
      "id": "8f104cc5b6ee4a4ba7897b06ac2ddcfb",
      "fullName": "rebrand.ly"
    }
  }
  ...,
  {
    "id": "22ff9c5c9c9441229d29524c63c9ff22",
    "title": "Dropbox - myvid.mp4",
    "slashtag": "myvid",
    "destination": "https://www.dropbox.com/s/0ywz1qo9ss4ss6x/myvid.mp4?dl=0",
    "createdAt": "2016-07-06T18:06:49.000Z",
    "updatedAt": "2016-07-06T18:06:49.000Z",
    "shortUrl": "fake.link/myvid",
    "domain": {
      "id": "65649c5c9c94411e9d29524c63c9aa13",
       "fullName": "fake.link"
    }
  }
]

Say you need to download the next 25 links: you can use the id property of the last link in the response body you just received (the 25th link, if you had received 25 links, or, in general, the last link entity in the response).
You can set this id in the &last optional parameter, and this will make the API skip all links until this "last" link, and return the next (up to) 25 links:

curl \
  -H 'apikey: YOUR_API_KEY' \
  -X GET 'https://api.rebrandly.com/v1/links?last=22ff9c5c9c9441229d29524c63c9ff22'

You will get the next 25 links of your collection.
To download the entire collection, you can repeat the process:

  • if the response includes an empty list, this means you have downloaded all the collection
  • if the response includes a non-empty list, you can use the id property of the last link in the response to make another API call, passing it along as the &last parameter.

Did this page help you?