---
title: "fetch(shazamID:completionHandler:)"
framework: shazamkit
role: symbol
role_heading: Type Method
path: "shazamkit/shmediaitem/fetch(shazamid:completionhandler:)"
---

# fetch(shazamID:completionHandler:)

Requests the media item for the song with the specified Shazam ID.

## Declaration

```swift
class func fetch(shazamID: String, completionHandler: @escaping @Sendable (SHMediaItem?, (any Error)?) -> Void)
```

```swift
class func fetch(shazamID: String) async throws -> SHMediaItem
```

## Parameters

- `shazamID`: The Shazam ID of the song.
- `completionHandler`: The completion handler that the system calls with the result of the request. This block takes the following parameters:

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: class func fetch(shazamID: String) async throws -> SHMediaItem For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.

## See Also

### Working with Shazam music catalog media items

- [webURL](shazamkit/shmediaitem/weburl.md)
- [shazamID](shazamkit/shmediaitem/shazamid.md)
