PUT
https://jmpy.me/api/v1
/
short-urls
/
{shortCode}
Update Short URL
curl --request PUT \
  --url https://jmpy.me/api/v1/short-urls/{shortCode} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "<string>",
  "name": "<string>",
  "expires_at": "<string>",
  "tracking_enabled": true,
  "custom_alias": "<string>",
  "url_type": "<string>",
  "subdomain": "<string>",
  "branded_domain": "<string>",
  "campaign_id": "<string>",
  "password": "<string>"
}
'
Update the properties of an existing short URL. You can modify the destination URL, name, expiration, custom alias, domain settings, and more. Only the fields you include in the request body will be updated.
Custom Alias Updates: You can change the custom alias of an existing URL. The new alias must be available within the URL’s domain context. Use the Check Alias Availability endpoint to verify availability first.

Path Parameters

shortCode
string
required
The short code, custom alias, or UUID of the short URL to update.Examples: abc123, my-campaign, 550e8400-e29b-41d4-a716-446655440000

Body Parameters

URL Settings

url
string
Update the destination URL. Must be a valid HTTP or HTTPS URL.
name
string
Update the friendly name (1-255 characters).
expires_at
string
Update or set expiration date (ISO 8601 format). Pass null to remove expiration.Example: 2025-12-31T23:59:59.000Z
tracking_enabled
boolean
Enable or disable analytics tracking. See Analytics API for click data.

Custom Alias

custom_alias
string
Update the custom alias. The new alias must be:
  • 3-50 characters
  • Alphanumeric with underscores or dashes only
  • Unique within the URL’s domain context
Changing the alias will change the short URL. Existing links using the old alias will stop working. Make sure to update any published links.
Use Check Alias Availability to verify the new alias is available before updating.

Domain Settings

url_type
string
Change the URL type: standard, subdomain, or branded.
Changing the URL type will change the short URL domain. This is a significant change - existing links will stop working.
subdomain
string
Change to a different subdomain (when url_type is subdomain). Must be a verified subdomain you own.See List Subdomains to view your registered subdomains.
branded_domain
string
Change to a different branded domain (when url_type is branded). Must be a verified domain you own.See List Branded Domains to view your registered domains.

Organization

campaign_id
string
Associate with a different campaign (UUID), or pass null to remove from campaign.See List Campaigns to find campaign IDs.
password
string
Set or update password protection. Pass null to remove password.

Request Examples

curl -X PUT "https://jmpy.me/api/v1/short-urls/my-campaign" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Campaign Link",
    "url": "https://example.com/new-destination",
    "expires_at": "2025-12-31T23:59:59Z"
  }'

Response Examples

{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "short_code": "new-alias",
    "short_url": "https://jmpy.me/new-alias",
    "original_url": "https://example.com/new-destination",
    "name": "Updated Campaign Link",
    "custom_alias": "new-alias",
    "click_count": 1542,
    "tracking_enabled": true,
    "url_type": "standard",
    "subdomain": null,
    "branded_domain": null,
    "expires_at": "2025-12-31T23:59:59.000Z",
    "created_at": "2024-01-15T10:30:00.000Z",
    "updated_at": "2024-01-21T09:15:00.000Z"
  }
}

Use Cases

Quickly swap destinations to test different landing pages:
async function updateDestination(shortCode, newUrl) {
  const response = await fetch(
    `https://jmpy.me/api/v1/short-urls/${shortCode}`,
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ url: newUrl })
    }
  );
  
  const { data } = await response.json();
  console.log(`Updated ${data.short_url}${data.original_url}`);
}

// Switch to version B
await updateDestination('promo', 'https://example.com/landing-page-v2');

// Check analytics: /api-reference/analytics/url-overview
Migrate a link from standard to your branded domain:
import requests

# First, ensure you have a verified branded domain
# See: /api-reference/domains/create-branded

short_code = "my-link"

response = requests.put(
    f"https://jmpy.me/api/v1/short-urls/{short_code}",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={
        "url_type": "branded",
        "branded_domain": "go.mycompany.com"
    }
)

result = response.json()
print(f"New URL: {result['data']['short_url']}")
# Output: New URL: https://go.mycompany.com/my-link
Add or remove links from campaigns:
// Add to campaign
// First, find campaign ID: /api-reference/campaigns/list
await fetch('https://jmpy.me/api/v1/short-urls/my-link', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    campaign_id: '550e8400-e29b-41d4-a716-446655440000'
  })
});

// Remove from campaign
await fetch('https://jmpy.me/api/v1/short-urls/my-link', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    campaign_id: null  // Pass null to remove
  })
});
Check availability before changing an alias:
async function safelyUpdateAlias(currentAlias, newAlias, urlType = 'standard') {
  // Step 1: Check if new alias is available
  // See: /api-reference/custom-aliases/check
  const checkResponse = await fetch(
    `https://jmpy.me/api/v1/short-urls/check-alias?alias=${newAlias}&url_type=${urlType}`,
    { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
  );
  const { data: checkData } = await checkResponse.json();
  
  if (!checkData.available) {
    throw new Error(`Alias "${newAlias}" is already taken`);
  }
  
  // Step 2: Update the alias
  const updateResponse = await fetch(
    `https://jmpy.me/api/v1/short-urls/${currentAlias}`,
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ custom_alias: newAlias })
    }
  );
  
  const { data } = await updateResponse.json();
  console.log(`Alias updated: ${data.short_url}`);
}