Skip to main content

how-to-create-a-link

Actually, we don't expose our GraphQL endpoint for creating link. We are working hard to allow it. In the meantime, you can use this endpoint to do it.

Domain hi.switchy.io and swiy.io are only availables trought API for officials integrations.

If you want to make an official integration, feel free to reach us on our live chat. You can find our chat on the website or within the app! ๐Ÿ˜Š

HTTP Request POST https://api.switchy.io/v1/links/create

Minimal curl example

curl 'https://api.switchy.io/v1/links/create' \  
-H 'Content-Type: application/json' \
-H 'Api-Authorization: YOUR_TOKEN_HERE'
-d \
{
"link": {
"title": "",
"description": "",
"url": "https://example.com/",
"pixels": [],
"showGDPR": false,
"extraOptionsLinkRotator": [],
"extraOptionsGeolocations": [],
"tags": []
}
}
--compressed

More complex curl example

curl 'https://api.switchy.io/v1/links/create' \  
-H 'Content-Type: application/json' \
-H 'Api-Authorization: YOUR_TOKEN_HERE'
-d \
{
"link": {
"title": "My title",
"description": "My description",
"url": "https://example.com/",
"image": "https://example.com/my.jpg",
"pixels": [
{
"createdAt": "2021-01-30T08:03:34.568+00:00",
"id": "pixel id",
"platform": "twitter",
"title": "pixel title",
"value": "tixel value",
"workspaceId": 5972
}
],
"showGDPR": true,
"extraOptionsGeolocations": [
{
"url": "https://github.com",
"value": "AO"
}
],
"tags": [
"mytag"
],
"domain": "hi.swutchy.io",
"id": "my-slug",
"folderId": 10313,
"favicon": "https://example.com/favicon_144x144.png",
"linkExpiration": {
"enable": true,
"timezone": 4,
"url": "http://google.com",
"end": "2021-12-29T10:03:51.421Z"
},
"deepLinkingEnable": true,
"note": "My Notes",
"passwordProtect": {
"enable": true,
"password": "123"
}
}
}
--compressed

JSON Parameters

ParameterDescriptionTypeDefault value
linkLink to create for the redirectionLinkno default value
autofillServer will add automatically open graph metadatabooleantrue
ParameterDescriptionTypeDefault value
urlMandatory Url to redirectString
domainMandatory Domain name of the linkStringhi.switchy.io
idAlias slug, it's the id of your link (domainName/id)StringrandomId()
-----------------------------------
titleUsed for the open graph titleStringnull (can be autofill with the autofill parameter)
descriptionUsed for the open graph descriptionStringnull (can be autofill with the autofill parameter)
imageUsed for the open graph description, must be an urlStringnull (can be autofill with the autofill parameter)
-----------------------------------
faviconStringnull
extraOptionsGeolocationsjsonb[]
extraOptionsLinkRotatorjsonb[]
folderIdIntnull
pixelsUsed for pixelling your short link and retargeting purposePixel[][]
showGDPRDisplay the GDPR popup if pixels are presentsBooleanfalse
tagsUsed for searching and sorting in the dahsboardString[][]
noteSome notes visible in admin panelStringnull
deepLinkingEnableEnable Deeplink if it is possibleBooleanfalse
linkScriptsList of script wihch will be added to a link if linkScriptEnable is trueInt[]null
linkScriptEnableEnable linkScripts connected to a linkBooleanfalse
maskingEnable link cloakingBooleanfalse
linkExpirationSet up date then link will be expiried and redirect endpointLinkExpirationnull
passwordProtectShow password protection popupPasswordProtectnull

Pixel type

ParameterDescriptionTypeDefault value
platformMandatory Which platform belongs the pixelPlatform
valueMandatory Value of the pixelString
idIt's the id of your pixel in the databaseUUIDrandomId()
workspaceIdinteger

LinkExpiration type

ParameterDescriptionTypeDefault value
enableMandatory Is link expiration enabledBoolean
endMandatory link exparation end date - exaxmple: 2021-11-11T06:59:01.499ZString
urlMandatory Url the link will be redirected then link become expiredUUIDrandomId()
timezoneMandatory timezoneInt

PasswordProtect type

ParameterDescriptionTypeDefault value
enableMandatory Is password protection enabledBoolean
passwordMandatory Password of protected linkString
type Platform =
| 'linkedin'
| 'facebook'
| 'gtm'
| 'quora'
| 'pinterest'
| 'twitter'
| 'ga'
| 'bing'
| 'nexus'
| 'adroll'
| 'adwords';

Rate limits: 10.000 links/day; 1.000 links/hour max. For any higher limits needs, please reach us on our chat.