public sealed class RecognizeRequest : IMessage<RecognizeRequest>, IEquatable<RecognizeRequest>, IDeepCloneable<RecognizeRequest>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Speech-to-Text v2 API class RecognizeRequest.
Request message for the
[Recognize][google.cloud.speech.v2.Speech.Recognize] method. Either
content or uri must be supplied. Supplying both or neither returns
[INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See content
limits.
Features and audio metadata to use for the Automatic Speech Recognition.
This field in combination with the
[config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
can be used to override parts of the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the Recognizer resource.
The list of fields in
[config][google.cloud.speech.v2.RecognizeRequest.config] that override the
values in the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the recognizer during this recognition request. If no mask is provided,
all non-default valued fields in
[config][google.cloud.speech.v2.RecognizeRequest.config] override the
values in the recognizer for this recognition request. If a mask is
provided, only the fields listed in the mask override the config in the
recognizer for this recognition request. If a wildcard (*) is provided,
[config][google.cloud.speech.v2.RecognizeRequest.config] completely
overrides and replaces the config in the recognizer for this recognition
request.
The audio data bytes encoded as specified in
[RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
with all bytes fields, proto buffers use a pure binary representation,
whereas JSON representations use base64.
Required. The name of the Recognizer to use during recognition. The
expected format is
projects/{project}/locations/{location}/recognizers/{recognizer}. The
{recognizer} segment may be set to _ to use an empty implicit Recognizer.
URI that points to a file that contains audio data bytes as specified in
[RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
must not be compressed (for example, gzip). Currently, only Google Cloud
Storage URIs are supported, which must be specified in the following
format: gs://bucket_name/object_name (other URI formats return
[INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
information, see Request
URIs.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eRecognizeRequest\u003c/code\u003e class is used for sending requests to the Cloud Speech-to-Text v2 API's \u003ccode\u003eRecognize\u003c/code\u003e method, and it requires either audio \u003ccode\u003econtent\u003c/code\u003e or a \u003ccode\u003euri\u003c/code\u003e to audio data, but not both.\u003c/p\u003e\n"],["\u003cp\u003eThis class allows the use of different versions of the API including 1.4.0 (latest), 1.3.0, 1.2.0, 1.1.0 and 1.0.0, for the Google.Cloud.Speech.V2 package, and implements several interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize speech recognition behavior using the \u003ccode\u003eConfig\u003c/code\u003e and \u003ccode\u003eConfigMask\u003c/code\u003e properties to override settings from the \u003ccode\u003edefault_recognition_config\u003c/code\u003e of the Recognizer resource.\u003c/p\u003e\n"],["\u003cp\u003eAudio data can be provided directly via the \u003ccode\u003eContent\u003c/code\u003e property as a \u003ccode\u003eByteString\u003c/code\u003e or through a URI using the \u003ccode\u003eUri\u003c/code\u003e property, currently supporting only Google Cloud Storage URIs.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRecognizer\u003c/code\u003e property specifies which recognizer to use for the recognition request, and it can be specified either as a string or through the \u003ccode\u003eRecognizerAsRecognizerName\u003c/code\u003e property, which is a \u003ccode\u003eRecognizerName\u003c/code\u003e-typed view.\u003c/p\u003e\n"]]],[],null,["# Cloud Speech-to-Text v2 API - Class RecognizeRequest (1.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.5.0 (latest)](/dotnet/docs/reference/Google.Cloud.Speech.V2/latest/Google.Cloud.Speech.V2.RecognizeRequest)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.Speech.V2/1.4.0/Google.Cloud.Speech.V2.RecognizeRequest)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Speech.V2/1.3.0/Google.Cloud.Speech.V2.RecognizeRequest)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Speech.V2/1.2.0/Google.Cloud.Speech.V2.RecognizeRequest)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Speech.V2/1.1.0/Google.Cloud.Speech.V2.RecognizeRequest)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Speech.V2/1.0.0/Google.Cloud.Speech.V2.RecognizeRequest) \n\n public sealed class RecognizeRequest : IMessage\u003cRecognizeRequest\u003e, IEquatable\u003cRecognizeRequest\u003e, IDeepCloneable\u003cRecognizeRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Speech-to-Text v2 API class RecognizeRequest.\n\nRequest message for the\n\\[Recognize\\]\\[google.cloud.speech.v2.Speech.Recognize\\] method. Either\n`content` or `uri` must be supplied. Supplying both or neither returns\n\\[INVALID_ARGUMENT\\]\\[google.rpc.Code.INVALID_ARGUMENT\\]. See [content\nlimits](https://cloud.google.com/speech-to-text/quotas#content). \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e RecognizeRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[RecognizeRequest](/dotnet/docs/reference/Google.Cloud.Speech.V2/latest/Google.Cloud.Speech.V2.RecognizeRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[RecognizeRequest](/dotnet/docs/reference/Google.Cloud.Speech.V2/latest/Google.Cloud.Speech.V2.RecognizeRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[RecognizeRequest](/dotnet/docs/reference/Google.Cloud.Speech.V2/latest/Google.Cloud.Speech.V2.RecognizeRequest), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Speech.V2](/dotnet/docs/reference/Google.Cloud.Speech.V2/latest/Google.Cloud.Speech.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Speech.V2.dll\n\nConstructors\n------------\n\n### RecognizeRequest()\n\n public RecognizeRequest()\n\n### RecognizeRequest(RecognizeRequest)\n\n public RecognizeRequest(RecognizeRequest other)\n\nProperties\n----------\n\n### AudioSourceCase\n\n public RecognizeRequest.AudioSourceOneofCase AudioSourceCase { get; }\n\n### Config\n\n public RecognitionConfig Config { get; set; }\n\nFeatures and audio metadata to use for the Automatic Speech Recognition.\nThis field in combination with the\n\\[config_mask\\]\\[google.cloud.speech.v2.RecognizeRequest.config_mask\\] field\ncan be used to override parts of the\n\\[default_recognition_config\\]\\[google.cloud.speech.v2.Recognizer.default_recognition_config\\]\nof the Recognizer resource.\n\n### ConfigMask\n\n public FieldMask ConfigMask { get; set; }\n\nThe list of fields in\n\\[config\\]\\[google.cloud.speech.v2.RecognizeRequest.config\\] that override the\nvalues in the\n\\[default_recognition_config\\]\\[google.cloud.speech.v2.Recognizer.default_recognition_config\\]\nof the recognizer during this recognition request. If no mask is provided,\nall non-default valued fields in\n\\[config\\]\\[google.cloud.speech.v2.RecognizeRequest.config\\] override the\nvalues in the recognizer for this recognition request. If a mask is\nprovided, only the fields listed in the mask override the config in the\nrecognizer for this recognition request. If a wildcard (`*`) is provided,\n\\[config\\]\\[google.cloud.speech.v2.RecognizeRequest.config\\] completely\noverrides and replaces the config in the recognizer for this recognition\nrequest.\n\n### Content\n\n public ByteString Content { get; set; }\n\nThe audio data bytes encoded as specified in\n\\[RecognitionConfig\\]\\[google.cloud.speech.v2.RecognitionConfig\\]. As\nwith all bytes fields, proto buffers use a pure binary representation,\nwhereas JSON representations use base64.\n\n### HasContent\n\n public bool HasContent { get; }\n\nGets whether the \"content\" field is set\n\n### HasUri\n\n public bool HasUri { get; }\n\nGets whether the \"uri\" field is set\n\n### Recognizer\n\n public string Recognizer { get; set; }\n\nRequired. The name of the Recognizer to use during recognition. The\nexpected format is\n`projects/{project}/locations/{location}/recognizers/{recognizer}`. The\n{recognizer} segment may be set to `_` to use an empty implicit Recognizer.\n\n### RecognizerAsRecognizerName\n\n public RecognizerName RecognizerAsRecognizerName { get; set; }\n\n[RecognizerName](/dotnet/docs/reference/Google.Cloud.Speech.V2/latest/Google.Cloud.Speech.V2.RecognizerName)-typed view over the [Recognizer](/dotnet/docs/reference/Google.Cloud.Speech.V2/latest/Google.Cloud.Speech.V2.RecognizeRequest#Google_Cloud_Speech_V2_RecognizeRequest_Recognizer) resource name property.\n\n### Uri\n\n public string Uri { get; set; }\n\nURI that points to a file that contains audio data bytes as specified in\n\\[RecognitionConfig\\]\\[google.cloud.speech.v2.RecognitionConfig\\]. The file\nmust not be compressed (for example, gzip). Currently, only Google Cloud\nStorage URIs are supported, which must be specified in the following\nformat: `gs://bucket_name/object_name` (other URI formats return\n\\[INVALID_ARGUMENT\\]\\[google.rpc.Code.INVALID_ARGUMENT\\]). For more\ninformation, see [Request\nURIs](https://cloud.google.com/storage/docs/reference-uris)."]]