---
title: "PUT /policy/generation"
method: PUT
path: "/policy/generation"
---

# PUT /policy/generation

`PUT /policy/generation`

Starts the policy generation request.

## Request body

- object
  - `policyGenerationDetails` object, required — Contains the ARN details about the IAM entity for which the policy is generated.
    - `principalArn` string — The ARN of the IAM entity (user or role) for which you are generating a policy.
  - `cloudTrailDetails` object — Contains information about CloudTrail access.
    - `trails` Trail[] — A <code>Trail</code> object that contains settings for a trail.
      - `cloudTrailArn` string, required — Specifies the ARN of the trail. The format of a trail ARN is <code>arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail</code>.
      - `regions` String[] — A list of regions to get CloudTrail data from and analyze to generate a policy.
      - `allRegions` boolean — Possible values are <code>true</code> or <code>false</code>. If set to <code>true</code>, IAM Access Analyzer retrieves CloudTrail data from all regions to analyze and generate a policy.
    - `accessRole` string — The ARN of the service role that IAM Access Analyzer uses to access your CloudTrail trail and service last accessed information.
    - `startTime` string, date-time — The start of the time range for which IAM Access Analyzer reviews your CloudTrail events. Events with a timestamp before this time are not considered to generate a policy.
    - `endTime` string, date-time — The end of the time range for which IAM Access Analyzer reviews your CloudTrail events. Events with a timestamp after this time are not considered to generate a policy. If this is not included in the request, the default value is the current time.
  - `clientToken` string — <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p> <p>If you do not specify a client token, one is automatically generated by the Amazon Web Services SDK.</p>

## Response `200`

Success

- StartPolicyGenerationResponse
  - `jobId` string, required — The <code>JobId</code> that is returned by the <code>StartPolicyGeneration</code> operation. The <code>JobId</code> can be used with <code>GetGeneratedPolicy</code> to retrieve the generated policies or used with <code>CancelPolicyGeneration</code> to cancel the policy generation request.

## Other responses

- `480` — ConflictException
- `481` — ValidationException
- `482` — InternalServerException
- `483` — ServiceQuotaExceededException
- `484` — ThrottlingException
- `485` — AccessDeniedException

---

[API](https://skmtc.net/aws/apis/accessanalyzer.md) · [All operations](https://skmtc.net/aws/apis/accessanalyzer/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/accessanalyzer/versions/d729b5bbb9cd/schema)
