Lints, or validates, an IAM policy. Currently checks the google.iam.v1.Binding.condition field, which contains a condition expression for a role binding.
Successful calls to this method always return an HTTP 200 OK status code, even if the linter detects an issue in the IAM policy.
HTTP request
POST https://iam.googleapis.com/v1/iamPolicies:lintPolicy
The request body contains data with the following structure:
JSON representation
{"fullResourceName": string,// Union field lint_object can be only one of the following:"condition": {object (Expr)}// End of list of possible types for union field lint_object.}
Fields
fullResourceName
string
The full resource name of the policy this lint request is about.
The name follows the Google Cloud format for full resource names. For example, a Google Cloud project with ID my-project will be named //cloudresourcemanager.googleapis.com/projects/my-project.
The resource name is not used to read a policy from IAM. Only the data in the request object is linted.
Union field lint_object. Required. The IAM object to be linted. lint_object can be only one of the following:
The name of the field for which this lint result is about.
For nested messages fieldName consists of names of the embedded fields separated by period character. The top-level qualifier is the input object to lint in the request. For example, the fieldName value condition.expression identifies a lint result for the expression field of the provided condition.
locationOffset
integer
0-based character position of problematic construct within the object identified by fieldName. Currently, this is populated only for condition expression.
debugMessage
string
Human readable debug message associated with the issue.
Level
Possible Level values of a validation unit corresponding to its domain of discourse.
Enums
LEVEL_UNSPECIFIED
Level is unspecified.
CONDITION
A validation unit which operates on an individual condition within a binding.
Severity
Possible Severity values of an issued result.
Enums
SEVERITY_UNSPECIFIED
Severity is unspecified.
ERROR
A validation unit returns an error only for critical issues. If an attempt is made to set the problematic policy without rectifying the critical issue, it causes the setPolicy operation to fail.
WARNING
Any issue which is severe enough but does not cause an error. For example, suspicious constructs in the input object will not necessarily fail setPolicy, but there is a high likelihood that they won't behave as expected during policy evaluation in checkPolicy. This includes the following common scenarios:
Unsatisfiable condition: Expired timestamp in date/time condition.
Ineffective condition: Condition on a <principal, role> pair which is granted unconditionally in another binding of the same policy.
NOTICE
Reserved for the issues that are not severe as ERROR/WARNING, but need special handling. For instance, messages about skipped validation units are issued as NOTICE.
INFO
Any informative statement which is not severe enough to raise ERROR/WARNING/NOTICE, like auto-correction recommendations on the input content. Note that current version of the linter does not utilize INFO.
[[["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-05-21 UTC."],[[["\u003cp\u003eThis service provides a way to lint, or validate, an IAM policy, specifically focusing on the \u003ccode\u003egoogle.iam.v1.Binding.condition\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePOST https://iam.googleapis.com/v1/iamPolicies:lintPolicy\u003c/code\u003e endpoint is used to send a request with a policy object for linting.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must contain the \u003ccode\u003efullResourceName\u003c/code\u003e and the \u003ccode\u003econdition\u003c/code\u003e to be evaluated.\u003c/p\u003e\n"],["\u003cp\u003eThe response body will contain a list of \u003ccode\u003eLintResult\u003c/code\u003e objects, each detailing a potential issue found in the policy, sorted by severity in descending order.\u003c/p\u003e\n"],["\u003cp\u003eThe possible severity levels of the \u003ccode\u003eLintResult\u003c/code\u003e ranges from \u003ccode\u003eERROR\u003c/code\u003e, which are issues that prevent a setPolicy operation, to \u003ccode\u003eINFO\u003c/code\u003e which are only informative.\u003c/p\u003e\n"]]],[],null,["# Method: iamPolicies.lintPolicy\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.LintPolicyResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [LintResult](#LintResult)\n - [JSON representation](#LintResult.SCHEMA_REPRESENTATION)\n- [Level](#Level)\n- [Severity](#Severity)\n- [Examples](#examples)\n- [Try it!](#try-it)\n\nLints, or validates, an IAM policy. Currently checks the [google.iam.v1.Binding.condition](/iam/docs/reference/rest/v1/Policy#Binding.FIELDS.condition) field, which contains a condition expression for a role binding.\n\nSuccessful calls to this method always return an HTTP `200 OK` status code, even if the linter detects an issue in the IAM policy.\n\n### HTTP request\n\n`POST https://iam.googleapis.com/v1/iamPolicies:lintPolicy`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nThe response of a lint operation. An empty response indicates the operation was able to fully execute and no lint issue was found.\n\nIf successful, the response body contains data with the following structure:\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/iam`\n- `\n https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\nLintResult\n----------\n\nStructured response of a single validation unit.\n\nLevel\n-----\n\nPossible Level values of a validation unit corresponding to its domain of discourse.\n\nSeverity\n--------\n\nPossible Severity values of an issued result."]]