public sealed class UsageRule : IMessage<UsageRule>, IEquatable<UsageRule>, IDeepCloneable<UsageRule>, IBufferMessage, IMessage
Usage configuration rules for the service.
NOTE: Under development.
Use this rule to configure unregistered calls for the service. Unregistered
calls are calls that do not contain consumer project identity.
(Example: calls that do not contain an API key).
By default, API methods do not allow unregistered calls, and each method call
must be identified by a consumer project identity. Use this rule to
allow/disallow unregistered calls.
Example of an API that wants to allow unregistered calls for entire service.
If true, the selected method should skip service control and the control
plane features, such as quota and billing, will not be available.
This flag is used by Google Cloud Endpoints to bypass checks for internal
methods, such as service health check methods.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eUsageRule\u003c/code\u003e class allows configuration of unregistered calls for a service, which are calls that lack consumer project identity, such as those without an API key.\u003c/p\u003e\n"],["\u003cp\u003eBy default, API methods require consumer project identification, but \u003ccode\u003eUsageRule\u003c/code\u003e can be used to either allow or disallow these unregistered calls.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure \u003ccode\u003eUsageRule\u003c/code\u003e to apply to an entire service by setting the selector to \u003ccode\u003e"*"\u003c/code\u003e, or to a specific method like \u003ccode\u003e"google.example.library.v1.LibraryService.CreateBook"\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eUsageRule\u003c/code\u003e class also features a \u003ccode\u003eSkipServiceControl\u003c/code\u003e property that, if set to true, bypasses service control features like quota and billing for the selected methods, primarily for internal operations.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eUsageRule\u003c/code\u003e is 2.15.0, with previous versions including 2.10.0 and 2.2.0 available.\u003c/p\u003e\n"]]],[],null,["# Class UsageRule (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.UsageRule)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Api.UsageRule)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Api.UsageRule)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Api.UsageRule) \n\n public sealed class UsageRule : IMessage\u003cUsageRule\u003e, IEquatable\u003cUsageRule\u003e, IDeepCloneable\u003cUsageRule\u003e, IBufferMessage, IMessage\n\nUsage configuration rules for the service.\n\nNOTE: Under development.\n\nUse this rule to configure unregistered calls for the service. Unregistered\ncalls are calls that do not contain consumer project identity.\n(Example: calls that do not contain an API key).\nBy default, API methods do not allow unregistered calls, and each method call\nmust be identified by a consumer project identity. Use this rule to\nallow/disallow unregistered calls.\n\nExample of an API that wants to allow unregistered calls for entire service. \n\n usage:\n rules:\n - selector: \"*\"\n allow_unregistered_calls: true\n\nExample of a method that wants to allow unregistered calls. \n\n usage:\n rules:\n - selector: \"google.example.library.v1.LibraryService.CreateBook\"\n allow_unregistered_calls: true\n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e UsageRule \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[UsageRule](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.UsageRule), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[UsageRule](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.UsageRule), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[UsageRule](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.UsageRule), [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.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Api](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api)\n\nAssembly\n--------\n\nGoogle.Api.CommonProtos.dll\n\nConstructors\n------------\n\n### UsageRule()\n\n public UsageRule()\n\n### UsageRule(UsageRule)\n\n public UsageRule(UsageRule other)\n\nFields\n------\n\n### AllowUnregisteredCallsFieldNumber\n\n public const int AllowUnregisteredCallsFieldNumber = 2\n\nField number for the \"allow_unregistered_calls\" field.\n\n### SelectorFieldNumber\n\n public const int SelectorFieldNumber = 1\n\nField number for the \"selector\" field.\n\n### SkipServiceControlFieldNumber\n\n public const int SkipServiceControlFieldNumber = 3\n\nField number for the \"skip_service_control\" field.\n\nProperties\n----------\n\n### AllowUnregisteredCalls\n\n public bool AllowUnregisteredCalls { get; set; }\n\nIf true, the selected method allows unregistered calls, e.g. calls\nthat don't identify any user or application.\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Parser\n\n public static MessageParser\u003cUsageRule\u003e Parser { get; }\n\n### Selector\n\n public string Selector { get; set; }\n\nSelects the methods to which this rule applies. Use '\\*' to indicate all\nmethods in all APIs.\n\nRefer to \\[selector\\]\\[google.api.DocumentationRule.selector\\] for syntax\ndetails.\n\n### SkipServiceControl\n\n public bool SkipServiceControl { get; set; }\n\nIf true, the selected method should skip service control and the control\nplane features, such as quota and billing, will not be available.\nThis flag is used by Google Cloud Endpoints to bypass checks for internal\nmethods, such as service health check methods.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public UsageRule Clone()\n\n### Equals(UsageRule)\n\n public bool Equals(UsageRule other)\n\n### Equals(object)\n\n public override bool Equals(object other)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(UsageRule)\n\n public void MergeFrom(UsageRule other)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)"]]