Updating a Domain
📘 Information below might be outdated - please visit our recently updated API Reference
The instruction below shows how to update a domain on your Short.io account
1) Get your secret API key here: https://app.short.io/settings/integrations/api-key​
- Click "Create API key".
- Add a Secret key.

2) Copy an ID of a domain you want to update.​
- Open Domain settings.

- Copy your domain ID.

3) Install prerequisites for requests.​
- Python
- Node.js
pip install requests
npm install @short.io/client-node
Now everything is ready to run the following snippet. It will update a domain.
4) Create a file: filename.py/ .js/ .rb. The code snippet below updates rootredirect (URL to redirect customers when visiting your short domain).​
📘
Please, replace domainID and rootredirect with appropriate values.
- Python
- Node.js
- Ruby
import requests
url = "https://api.short.io/domains/settings/domainID/"
import json
payload = json.dumps({"rootRedirect":"your_link"})
headers = {
'accept': "application/json",
'content-type': "application/json",
'authorization': "<<apiKey>>"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
import { setApiKey, updateDomainSettings } from "@short.io/client-node";
setApiKey("<<apiKey>>");
const result = await updateDomainSettings({
path: { domainId: "domainID" },
body: { rootRedirect: "your_link" }
});
console.log(result.data);
require 'uri'
require 'net/http'
require 'openssl'
require 'json'
url = URI("https://api.short.io/domains/settings/domainID/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["authorization"] = '<<apiKey>>'
request.body = JSON.generate({"rootRedirect":"your_link"})
response = http.request(request)
puts response.read_body
5) Launch the file.​
- Python
- Node.js
- Ruby
python filename.py
node filename.js
ruby filename.rb
6) JSON Response (the domain will be updated).​
Once you run the code, you will see the response.
{
success: true
}
Here's how it looks on Short.io:​
