<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -",
    "macOS: 26.4.0 -",
    "tvOS: 26.4.0 -",
    "visionOS: 26.4.0 -",
    "watchOS: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "LinkPresentation",
  "identifier" : "/documentation/LinkPresentation/LinkMetadata/init(fetching:timeout:includeSubresources:)-7rkd9",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Link Presentation",
      "LinkPresentation"
    ],
    "preciseIdentifier" : "s:16LinkPresentation0A8MetadataV8fetching7timeout19includeSubresourcesAC10Foundation10URLRequestV_s8DurationVSbtYaKcfc"
  },
  "title" : "init(fetching:timeout:includeSubresources:)"
}
-->

# init(fetching:timeout:includeSubresources:)

Creates a [`LinkMetadata`](/documentation/LinkPresentation/LinkMetadata) value from the specified properties by fetching the URL using the specified request.

```
nonisolated init(fetching request: URLRequest, timeout: Duration = .seconds(30), includeSubresources: Bool = true) async throws
```

## Parameters

`request`

The URL request to fetch the metadata from.

`timeout`

The time interval after which the request automatically fails if it hasn’t already completed. By default, this
is 30 seconds. If a metadata fetch takes longer than the timeout interval, an `Error` is thrown.

`includeSubresources`

Determines if subresources should be fetched in addition to the main resource. If `true`, additional data will be fetched from the network to provide subresources such as images and icons. If `false`, no additional networking is done.

## Discussion

Metadata fetching supports Task cancellation; if the enclosing Task is cancelled, the metadata request will be cancelled.

---

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)