Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Shorten.REST

Scalekit connector
Open markdown

The Shorten.REST connector lets your AI agent act in each user's Shorten.REST account. Each user connects their own Shorten.REST API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 6 tools.

Tools
6
What they doRead · write · destructive
3 · 2 · 13 read2 write1 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Shorten.REST connection

    In AgentKit > Connections, create a Shorten.REST connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'shortenrest'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Shorten.REST:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'shortenrest_aliases_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Shorten.REST credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • shortenrest_alias_getGet one short URL by its alias and domain.Read-only

    Get Short URL

    Get one short URL by its alias and domain. Returns the alias name, domain, created and updated times, destinations, meta tags and snippets. Use shortenrest_aliases_list to find alias names.

    Inputs

    alias_namestringrequired
    The alias (the path part of the short URL) without a leading slash, case sensitive. For https://short.fyi/aBcDe012 it is aBcDe012. Example: aBcDe012.
    domain_namestring
    Domain the alias belongs to, without http(s):// or slashes. Defaults to short.fyi, Shorten.REST's shared domain; use your own branded domain if you connected one. Example: short.fyi.default short.fyi
  • shortenrest_aliases_listList the alias names on a domain, newest first.Read-only

    List Short URLs

    List the alias names on a domain, newest first. Returns aliases (a list of alias names) and lastId when there are more. Pass lastId as continue_from for the next page. Use shortenrest_alias_get for an alias's destinations.

    Inputs

    continue_fromstring
    lastId from the previous response, to get the next batch. Example: 5f1f2c3d4e5f60718293a4b5.
    domain_namestring
    Domain the alias is on, without http(s):// or slashes. Defaults to short.fyi, Shorten.REST's shared domain; use your own branded domain if you connected one. Example: short.fyi.default short.fyi
    limitinteger
    Number of aliases to return per request. Defaults to 1000. Example: 100.
  • shortenrest_clicks_listList raw click records for the account, newest first.Read-only

    List Clicks

    List raw click records for the account, newest first. Returns clicks with each click's alias, domain, destination, country, os, browser, referrer, user agent and createdAt (Unix ms), plus lastId when there are more. Pass lastId as continue_from for the next page.

    Inputs

    continue_fromstring
    lastId from the previous response, to get the next batch. Example: 5f1f2c3d4e5f60718293a4b5.
    limitinteger
    Number of clicks to return per request. Defaults to 1000. Example: 100.
  • shortenrest_alias_createCreate a short URL (an alias) that redirects to one or more destination URLs, optionally per country or operating system.Write

    Create Short URL

    Create a short URL (an alias) that redirects to one or more destination URLs, optionally per country or operating system. Returns aliasName, domainName and the full shortUrl. Leave alias_name empty for a random 7-character alias, or use the @rnd macro for a partly random one.

    Inputs

    destinationsarrayrequired
    Where the short URL redirects. Each item has a url and optionally a country (ISO alpha-2 code such as US) and an os (an operating system from Shorten.REST's supported list); an item with only a url is the default destination, and an OS match wins over a country match. Include one default destination. Example: [{"url": "https://www.example.com/landing"}, {"url": "https://www.example.com/us", "country": "US"}]
    alias_namestring
    Alias for the short URL, without a leading slash, case sensitive. Leave empty for a random 7-character alias; @rnd inside it is replaced with random characters (for example spring-@rnd). An alias must be unique on its domain. Example: spring-sale.
    domain_namestring
    Domain to create the alias on, without http(s):// or slashes. Defaults to short.fyi, Shorten.REST's shared domain; use your own branded domain if you connected one. Example: short.fyi.default short.fyi
    metatagsarray
    Meta tags served on the redirect page, each with a name and content. They override the domain's meta tags of the same name. Example: [{"name": "og:title", "content": "Spring sale"}]
    snippetsarray
    Tracking snippets (such as retargeting or conversion pixels) fired on click, each with an id from Shorten.REST's supported snippet list and a parameters object. They override the domain's snippets with the same id. Example: [{"id": "facebook_pixel", "parameters": {"pixel_id": "123456789012345"}}]
  • shortenrest_alias_updateUpdate a short URL's destinations, meta tags or snippets.Write

    Update Short URL

    Update a short URL's destinations, meta tags or snippets. Returns the updated alias. Each array you send replaces the stored array in full, so include every destination you want to keep.

    • Idempotent

    Inputs

    alias_namestringrequired
    The alias (the path part of the short URL) without a leading slash, case sensitive. For https://short.fyi/aBcDe012 it is aBcDe012. Example: aBcDe012.
    destinationsarray
    Where the short URL redirects. Each item has a url and optionally a country (ISO alpha-2 code such as US) and an os (an operating system from Shorten.REST's supported list); an item with only a url is the default destination, and an OS match wins over a country match. Include one default destination. Example: [{"url": "https://www.example.com/landing"}, {"url": "https://www.example.com/us", "country": "US"}]
    domain_namestring
    Domain the alias belongs to, without http(s):// or slashes. Defaults to short.fyi, Shorten.REST's shared domain; use your own branded domain if you connected one. Example: short.fyi.default short.fyi
    metatagsarray
    Meta tags served on the redirect page, each with a name and content. They override the domain's meta tags of the same name. Example: [{"name": "og:title", "content": "Spring sale"}]
    snippetsarray
    Tracking snippets (such as retargeting or conversion pixels) fired on click, each with an id from Shorten.REST's supported snippet list and a parameters object. They override the domain's snippets with the same id. Example: [{"id": "facebook_pixel", "parameters": {"pixel_id": "123456789012345"}}]
  • shortenrest_alias_deleteDelete a short URL by its alias and domain.Destructive

    Delete Short URL

    Delete a short URL by its alias and domain. The link stops redirecting. Returns a confirmation on success. Use shortenrest_alias_get first to confirm the alias.

    • Idempotent

    Inputs

    alias_namestringrequired
    The alias (the path part of the short URL) without a leading slash, case sensitive. For https://short.fyi/aBcDe012 it is aBcDe012. Example: aBcDe012.
    domain_namestring
    Domain the alias belongs to, without http(s):// or slashes. Defaults to short.fyi, Shorten.REST's shared domain; use your own branded domain if you connected one. Example: short.fyi.default short.fyi