High volume short link creation

This tutorial will help you If you need to create a large amount of links all at once

With the Short.io API, you can shorten up to 1000 links in one API call. You can create 5 requests per 10 seconds (1 request = 1000 URLs).

📘

Please ensure that the Short.io pricing plan you select fits all of your links. We recommend opting for the Enterprise plan, which offers unlimited links.

To create short links in bulk

  1. Create a secret API key from the Integrations and API menu: https://app.short.io/settings/integrations/api-key.
  2. Use the code example provided below to create a file: filename.py/ .js/ .rb etc.

📘

Please replace example.com , APIKEY ,YOUR_FIRST_PATH and YOUR_SECOND_PATH (the new slugs to be applied), FIRST_LONG_URL , SECOND_LONG_URL and TTL with the appropriate values.

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.short.io/links/bulk",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'allowDuplicates' => false,
    'links' => [
        [
                'originalURL' => 'FIRST_LONG_URL',
                'path' => 'YOUR_FIRST_PATH',
                'ttl' => 'TTL'
        ],
        [
                'originalURL' => 'SECOND_LONG_URL',
                'path' => 'YOUR_SECOND_PATH',
                'ttl' => 'TTL'
        ]
    ],
    'domain' => '<<domain_name>>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: <<apiKey>>",
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
const url = 'https://api.short.io/links/bulk';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json', Authorization: '<<apyKey>>'},
  body: JSON.stringify({
    allowDuplicates: false,
    domain: '<<domain_name>>',
    links: [
      {
        originalURL: 'FIRST_LONG_URL',
        ttl: 'TTL',
        path: 'YOUR_FIRST_PATH'
      },
      {
        originalURL: 'SECOND_LONG_URL',
        ttl: 'TTL',
        path: 'YOUR_SECOND_PATH'
      }
    ]
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

type Link struct {
    OriginalURL string `json:"originalURL"`;
    Cloaking bool `json:"cloaking"`
}

type BulkLinkRequest struct {
    Domain string `json:"domain"`
    Links []Link `json:"links"`
}

func main() {
    client := &http.Client{}
    jsonData := BulkLinkRequest{
        Domain: "<<domain_name>>",
        Links: []Link{
            {OriginalURL: "http://yourlongdomain.com/yourlonglink"},
            {OriginalURL: "http://yourlongdomain.com/yourlonglink2", Cloaking: true},
        },
    }
    jsonValue, _ := json.Marshal(jsonData)
    req, err := http.NewRequest("POST", "https://api.short.io/links/bulk", bytes.NewBuffer(jsonValue))
    if err != nil {
        fmt.Printf("The request creation failed with error %s\n", err)
	return;
    }
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("Authorization", "<<apiKey>>")
    response, err := client.Do(req)
    if err != nil {
        fmt.Printf("The HTTP request failed with error %s\n", err)
	return;
    }
    data, _ := ioutil.ReadAll(response.Body)
    fmt.Println(string(data))
}
using RestSharp;
using System;
using System.Collections.Generic;

class Link
{
    string originalURL;
}

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var client = new RestClient("https://api.short.io/");
            client.AddDefaultHeader("Authorization", "<<apiKey>>");
            var req = new RestRequest("links/bulk", Method.POST, DataFormat.Json);
            var links = new List<object>
            {
                new { originalURL = "http://yourlongdomain.com/yourlonglink" },
                new
                {
                    originalURL = "http://yourlongdomain.com/yourlonglink",
                    cloaking = true
                }
            };
            req.AddJsonBody(new
            {
                domain = "<<domain_name>>",
                links,
            });
            var res = client.Execute(req);
            Console.WriteLine(res.Content);
        }
    }
}
  1. Launch the file:
python filename.py
node filename.js
ruby filename.rb
php filename.php

📘

The code above returns a list of two link objects. In the event that a URL cannot be inserted, an error object is returned as an element of the array instead. The method is non-transactional; it may successfully insert certain links from the list while generating errors for others.

  1. Review the JSON response which should resemble the following:
[
  {
    originalURL: 'https://developers.short.io/reference/post_links-bulk',
    DomainId: 11111,
    archived: false,
    cloaking: false,
    createdAt: '2025-05-13T13:19:32.111Z',
    updatedAt: '2025-05-13T13:19:32.111Z',
    OwnerId: 11111,
    tags: [],
    skipQS: false,
    path: 'post_links-bulk',
    id: 'lnk_4RF8_W1IQ9qq7',
    idString: 'lnk_4RF8_W1IQ9qq7',
    ttl: '2025-05-22T12:38:23.000Z',
    shortURL: 'https://shortiotest.com/post_links-bulk',
    secureShortURL: 'https://shortiotest.com/post_links-bulk',
    duplicate: false,
    success: true
  },
  {
    originalURL: 'https://developers.short.io/docs/high-volume-short-link-creation',
    DomainId: 11111,
    archived: false,
    cloaking: false,
    createdAt: '2025-05-13T13:19:32.198Z',
    updatedAt: '2025-05-13T13:19:32.198Z',
    OwnerId: 11111,
    tags: [],
    skipQS: false,
    path: 'short-link-creation',
    id: 'lnk_4RF8_tsGgZuhW2',
    idString: 'lnk_4RF8_tsGgZuhW2',
    ttl: '2025-05-22T12:38:23.000Z',
    shortURL: 'https://shortiotest.com/short-link-creation',
    secureShortURL: 'https://shortiotest.com/short-link-creation',
    duplicate: false,
    success: true
  }