---
title: SFSpeechURLRecognitionRequest
framework: speech
role: symbol
role_heading: Class
path: speech/sfspeechurlrecognitionrequest
---

# SFSpeechURLRecognitionRequest

A request to recognize speech in a recorded audio file.

## Declaration

```swift
class SFSpeechURLRecognitionRequest
```

## Overview

Overview Use this object to perform speech recognition on the contents of an audio file. The following example shows a method that performs recognition on an audio file based on the user’s default language and prints out the transcription. Listing 1. Getting a speech recognizer and making a recognition request func recognizeFile(url: URL) {     // Create a speech recognizer associated with the user's default language.     guard let myRecognizer = SFSpeechRecognizer() else {         // The system doesn't support the user's default language.         return     }          guard myRecognizer.isAvailable else {         // The recognizer isn't available.         return     }          // Create and execute a speech recognition request for the audio file at the URL.     let request = SFSpeechURLRecognitionRequest(url: url)     myRecognizer.recognitionTask(with: request) { (result, error) in         guard let result else {             // Recognition failed, so check the error for details and handle it.             return         }                  // Print the speech transcription with the highest confidence that the         // system recognized.         if result.isFinal {             print(result.bestTranscription.formattedString)         }     } }

## Topics

### Creating a speech recognition request

- [init(url:)](speech/sfspeechurlrecognitionrequest/init(url:)-3ymmz.md)

### Accessing the audio file URL

- [url](speech/sfspeechurlrecognitionrequest/url.md)

### Initializers

- [init(URL:)](speech/sfspeechurlrecognitionrequest/init(url:)-xca9.md)

## Relationships

### Inherits From

- [SFSpeechRecognitionRequest](speech/sfspeechrecognitionrequest.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Audio sources

- [SFSpeechAudioBufferRecognitionRequest](speech/sfspeechaudiobufferrecognitionrequest.md)
- [SFSpeechRecognitionRequest](speech/sfspeechrecognitionrequest.md)
