> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://contentful.com/developers/docs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/_mcp/server. # Unarchive an asset DELETE https://api.contentful.com/spaces/{space_id}/environments/{environment_id}/assets/{asset_id}/archived Unarchives an asset, restoring it to draft state. Files can take up to an hour to become available on the CDN again. Reference: https://contentful.com/developers/docs/references/content-management-api/assets/unarchive-an-asset ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `space_id` (string, required) — ID of the Space in form of a string - `environment_id` (string, required) — ID of the environment in form of a string - `asset_id` (string, required) — ID of the Asset in form of a string ### Headers - `X-Contentful-Version` (string, optional) — Version of the asset to unarchive ## Response ### 200 OK - Request successful - `map from string to any` ## Examples **Response** ```json { "fields": { "file": { "en-US": { "contentType": "image/jpeg", "fileName": "example.jpeg", "upload": "https://example.com/example.jpg" } }, "title": { "en-US": "Playsam Streamliner" } }, "metadata": { "tags": [ { "sys": { "id": "nyCampaign", "linkType": "Tag", "type": "Link" } } ] } } ``` **SDK Code** ```android Android // Create the Contentful client. final CMAClient client = new CMAClient .Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build(); client .assets() .async() .fetchOne( "", new CMACallback() { @Override protected void onSuccess(final CMAAsset asset) { client .assets() .async() .unArchive( asset, new CMACallback() { @Override protected void onSuccess(CMAAsset result) { // The unarchived asset will be the parameter of this callback. new AlertDialog.Builder(context) .setTitle("Contentful") .setMessage("Archived Asset unarchived." + "\n\nResult: " + result) .show(); } @Override protected void onFailure(RuntimeException exception) { // An error occurred! Inform the user. new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Asset could not be unarchived." + "\n\nReason: " + exception.toString()) .show(); super.onFailure(exception); } } ); } @Override protected void onFailure(RuntimeException exception) { // An error occurred! Inform the user. new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Could not fetch the asset." + "\n\nReason: " + exception.toString()) .show(); super.onFailure(exception); } } ); ``` ```java Java // Create the Contentful client. final CMAClient client = new CMAClient .Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build(); // Fetch an existing asset. final CMAAsset asset = client .assets() .fetchOne(""); // Unarchive it. final CMAAsset archive = client .assets() .unArchive(asset); ``` ```kotlin Kotlin // Create the Contentful client. val client = CMAClient.Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build() // Fetch an existing asset. val asset = client .assets() .fetchOne("") // Unarchive it. val archive = client .assets() .unArchive(asset) ``` ```swift Swift We currently don't provide a CMA SDK for this platform. ``` ```js-legacy JavaScript (legacy) import { createClient } from 'contentful-management' const client = createClient({ accessToken: '' }, { type: 'legacy' }) client.getSpace('') .then((space) => space.getEnvironment('')) .then((environment) => environment.getAsset('')) .then((asset) => asset.unarchive()) .then((asset) => console.log(`Asset ${asset.sys.id} unarchived.`)) .catch(console.error) ``` ```javascript JavaScript import { createClient } from 'contentful-management' // Client init const client = contentful.createClient({ accessToken: '' }) const asset = await client.asset.unarchive({ spaceId: '', environmentId: '', assetId: '', }); ``` ```php PHP $client = new \Contentful\Management\Client(''); $environment = $client->getEnvironmentProxy('', ''); $asset = $environment->getAsset(''); $asset->unarchive(); ``` ```ruby Ruby require 'contentful/management' client = Contentful::Management::Client.new('') asset = client.assets('', '').find('') asset.unarchive ``` ```python Python from contentful_management import Client client = Client('') asset = client.assets('', '').find('') asset.unarchive() ``` ```.net .NET // This client should only be created once per application. var httpClient = new HttpClient(); var client = new ContentfulManagementClient(httpClient, "", ""); int version = 2; await client.UnarchiveAsset("", version); ```