Skip to main content

Overview

Update an existing dynamic link’s configuration, destination URL, mobile app settings, social previews, and campaign parameters. This allows you to modify links without changing their short code or losing analytics data.

Endpoint

PUT https://api.bit2connect.com/1.0/links/:code

What Can Be Updated

You can update the following aspects of a link:
  • Display Name: Change the link’s organizational name
  • Destination URL: Update where the link redirects users
  • Mobile App Configuration: Change iOS/Android app settings or switch to saved apps
  • Social Preview: Update title, description, and image for link sharing
  • Campaign Parameters: Modify UTM tracking parameters
  • Desktop Fallback: Change desktop-specific destination
  • Expiration Date: Extend or set link expiration
Cannot Update: The link’s short code is permanent and cannot be changed after creation.

Common Update Scenarios

1. Update Destination URL

Change where users are redirected:
cURL
curl -X PUT "https://api.bit2connect.com/1.0/links/product-launch" \
  -H "X-API-KEY: b2co_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": {
      "link": "https://example.com/new-product-page"
    }
  }'

2. Switch to Saved Mobile Apps

Replace manual configuration with saved apps:
cURL
curl -X PUT "https://api.bit2connect.com/1.0/links/app-campaign" \
  -H "X-API-KEY: b2co_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": {
      "link": "https://example.com/content",
      "iosAppId": "550e8400-e29b-41d4-a716-446655440000",
      "androidAppId": "550e8400-e29b-41d4-a716-446655440001"
    }
  }'

3. Update Social Preview

Modify how the link appears when shared:
cURL
curl -X PUT "https://api.bit2connect.com/1.0/links/holiday-sale" \
  -H "X-API-KEY: b2co_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": {
      "link": "https://example.com/holiday-sale",
      "social": {
        "title": "Holiday Sale Extended - 70% Off!",
        "description": "Last chance to save big this season",
        "image": "https://example.com/images/holiday-extended.jpg"
      }
    }
  }'

4. Update Campaign Parameters

Change analytics tracking:
cURL
curl -X PUT "https://api.bit2connect.com/1.0/links/newsletter" \
  -H "X-API-KEY: b2co_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": {
      "link": "https://example.com/content",
      "campaign": {
        "utm_source": "newsletter",
        "utm_medium": "email",
        "utm_campaign": "december_2024",
        "utm_content": "hero_cta"
      }
    }
  }'

5. Update Mobile App Configuration

Change mobile app settings:
cURL
curl -X PUT "https://api.bit2connect.com/1.0/links/mobile-promo" \
  -H "X-API-KEY: b2co_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": {
      "link": "https://example.com/promo",
      "ios": {
        "bundleId": "com.example.app",
        "app_store_fallback": "https://apps.apple.com/app/id987654321",
        "min_version": "2.0.0"
      },
      "android": {
        "package": "com.example.app",
        "store_fallback": "https://play.google.com/store/apps/details?id=com.example.app",
        "min_version": "2.0.0"
      }
    }
  }'

Complete Update Example

const response = await fetch("https://api.bit2connect.com/1.0/links/summer-sale", {
  method: "PUT",
  headers: {
    "X-API-KEY": "b2co_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Summer Sale Extended",
    payload: {
      link: "https://example.com/summer-sale-extended",
      iosAppId: "550e8400-e29b-41d4-a716-446655440000",
      androidAppId: "550e8400-e29b-41d4-a716-446655440001",
      social: {
        title: "Summer Sale - Now 60% Off!",
        description: "Extended through August! Don't miss out!",
        image: "https://example.com/images/summer-extended.jpg",
      },
      campaign: {
        utm_source: "api",
        utm_medium: "dynamic_link",
        utm_campaign: "summer_sale_extended_2024",
      },
      desktop_fallback: "https://example.com/desktop/summer-sale",
    },
    expiresAt: "2024-08-31T23:59:59Z",
  }),
});

const data = await response.json();
console.log("Link updated:", data.success);

Response

Success Response

{
  "success": true,
  "data": {
    "message": "Link updated successfully"
  }
}

Error Responses

Link Not Found
{
  "success": false,
  "error": "Link not found"
}
Expired Link
{
  "success": false,
  "error": "Cannot edit an expired link"
}
Invalid Payload
{
  "success": false,
  "error": "Validation failed",
  "details": ["payload.link is required"]
}

Best Practices

Preserve Analytics: Updating a link preserves all existing click data and analytics. The short URL remains the same.
Test Before Updating: Test your updated configuration with a new link first to ensure it works as expected.
Expired Links: You cannot update links that have already expired. Consider creating a new link instead.
Mobile Apps: When switching to saved mobile apps (iosAppId/androidAppId), you don’t need to include the manual ios/android configuration objects.

Limitations

  • Code Immutability: The link’s short code cannot be changed
  • Expired Links: Cannot update links past their expiration date
  • Active Links: Updates take effect immediately for active links
  • Rate Limits: Standard API rate limits apply

Next Steps