Deleting a country targeting rule


Information below might be outdated - please visit our recently updated API Reference

The instruction below shows how to delete a country targeting rule for a link.

  • Click "Create API key".
  • Add a Secret key.

2) Copy an ID of a short link you want to delete a country targeting rule.

  • Open the statistics of the short link.
  • Copy the link ID.

3) Install prerequisites for requests.

pip install requests
npm install --save axios

Now everything is ready to run the following snippet. It will delete a country targeting rule.

4) Create a file: .js/ .rb. Use the code snippet below.


Please, replace link_idString and ISO country code with appropriate values.

You need to specify country ISO code and country region code in ISO-3166-2 format. Example: US (country) - United States; NY (region) - New York. You can find a necessary ISO code here:

import requests

url = ""

headers = {'authorization': '<<apiKey>>'}

response = requests.request("DELETE", url, headers=headers)

const axios = require('axios');

const options = {
    headers: {
      'content-type': 'application/json',
      authorization: '<<apiKey>>'

  axios.delete('', options)
.then(function (response) {
}) .catch(function (response) {
require 'uri'
require 'net/http'
require 'openssl'

url = URI("")

http =, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request =
request["authorization"] = '<<apiKey>>'

response = http.request(request)
puts response.read_body

5) Launch the file.

node filename.js
ruby filename.rb

6) JSON Response (a country rule is removed).

Once you run the code, you will see the response.

  success: true