Skip to main content

Create Link

This request creates a Link object.

post /shortener/links

Sample

A sample POST request to create a link:

curl -X POST \
'https://api.carrierx.com/core/v2/shortener/links?reuse=true' \
-H "Content-Type: application/json" \
--data-binary '{"link_sid":"330a8a83-d4bb-4f39-ae54-c59c8d87cd44", "destination_url":"http://destinationurl.com", "maximum_ttl":"-1"}' \
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'

Response

200 status code with a serialized copy of the link object:

{
"date_accessed": null,
"date_created": "2024-01-18T19:26:02.553Z",
"destination_url": "http://destinationurl.com",
"link_sid": "330a8a83-d4bb-4f39-ae54-c59c8d87cd44",
"hits": 0,
"link_sid": "a533f53a-7e6f-4822-be3c-3767924ee2a9",
"maximum_ttl": -1,
"mode": "redirect_temporary",
"partner_sid": "e00430c3-a7d0-4666-ab5c-f7202448382f",
"short_name": "eOtEtO",
"url": "http://newlink.com/eOtEtO"
}

Required Scopes

To create a Link object, the partner must have one of the following scopes enabled:

  • shortener.manage
  • shortener.create

To set the mode field value to proxy_pass, the partner must additionally have the shortener.allow_link_mode_proxypass scope enabled.

Query Arguments

ParameterData TypeDescription
reusebooleanIf set to true, the previously created existing link will be used (i.e., no new short link will be created) to the same destination_url and with the same link_sid. If no existing link with the same destination_url and link_sid can be found, the new one will be created. The default value is false.

Body Arguments

JSON representation of the fields and values of the Link object to be created.

Required fields to create a link are:

  • destination_url
  • domain_sid

Refer to this table to view all fields that appear in the Link object.