---
title: "startFetchingMetadata(for:completionHandler:)"
framework: linkpresentation
role: symbol
role_heading: Instance Method
path: "linkpresentation/lpmetadataprovider/startfetchingmetadata(for:completionhandler:)-54z5i"
---

# startFetchingMetadata(for:completionHandler:)

Fetches metadata for the given URL.

## Declaration

```swift
func startFetchingMetadata(for URL: URL, completionHandler: @escaping @Sendable (LPLinkMetadata?, (any Error)?) -> Void)
```

```swift
func startFetchingMetadata(for URL: URL) async throws -> LPLinkMetadata
```

## Discussion

Discussion Call this method once per LPMetadataProvider instance. If you attempt to fetch metadata multiple times on a single LPMetadataProvider instance, it throws an error. The completion handler executes on a background queue. Dispatch any necessary UI updates back to the main queue. When the completion handler returns, it deletes any file URLs returned in the resulting LPLinkMetadata.

## See Also

### Fetching metadata

- [cancel()](linkpresentation/lpmetadataprovider/cancel().md)
- [shouldFetchSubresources](linkpresentation/lpmetadataprovider/shouldfetchsubresources.md)
- [timeout](linkpresentation/lpmetadataprovider/timeout.md)
