About Permanent Asset URLs
Contentstack allows you to assign a permanent URL to an asset. This alternate asset reference remains constant irrespective of any subsequent updates to the asset, so you don't have to update asset URLs manually across entries.
You can find the Generate permanent URL option in the Permanent URL section on the asset details page.
When you generate a permanent URL, you can access the same asset using the following URLs:
- Auto-generated asset URL: The default path to the asset (changes whenever an asset is replaced)
- Permanent asset URL: The non-editable path to the asset (cannot be edited once generated)
Warning: You can generate the permanent asset URL and update the asset details only once. Once done, you can no longer make changes to the permanent URL.
By default, assets (images, pdf, videos, etc.) in Contentstack have a variable URL that changes with every replacement. Let's say you have an image uploaded in Contentstack with the following URL:
Version 1:
https://images.contentstack.io/v3/assets/blt95131ce7919c7429/blt293c6dd97376af9f/60b258bg299917402992601b/sample_logo.png
When you edit an asset to replace the image in Contentstack, you'll get a new URL:
Version 2:
https://images.contentstack.io/v3/assets/blt95131ce7919c7429/blt293c6dd97376af9f/60b158bf299917401442602e/new_sample_logo.png
On the other hand, a permanent URL would not change regardless of the replacements made to the asset file. The default pattern of the permanent asset URL is as follows:
https://{base_url}/v3/assets/{stack_api_key}/{asset_uid}/{slug}
In the above URL, you can assign any unique identifier (slug) that describes your asset.
For example:
https://images.contentstack.io/v3/assets/blt95131ce7919c7429/blt293c6dd97376af9f/sample_logo.png
Note: The maximum number of characters you can enter as a slug for the permanent URL is 255 characters.
API Reference
To generate a permanent URL for assets and use the permanent URLs to fetch files via the API, you can refer to the following API requests: