<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 10.0.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Speech",
  "identifier" : "/documentation/Speech/SFSpeechURLRecognitionRequest",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Speech"
    ],
    "preciseIdentifier" : "c:objc(cs)SFSpeechURLRecognitionRequest"
  },
  "title" : "SFSpeechURLRecognitionRequest"
}
-->

# SFSpeechURLRecognitionRequest

A request to recognize speech in a recorded audio file.

```
class SFSpeechURLRecognitionRequest
```

## 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

```swift
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:)`](/documentation/Speech/SFSpeechURLRecognitionRequest/init(url:)-3ymmz)

Creates a speech recognition request, initialized with the specified URL.

### Accessing the audio file URL

[`url`](/documentation/Speech/SFSpeechURLRecognitionRequest/url)

The URL of the audio file.



---

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)