{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"URL Shortener API V3","description":"Sprinklr offers robust, convenient, and simple RESTful Web service APIs to integrate data from Sprinklr to any external system.","keywords":["Sprinklr API","Sprinklr Developer Portal","OAuth 2.0","RESTful API","Social Media API","Customer Experience API","Unified-CXM","Social Listening API"]},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"url-shortener-api-v3","__idx":0},"children":["URL Shortener API V3"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create shortened links and vanity links through a URL shortener configured for your Sprinklr partner. Sprinklr provides its own shortening utility, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["spr.ly"]},", and can also front third-party providers."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide covers both V3 Links operations and includes migration guidance for developers moving from the V2 URL Shortener APIs."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"on-this-page","__idx":1},"children":["On this page"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#overview"},"children":["Overview"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#base-url-and-environments"},"children":["Base URL and environments"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#authentication"},"children":["Authentication"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#operations"},"children":["Operations"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#field-reference"},"children":["Field reference"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#worked-examples"},"children":["Worked examples"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#response-format-and-status-codes"},"children":["Response format and status codes"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#migrating-from-v2"},"children":["Migrating from V2"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#common-tasks"},"children":["Common tasks"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#best-practices"},"children":["Best practices"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#troubleshooting"},"children":["Troubleshooting"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#related-articles"},"children":["Related articles"]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":2},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The URL Shortener API exposes two operations, and in practice you use them together."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Operation"},"children":["Operation"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Method and path"},"children":["Method and path"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Purpose"},"children":["Purpose"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fetch shorteners"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["List the URL shorteners available to your partner"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shorten a URL"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Create a short link or a vanity link"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}," first. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}," requires a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]},", and the shorteners list is where you obtain it. Cache the result, because the list changes only when an administrator adds or removes a shortener in Sprinklr."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"standard-links-and-vanity-links","__idx":3},"children":["Standard links and vanity links"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The API produces two kinds of short link."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Standard short link."]}," Send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]},". Sprinklr generates the link hash for you and the response carries ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId: -11"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Vanity link."]}," Additionally send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]},". That value becomes the link hash verbatim, so ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name: \"SpringSale\""]}," produces a short link ending in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/SpringSale"]},". Vanity links carry ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId: -10"]}," and populate the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]}," field."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Vanity links require a shortener whose ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," field is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},". Read that flag from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}," before you attempt a vanity link."]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," field is the vanity hash, not the name of the shortener."]}," The shortener's own name is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UrlShortener.name"]},", returned by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]},", and it is never sent to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]},". Send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," only when you want a vanity link with that exact hash."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"base-url-and-environments","__idx":4},"children":["Base URL and environments"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"https://api3.sprinklr.com/{env}/api/v3/link/shorten\nhttps://api3.sprinklr.com/{env}/api/v3/link/shorteners\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Replace ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{env}"]}," with the environment your partner is provisioned on. The supported values are:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod0"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod2"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod3"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod4"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod5"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod6"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod8"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod11"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod12"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod15"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod16"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod17"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod18"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod19"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod21"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prod25"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the environment your API key was issued against. Calling a different environment returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}," rather than redirecting. If you are unsure which environment applies, check the host you use to sign in to Sprinklr, or contact your Sprinklr account team."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"authentication","__idx":5},"children":["Authentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both operations require two authentication headers. ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Send both on every request."]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Header"},"children":["Header"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Bearer {{accessToken}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bearer token used to authenticate the user with the server"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Key"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{apiKey}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["API key that authenticates your application with the server"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/json"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Required on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Accept"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/json"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Acceptable response type"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Only ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["one access token and refresh token pair exists per API key"]}," at a time. Requesting a new pair invalidates the previous one. If two of your services shorten links, either issue them separate API keys or centralise token refresh behind a single component."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"operations","__idx":6},"children":["Operations"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"fetch-all-available-url-shorteners","__idx":7},"children":["Fetch all available URL shorteners"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"GET /link/shorteners\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns every URL shortener visible to the partner behind your credentials, as an array."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Parameters:"]}," none"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Request body:"]}," none"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Success:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this operation to obtain two things: the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," you pass as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}," when shortening, and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," flag that tells you whether the shortener supports vanity links."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The response is returned in a single call and is scoped to your partner. Cache it at start-up rather than fetching it before every shortening request."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"shorten-a-url-or-create-a-vanity-link","__idx":8},"children":["Shorten a URL or create a vanity link"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"POST /link/shorten\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Creates a short link using the specified shortener."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Request body:"]}," required"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Required fields:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Success:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201 Created"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each call creates a new short link. Posting the same ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}," twice produces two short links with two distinct ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," values, so maintain your own mapping of original URL to short link if you need to avoid duplicates."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Store ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]}," from the response at creation time. These values are returned once, when the link is created."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"field-reference","__idx":9},"children":["Field reference"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"request-body-for-post-linkshorten","__idx":10},"children":["Request body for POST /link/shorten"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Yes"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The URL to be shortened. Provide a fully qualified URL including the scheme"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Yes"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The URL shortener to use. Obtain this from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unique name or URL hash. When supplied, it becomes the link hash, producing a vanity link"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["description"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Description of the URL being shortened"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"url-shortener-object","__idx":11},"children":["URL shortener object"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returned as an array by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]},"."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ID of the shortener. Pass this as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}," when shortening"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Name of the shortener"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["provider"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shortener service provider"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether the shortener can create vanity links"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treat a missing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," rather than assuming vanity support. Select shorteners by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," for human-facing choices and by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["provider"]}," when behaviour depends on the underlying service. Keep the selection configurable rather than hard-coding an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", because shortener IDs differ across environments and partners."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"short-link-object","__idx":12},"children":["Short link object"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returned as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]},"."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer (int64)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Short link ID"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The URL shortener that was used"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unique hash for the shortened link"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["originalLink"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The original URL that was shortened"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The short URL. This is the value you publish"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer (int64)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-10"]}," for vanity links, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-11"]}," for links shortened directly"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["description"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Short URL description"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Domain used to shorten the link"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["provider"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["URL provider used for shortening"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createdTime"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer (int64)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Creation time of the short link"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["modifiedTime"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer (int64)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Last modified time of the short link"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["archived"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Whether the short link is archived"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["postId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer (int64)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Post ID the link is associated with"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Six fields are consistently present on a creation response:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["originalLink"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]}," is additionally returned for vanity links. The remaining fields become populated later in a link's lifecycle, for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["postId"]}," once the link is attached to a published post. ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Null-check any field beyond the six above."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Note the mixed identifier types: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," is a 64-bit number, while ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}," is a string ID. Do not store ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," in a field sized for a 24-character hexadecimal identifier."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"how-linkhash-relates-to-your-request","__idx":13},"children":["How linkHash relates to your request"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Case"},"children":["Case"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"What you send"},"children":["What you send"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Resulting linkHash"},"children":["Resulting ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"campaignId"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Standard link"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}," + ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["System-generated alphanumeric token"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-11"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Vanity link"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}," + ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}," + ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Exactly the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," you sent"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-10"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Read ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]}," directly from the response. Do not derive either value from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},"."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"worked-examples","__idx":14},"children":["Worked examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Replace ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{accessToken}}"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{apiKey}}"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{env}"]}," with your own values."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"list-available-shorteners","__idx":15},"children":["List available shorteners"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \\\n  'https://api3.sprinklr.com/{env}/api/v3/link/shorteners' \\\n  -H 'Authorization: Bearer {{accessToken}}' \\\n  -H 'Key: {{apiKey}}' \\\n  -H 'Accept: application/json'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"data\": [\n    {\n      \"id\": \"0000000000000000000000a1\",\n      \"name\": \"Corporate spr.ly\",\n      \"provider\": \"SPRINKLR\",\n      \"canUseForVanityLink\": true\n    },\n    {\n      \"id\": \"0000000000000000000000b2\",\n      \"name\": \"Marketing Bitly\",\n      \"provider\": \"BITLY\",\n      \"canUseForVanityLink\": false\n    }\n  ],\n  \"errors\": []\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-standard-short-link","__idx":16},"children":["Create a standard short link"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \\\n  'https://api3.sprinklr.com/{env}/api/v3/link/shorten' \\\n  -H 'Authorization: Bearer {{accessToken}}' \\\n  -H 'Key: {{apiKey}}' \\\n  -H 'Content-Type: application/json' \\\n  -H 'Accept: application/json' \\\n  -d '{\n    \"link\": \"https://www.example.com/spring-campaign-landing-page\",\n    \"urlShortenerId\": \"0000000000000000000000a1\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example response, returned with status ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201 Created"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"data\": {\n    \"id\": 600000000,\n    \"urlShortenerId\": \"0000000000000000000000a1\",\n    \"linkHash\": \"6003ZAI5v\",\n    \"originalLink\": \"https://www.example.com/spring-campaign-landing-page\",\n    \"shortLink\": \"https://spr.ly/6003ZAI5v\",\n    \"campaignId\": -11\n  },\n  \"errors\": []\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Publish ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.shortLink"]},". Store ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.id"]}," if you need to correlate the link later."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-vanity-short-link","__idx":17},"children":["Create a vanity short link"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," as the hash you want, using a shortener where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \\\n  'https://api3.sprinklr.com/{env}/api/v3/link/shorten' \\\n  -H 'Authorization: Bearer {{accessToken}}' \\\n  -H 'Key: {{apiKey}}' \\\n  -H 'Content-Type: application/json' \\\n  -H 'Accept: application/json' \\\n  -d '{\n    \"link\": \"https://www.example.com/spring-campaign-landing-page\",\n    \"urlShortenerId\": \"0000000000000000000000a1\",\n    \"name\": \"SpringSale\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"data\": {\n    \"id\": 600000001,\n    \"urlShortenerId\": \"0000000000000000000000a1\",\n    \"linkHash\": \"SpringSale\",\n    \"originalLink\": \"https://www.example.com/spring-campaign-landing-page\",\n    \"shortLink\": \"https://spr.ly/SpringSale\",\n    \"campaignId\": -10,\n    \"domain\": \"spr.ly\"\n  },\n  \"errors\": []\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}," echoes ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-10"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]}," is populated. All three confirm you received a vanity link rather than a standard one."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Vanity hashes occupy a shared namespace per shortener domain, so a given hash can be claimed only once. Choose names unlikely to collide, and handle a rejection by retrying with a different ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"end-to-end-in-python","__idx":18},"children":["End-to-end in Python"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import requests\n\nBASE = \"https://api3.sprinklr.com/{env}/api/v3\".format(env=\"prod0\")\nHEADERS = {\n    \"Authorization\": \"Bearer {{accessToken}}\",\n    \"Key\": \"{{apiKey}}\",\n    \"Content-Type\": \"application/json\",\n    \"Accept\": \"application/json\",\n}\n\n\ndef get_shorteners():\n    r = requests.get(BASE + \"/link/shorteners\", headers=HEADERS, timeout=30)\n    r.raise_for_status()\n    return r.json().get(\"data\") or []\n\n\ndef pick_shortener(shorteners, need_vanity=False):\n    for s in shorteners:\n        if not need_vanity:\n            return s\n        if s.get(\"canUseForVanityLink\") is True:\n            return s\n    raise RuntimeError(\"No suitable shortener is configured for this partner\")\n\n\ndef shorten(link, shortener_id, name=None):\n    body = {\"link\": link, \"urlShortenerId\": shortener_id}\n    if name:\n        body[\"name\"] = name\n\n    r = requests.post(BASE + \"/link/shorten\", headers=HEADERS,\n                      json=body, timeout=30)\n\n    if r.status_code not in (200, 201):\n        r.raise_for_status()\n\n    payload = r.json()\n    errors = payload.get(\"errors\") or []\n    if errors:\n        raise RuntimeError(\"Shortening failed: {}\".format(errors))\n\n    return payload[\"data\"]\n\n\nshorteners = get_shorteners()\nchosen = pick_shortener(shorteners, need_vanity=True)\nresult = shorten(\n    \"https://www.example.com/spring-campaign-landing-page\",\n    chosen[\"id\"],\n    name=\"SpringSale\",\n)\nprint(result[\"shortLink\"])\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Two details are deliberate. The status check accepts both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]},", and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," array is inspected even on a success status."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"end-to-end-in-javascript","__idx":19},"children":["End-to-end in JavaScript"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"const BASE = \"https://api3.sprinklr.com/prod0/api/v3\";\nconst HEADERS = {\n  \"Authorization\": \"Bearer {{accessToken}}\",\n  \"Key\": \"{{apiKey}}\",\n  \"Content-Type\": \"application/json\",\n  \"Accept\": \"application/json\",\n};\n\nasync function getShorteners() {\n  const res = await fetch(`${BASE}/link/shorteners`, { headers: HEADERS });\n  if (!res.ok) throw new Error(`Fetch shorteners failed: ${res.status}`);\n  const body = await res.json();\n  return body.data ?? [];\n}\n\nasync function shorten(link, urlShortenerId, name) {\n  const payload = { link, urlShortenerId };\n  if (name) payload.name = name;\n\n  const res = await fetch(`${BASE}/link/shorten`, {\n    method: \"POST\",\n    headers: HEADERS,\n    body: JSON.stringify(payload),\n  });\n\n  if (res.status !== 200 && res.status !== 201) {\n    throw new Error(`Shorten failed: ${res.status}`);\n  }\n\n  const body = await res.json();\n  if (body.errors?.length) {\n    throw new Error(`Shorten failed: ${JSON.stringify(body.errors)}`);\n  }\n  return body.data;\n}\n\nconst shorteners = await getShorteners();\nconst vanityCapable = shorteners.find((s) => s.canUseForVanityLink === true);\nconst link = await shorten(\n  \"https://www.example.com/spring-campaign-landing-page\",\n  vanityCapable.id,\n  \"SpringSale\",\n);\nconsole.log(link.shortLink);\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"response-format-and-status-codes","__idx":20},"children":["Response format and status codes"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"response-envelope","__idx":21},"children":["Response envelope"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every Sprinklr V3 response is wrapped in a standard envelope:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"data\": { },\n  \"errors\": [ ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}," returns an array in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}," returns a single object in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each entry in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," contains:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error identifier"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Error code"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Human-readable message"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Bind your client to this envelope"]},", and inspect the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," array even when the HTTP status indicates success."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"status-codes","__idx":22},"children":["Status codes"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Code"},"children":["Code"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Handling"},"children":["Handling"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Success"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Returned by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Created"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Returned by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}," on success"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bad request"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A required field is missing, the URL is malformed, or the vanity name was rejected"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unauthorized"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Expired token, wrong environment, or a missing authentication header"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["403"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Forbidden"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your user lacks permission for the shortener, or the partner is not entitled"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["404"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Not found"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Typically an unrecognised ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Accept both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]}," as success on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]},", or check for any ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2xx"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Rate limiting is applied at the Sprinklr API gateway across the platform. Implement retry with exponential backoff for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["429"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["5xx"]}," responses, and honour the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Retry-After"]}," header when it is present. Because shortening is not idempotent, retry only on network-level failures and on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["429"]},", and be aware that retrying after a timeout may create a second link."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"about-error-messages","__idx":23},"children":["About error messages"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Validation errors for shortening are surfaced from the external shortening provider rather than generated by Sprinklr. This has three practical consequences:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Error message text and codes are not stable across providers. A partner using Bitly and a partner using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["spr.ly"]}," can receive different error bodies for the same mistake."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Branch your error handling on the HTTP status code rather than on the message text."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log the full ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," array and surface the message to an operator rather than attempting to parse it."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"migrating-from-v2","__idx":24},"children":["Migrating from V2"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"the-short-version","__idx":25},"children":["The short version"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Change ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["v2"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["v3"]}," in the path. For most integrations, that is the entire migration."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"V2"},"children":["V2"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"V3"},"children":["V3"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shorten"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /{env}/api/v2/link/shorten"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /{env}/api/v3/link/shorten"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["List shorteners"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /{env}/api/v2/link/shorteners"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /{env}/api/v3/link/shorteners"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Request fields"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unchanged"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Required fields"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unchanged"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Response envelope"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{data, errors}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unchanged"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Authentication headers"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Key"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unchanged"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Success status on shorten"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"the-two-things-that-genuinely-differ","__idx":26},"children":["The two things that genuinely differ"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Success status code."]}," V2 returned ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}," on shortening. V3 returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201 Created"]},". A client written as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["if (status === 200)"]}," will treat a successful V3 creation as a failure. ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["This is the most likely cause of a broken migration."]}," Widen the check to accept ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]},", or accept any ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2xx"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Link hash format for standard links."]}," In V2, the standard-link ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}," was the decimal string form of the numeric ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id: 101612830"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash: \"101612830\""]},". In V3, standard links return an alphanumeric token unrelated to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},". If any code derives one value from the other, or validates that ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}," is numeric, update it to read ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]}," directly from the response."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Vanity links are unaffected, because their hash has always been the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," you supply."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"what-did-not-change","__idx":27},"children":["What did not change"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Request field names and semantics, the required field set, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{data, errors}"]}," envelope, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]}," sentinels (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-10"]}," for vanity, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-11"]}," for standard), authentication, and the vanity-capability rule are all identical. Error responses are also unchanged, because validation errors originate from the external shortening provider in both versions."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"migration-checklist","__idx":28},"children":["Migration checklist"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Change ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api/v2"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api/v3"]}," on both endpoints."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Widen the success check on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}," to accept ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Remove any code that derives ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}," from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," or assumes ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]}," is numeric."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add null checks for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createdTime"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["modifiedTime"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["provider"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["archived"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["postId"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Continue inspecting the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," array on success statuses."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Re-verify vanity flows against a shortener where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"common-tasks","__idx":29},"children":["Common tasks"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"shorten-a-link-for-a-scheduled-campaign-post","__idx":30},"children":["Shorten a link for a scheduled campaign post"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Fetch the shortener list once at start-up and cache it. For each URL, call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}," and the cached ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]},", then publish ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.shortLink"]},". Store ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.id"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.linkHash"]}," alongside your campaign record so reporting can be correlated later."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"reserve-a-memorable-vanity-link","__idx":31},"children":["Reserve a memorable vanity link"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select a shortener where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", then post with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," set to the hash you want. Confirm success by checking that ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.linkHash"]}," equals the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," you sent and that ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-10"]},". If the hash comes back different, you did not receive the vanity link you requested, so do not publish it as one."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"build-a-link-shortening-service-for-internal-teams","__idx":32},"children":["Build a link-shortening service for internal teams"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Expose a thin wrapper over ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /link/shorten"]}," and maintain your own mapping from original URL to short link. Check your mapping first and call Sprinklr only on a miss. This keeps your short-link inventory stable and avoids creating a new link each time the same URL is submitted."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"choose-between-multiple-configured-shorteners","__idx":33},"children":["Choose between multiple configured shorteners"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["provider"]}," for each entry. Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}," for human-facing selection and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["provider"]}," when behaviour depends on the underlying service. Keep the choice configurable so the same code works across environments and partners."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"best-practices","__idx":34},"children":["Best practices"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cache the shorteners list."]}," It changes only when an administrator adds or removes a shortener. Fetch it at start-up rather than before every shortening call."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Persist the creation response."]}," Store ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]}," when the link is created. These values are returned at creation time."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Accept ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["201"]}]}," as success on shortening."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Null-check optional fields."]}," Depend only on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["originalLink"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Read the scheme from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shortLink"]},"."]}," Embed the returned string as-is rather than reconstructing the URL from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["linkHash"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Deduplicate before retrying."]}," Shortening is not idempotent, so a retry after a timeout can create a duplicate link."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Check ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," before requesting a vanity link"]},", and treat a missing value as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Do not look up ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaignId"]}," values of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-10"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["-11"]},"."]}," These are sentinel values indicating a vanity or standard link, not references to a real campaign."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Keep shortener IDs in configuration"]},", not in code, because they differ across environments and partners."]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Firebase shorteners."]}," Google deprecated its Firebase URL shortener, and Firebase shorteners are no longer supported in Sprinklr effective ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["25 August 2025"]},". If your integration selects a shortener by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["provider"]},", ensure it does not target Firebase."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"troubleshooting","__idx":35},"children":["Troubleshooting"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Symptom"},"children":["Symptom"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Likely cause"},"children":["Likely cause"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Resolution"},"children":["Resolution"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}," on every call"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Wrong ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{env}"]},", expired access token, or a missing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Key"]}," header"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Confirm the environment, refresh the token, and send both authentication headers"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}," with an unclear message"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A required field is missing, or the provider rejected the request"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Confirm ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}," are both present and that ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}," includes a scheme"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["404"]}," on shortening"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urlShortenerId"]}," does not exist or is not visible to your user"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Re-fetch ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /link/shorteners"]}," and use an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," from that response"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Vanity name ignored, standard hash returned"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The shortener does not support vanity links"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Check ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["canUseForVanityLink"]}," and select a different shortener"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Vanity request rejected"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The hash is already claimed on that domain"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Retry with a different ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Client fails to deserialize the response"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Client bound to the inner object rather than the envelope"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Bind to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{data, errors}"]}," and read the payload from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Duplicate short links after a retry"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Shortening is not idempotent"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Deduplicate against your own mapping before retrying"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Success status but nothing usable in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An error was returned alongside a success status"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Inspect the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," array on every response"]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-articles","__idx":36},"children":["Related articles"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Getting started"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/api-overview"},"children":["API Overview"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/api-key-and-secret-generation"},"children":["API Key and Secret Generation"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/authorize"},"children":["Authorize"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/apis"},"children":["APIs by environment"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reference"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/rest-api-error-and-status-codes"},"children":["REST API Errors and Status Codes"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/faqs"},"children":["FAQs"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/help-center"},"children":["Help Center"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["V2 documentation"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/url-shortener"},"children":["URL Shortener overview"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://legacy-dev.sprinklr.com/create-url-shortener"},"children":["Create URL Shortener"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Product documentation"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.sprinklr.com/help/articles/url-shorteners/configure-a-url-shortener/6467ab928ea3c9635cf374a9"},"children":["Configure a URL shortener"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.sprinklr.com/help/articles/platform-modules/the-sprinklr-apis/633c5c2359534970b26f96ae"},"children":["The Sprinklr APIs"]}]}]}]},"headings":[{"value":"URL Shortener API V3","id":"url-shortener-api-v3","depth":1},{"value":"On this page","id":"on-this-page","depth":2},{"value":"Overview","id":"overview","depth":2},{"value":"Standard links and vanity links","id":"standard-links-and-vanity-links","depth":3},{"value":"Base URL and environments","id":"base-url-and-environments","depth":2},{"value":"Authentication","id":"authentication","depth":2},{"value":"Operations","id":"operations","depth":2},{"value":"Fetch all available URL shorteners","id":"fetch-all-available-url-shorteners","depth":3},{"value":"Shorten a URL or create a vanity link","id":"shorten-a-url-or-create-a-vanity-link","depth":3},{"value":"Field reference","id":"field-reference","depth":2},{"value":"Request body for POST /link/shorten","id":"request-body-for-post-linkshorten","depth":3},{"value":"URL shortener object","id":"url-shortener-object","depth":3},{"value":"Short link object","id":"short-link-object","depth":3},{"value":"How linkHash relates to your request","id":"how-linkhash-relates-to-your-request","depth":3},{"value":"Worked examples","id":"worked-examples","depth":2},{"value":"List available shorteners","id":"list-available-shorteners","depth":3},{"value":"Create a standard short link","id":"create-a-standard-short-link","depth":3},{"value":"Create a vanity short link","id":"create-a-vanity-short-link","depth":3},{"value":"End-to-end in Python","id":"end-to-end-in-python","depth":3},{"value":"End-to-end in JavaScript","id":"end-to-end-in-javascript","depth":3},{"value":"Response format and status codes","id":"response-format-and-status-codes","depth":2},{"value":"Response envelope","id":"response-envelope","depth":3},{"value":"Status codes","id":"status-codes","depth":3},{"value":"About error messages","id":"about-error-messages","depth":3},{"value":"Migrating from V2","id":"migrating-from-v2","depth":2},{"value":"The short version","id":"the-short-version","depth":3},{"value":"The two things that genuinely differ","id":"the-two-things-that-genuinely-differ","depth":3},{"value":"What did not change","id":"what-did-not-change","depth":3},{"value":"Migration checklist","id":"migration-checklist","depth":3},{"value":"Common tasks","id":"common-tasks","depth":2},{"value":"Shorten a link for a scheduled campaign post","id":"shorten-a-link-for-a-scheduled-campaign-post","depth":3},{"value":"Reserve a memorable vanity link","id":"reserve-a-memorable-vanity-link","depth":3},{"value":"Build a link-shortening service for internal teams","id":"build-a-link-shortening-service-for-internal-teams","depth":3},{"value":"Choose between multiple configured shorteners","id":"choose-between-multiple-configured-shorteners","depth":3},{"value":"Best practices","id":"best-practices","depth":2},{"value":"Troubleshooting","id":"troubleshooting","depth":2},{"value":"Related articles","id":"related-articles","depth":2}],"frontmatter":{"seo":{"title":"URL Shortener API V3"}},"lastModified":"2026-10-12T04:13:20.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/developer-guides-v3/url-shortener-api-v3","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}