<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PhotoKit",
  "identifier" : "/documentation/Photos/PHAssetResourceManager/exportedAssetID(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Photos"
    ],
    "preciseIdentifier" : "s:So22PHAssetResourceManagerC6PhotosE15exportedAssetID3forSo7CKAssetC8CloudKitE08ExportedfG0VSo0aB0C_tYaKF"
  },
  "title" : "exportedAssetID(for:)"
}
-->

# exportedAssetID(for:)

Returns the exported asset ID for the specified asset resource.

```
func exportedAssetID(for resource: PHAssetResource) async throws -> CKAsset.ExportedAssetID
```

## Parameters

`resource`

The asset resource to get an exported asset ID for.

## Return Value

The exported asset ID for the resource.

## Discussion

The returned `CKAsset.ExportedAssetID` can be used to create a `CKAsset` that references the
asset resource data without copying it. Network access is always required.

An exported asset ID exists only for a resource whose data iCloud Photos stores in CloudKit as
its own `CKAsset`, e.g. the original media and adjustment renders in
`PHAssetResource/TypeGroup/coreComponents`, and `PHAssetResourceType/derivative` resources
in `PHAssetResource/TypeGroup/mediaDerivatives`.

Resources that have no CloudKit asset to reference, like the on-device generated
`PHAssetResourceType/thumbnailDerivative`, will fail with [`missingResource`](/documentation/Photos/PHPhotosError-swift.struct/missingResource).

Note that a resource’s [`type`](/documentation/Photos/PHAssetResource/type) alone does not determine whether an ID is
available — a library that stopped using iCloud Photos may still report resources of a
referenceable type. Request an ID for the specific resource you intend to reference, and fall
back to requesting the resource’s data when none is available.

The photo library must use iCloud Photos; a request against a library that doesn’t fails with
[`requestNotSupportedForAsset`](/documentation/Photos/PHPhotosError-swift.struct/requestNotSupportedForAsset).

This method supports task cancellation. If the calling task is cancelled, the underlying network
request is cancelled and this method throws `CancellationError`.

> Throws: ``doc://com.apple.photokit/documentation/Photos/PHPhotosError-swift.struct/missingResource`` if the resource has no CloudKit asset to reference,
> `CancellationError` if the task is cancelled, or another error if the request fails.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)