Skip to main content

✏️ Update Dynamic Link via REST API

Use ChottuLink's REST API to update existing dynamic links in your account. This endpoint allows you to modify any field of an existing link, making it perfect for link management, campaign updates, or content modifications. Only the fields you include in the request will be updated.

Endpoint

PATCH https://api2.chottulink.com/chotuCore/pa/v1/update-link/{linkId}

Authentication

Include your API key in the request header:

API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
API Key Replacement Required

Replace c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx with your actual REST API integration key from the ChottuLink Dashboard.

Path Parameters

Path Parameters
ParameterTypeRequiredDescriptionExample
linkIdstringYesThe unique identifier of the link to updateaae848d6-f481-41db-8e5f-b511b5a75669

Request Parameters

Update Guidelines:
  • All parameters in the request body are optional
  • Only fields included in the request will be updated
  • Fields not included will remain unchanged
  • Make sure not to send unwanted fields
  • The link must belong to your organization
Link Configuration
ParameterTypeRequiredDescriptionExample
destination_urlstringNoThe destination URL that the link redirects tohttps://yourapp.com/updated-content
link_namestringNoThe name assigned to the link for identificationUpdated Summer Sale
Link Behaviors
ParameterTypeRequiredDescriptionValues
ios_behaviorintegerNoControls how the link behaves on iOS devices1: Open in Browser
2: Open in App
android_behaviorintegerNoControls how the link behaves on Android devices1: Open in Browser
2: Open in App
UTM Parameters
ParameterTypeRequiredDescriptionExample
utm_sourcestringNoIdentifies the source of your trafficemail
utm_mediumstringNoIdentifies the medium of your trafficnewsletter
utm_campaignstringNoIdentifies the campaign namesummer2025
utm_termstringNoIdentifies paid keywordsbest summer sale
utm_contentstringNoUsed to differentiate similar contentbanner_email
Social Sharing Parameters
ParameterTypeRequiredDescriptionExample
social_titlestringNoTitle that appears when the link is shared on social mediaUpdated Summer Sale
social_descriptionstringNoDescription that appears when the link is shared on social mediaCheck out our updated amazing deals!
social_image_urlstringNoImage URL that appears when the link is shared on social mediahttps://yourapp.com/images/updated-sale.jpg

Example Request

Basic Update (Single Field)

curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"link_name": "Updated Link Name"
}'

Complete Update (All Fields)

curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"destination_url": "https://yourapp.com/updated-content",
"link_name": "Updated Summer Sale",
"ios_behavior": 1,
"android_behavior": 2,
"utm_source": "api_update",
"utm_medium": "internal",
"utm_campaign": "updated_campaign",
"utm_term": "updated_term",
"utm_content": "updated_content",
"social_title": "Updated Link via API",
"social_description": "Testing the link update endpoint.",
"social_image_url": "https://yourapp.com/images/updated-image.jpg"
}'

Partial Update (Selected Fields)

curl --location --request PATCH 'https://api2.chottulink.com/chotuCore/pa/v1/update-link/aae848d6-f481-41db-8e5f-b511b5a75669' \
--header 'API-KEY: c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"destination_url": "https://yourapp.com/new-destination",
"social_title": "New Social Title",
"utm_campaign": "updated_campaign_2025"
}'

Response

Success Response

Status Code: 200 OK

{
"message": "Link updated successfully",
"status": "success"
}

Response Fields

Success Response Fields
FieldTypeDescriptionExample
statusstringResponse status indicating success"success"
messagestringHuman-readable success message"Link updated successfully"

Error Responses

Status Code: 400 Bad Request

{
"code": 101,
"errorMessage": "There was one or more validation error(s)",
"error": {
"errorMessage": "Invalid linkId! LinkId is not valid for the organization!",
"fieldName": "INVALID_VALUE"
}
}

Unauthorized Access

Status Code: 401 Unauthorized

{
"code": 130,
"errorMessage": "Authorization Failed!",
"error": {
"errorMessage": "Invalid Api Key",
"fieldName": "UNAUTHORIZED_ACCESS"
}
}

Status Code: 404 Not Found

{
"code": 103,
"errorMessage": "The requested entity could not be found",
"error": {
"errorMessage": "Link not found or does not belong to your organization",
"fieldName": "LINK_NOT_FOUND"
}
}

Usage Examples

const axios = require('axios');

async function updateLink(linkId, updateData) {
try {
const response = await axios.patch(
`https://api2.chottulink.com/chotuCore/pa/v1/update-link/${linkId}`,
updateData,
{
headers: {
'API-KEY': 'c_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
}
);

return response.data;
} catch (error) {
console.error('Error updating link:', error.response?.data || error.message);
throw error;
}
}

// Usage examples
// Update only the link name
await updateLink('aae848d6-f481-41db-8e5f-b511b5a75669', {
link_name: 'Updated Link Name'
});

// Update multiple fields
await updateLink('aae848d6-f481-41db-8e5f-b511b5a75669', {
destination_url: 'https://yourapp.com/new-content',
link_name: 'Updated Campaign',
utm_campaign: 'updated_campaign_2025',
social_title: 'New Social Title'
});

Best Practices

Implementation Tips:
  • Selective Updates: Only include fields you want to update in the request body
  • Field Validation: Ensure field values are valid before sending the request
  • Error Handling: Implement proper error handling for all response codes
  • Link Ownership: Verify the link belongs to your organization before updating
  • Testing: Test updates in a development environment first

Update Best Practices

  1. Minimal Updates: Only send the fields you need to change
  2. Field Validation: Validate field values before sending requests
  3. Error Recovery: Implement retry logic for network failures
  4. Logging: Log update operations for audit purposes
  5. Testing: Test updates with different field combinations

Error Handling Best Practices

  1. Check HTTP Status Codes: Always verify response status
  2. Handle Validation Errors: Provide meaningful error messages for validation failures
  3. Handle Authorization Errors: Ensure API key is valid and has proper permissions
  4. Handle Not Found Errors: Verify link ID exists and belongs to your organization
  5. Log Errors: Log API errors for debugging purposes

Use Cases

Campaign Updates

Update UTM parameters and social sharing information for ongoing campaigns:

await updateLink(linkId, {
utm_campaign: 'summer_sale_2025_v2',
social_title: 'Summer Sale - Extended!',
social_description: 'Get 50% off - Extended for one more week!'
});

Content Updates

Update destination URLs when content moves or changes:

await updateLink(linkId, {
destination_url: 'https://yourapp.com/new-product-page',
link_name: 'New Product Launch'
});

A/B Testing

Update social sharing parameters for A/B testing:

await updateLink(linkId, {
social_title: 'Version B - Amazing Product!',
social_image_url: 'https://yourapp.com/images/version-b.jpg'
});

Rate Limits

The API is subject to rate limiting. Please contact support for specific rate limit information.