> ## Documentation Index
> Fetch the complete documentation index at: https://docs.envzero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Approve the access update of an AWS access setup

> Approves, as env zero, the plan of an access update that waits for approval, and the only approval that adds projects: an addition approved on the environment page is cancelled and the access update fails. Needs MANAGE_CREDENTIALS in the organization, and CREATE_AND_EDIT_TEMPLATES too when the plan changes more than which projects may deploy. The caller is recorded as the approver. 409 with a code of trust_sync_not_waiting when the deployment is not the one waiting, or trust_sync_stale when the assignments changed after the plan was made.



## OpenAPI

````yaml /api-reference/openapi.yml post /aws-access-setups/{id}/trust-sync/approve
openapi: 3.1.0
info:
  title: env zero API
  description: >
    This document describes the resources that make up the official env zero
    REST API


    ### BaseURL

    https://api.env0.com/


    ### Content Types

    All requests should be in JSON format, and include the `accept:
    application/json` header
  version: 1.0.0
  x-logo:
    url: https://github.com/env0/api/raw/gh-pages/env0-color.png
    altText: env zero logo
servers:
  - url: https://api.env0.com
security:
  - env0_API_Key: []
tags:
  - name: Users
    description: |
      This API covers management for user settings
  - name: Agents Settings
    description: ''
  - name: Audit Events
    description: ''
  - name: Templates
    description: >
      A template in env zero defines a type of environment that can be deployed.

      Click Run Now on a template to create a new environment.

      A template consists of a name, a description, a valid set of configuration
      files describing the deployment, and a set of Variables and Secrets.

      More on https://docs.envzero.com/docs/templates
  - name: Modules
    description: Module Registry endpoints
  - name: Custom Flow
    description: Project Custom Flow endpoints
  - name: Approval Policy
    description: Approval Policy endpoints
  - name: Bulk Operations
    description: |
      Bulk Operations
  - name: Cloud Compass
    description: ''
  - name: Code-Optimizer (BETA)
    description: >
      ⚠️ **BETA NOTICE**: All Code-Optimizer APIs are currently in beta and
      subject to breaking changes.


      Manages security and code quality issues found when repositories are
      scanned using code analysis tools.
  - name: Configuration
    description: >
      This API covers all deployment Configuration including: Variables, Tokens,
      SSH Keys and Deployment Credentials
  - name: Cost
    description: >
      With cost monitoring enabled in env zero, you will be able to see how much
      each Environment you are running costs.

      More on https://docs.envzero.com/docs/cost-monitoring
  - name: Credentials
    description: >
      Authentication against the env zero API is done via API Keys.


      An API Key is created by an organization administrator, but is not
      connected to any specific user when it's being used. 


      More on https://docs.envzero.com/reference/authentication
  - name: Dashboard
    description: |
      This API covers all dashboard queries
  - name: Deployment Logs
    description: |
      env zero deployment consists of steps such as Init Variables
      using this API you can retrieve information about those steps
  - name: Deployment Logs
    description: The Deployment Logs Endpoint by steps
  - name: Drift
    description: |
      API for reading drift causes detected across an organization.
  - name: Environment Import
    description: >
      Discover and import your existing environments into env zero and track
      their status
  - name: Environment Outputs
    description: |
      control environments state access configurations
  - name: Environments
    description: |
      An environment is an entity representing a deployment managed by env zero.

      Your users manage their environments in env zero in Projects.
      They can create, destroy, and redeploy environments.

      More on https://docs.envzero.com/docs/environments
  - name: Modules
    description: ''
  - name: Notifications
    description: >
      env zero can send notifications for deployment events to your Slack or
      Microsoft Teams workspace.

      You can define several Notification Targets, corresponding to different
      channels.

      You can also associate these Notification Targets to different env zero
      projects, controlling which events go to which channel.

      More on https://docs.envzero.com/docs/notifications
  - name: Organization
    description: >
      An Organization is the highest level logical entity in env zero.


      All Projects, Templates, Variable, Policies, and Environments, are defined
      for a specific organization. Organizations are logically separate from
      each other, and do not share any entities.

      More on https://docs.envzero.com/docs/organizations
  - name: Projects
    description: >
      Projects are used in env zero to provide granular access control to
      Environments.

      Every environment in env zero exists under a project, and users are given
      access on a per-project basis.

      Projects are also useful for managing multiple cloud accounts within a
      single Organization.

      We recommend using projects to separate dev environments from production
      environments, each with its own access rights and policies.

      More on https://docs.envzero.com/docs/projects
  - name: Provider Registry
    description: >-
      Provider Registry allows you to store, version control and share your
      Terraform providers privately across your organization. More on
      https://docs.envzero.com/docs/providers
  - name: Registry Metrics
    description: |
      Usage information about the modules your environments use.
  - name: Modules
    description: Module Registry endpoints
  - name: Remote Backend
    description: |
      control remote access to remote terraform state
  - name: Roles
    description: |
      Roles are used to get a precise control over who can do what.
  - name: Scheduling
    description: >
      Scheduling allows you to automatically trigger destroys and deploys of
      your environments on a scheduled basis.

      Scheduling is configured based on cron expressions, and can be attached to
      an already deployed environment only.


      More on https://docs.envzero.com/docs/scheduling
  - name: Teams
    description: >
      Teams allow you to more easily manage your project level permissions in
      env zero by setting the role for an entire group of users as a single
      entity.

      A team belongs to a single Organization, are managed at the Organization
      Settings level, and are not shared between multiple organizations

      More on https://docs.envzero.com/docs/teams
  - name: VCS
    description: >
      Manage Self Hosted VCS connections (GitLab Enterprise , GitHub Enterprise,
      Bitbucket Server)
  - name: Role Based Access
    description: >
      In order to have access to a project, users need to be associated with it.

      Each user associated with a project has a specific project Role assigned
      to them.


      More on
      https://docs.envzero.com/docs/user-management#manage-users-of-a-project
paths:
  /aws-access-setups/{id}/trust-sync/approve:
    post:
      tags:
        - Configuration
      summary: Approve the access update of an AWS access setup
      description: >-
        Approves, as env zero, the plan of an access update that waits for
        approval, and the only approval that adds projects: an addition approved
        on the environment page is cancelled and the access update fails. Needs
        MANAGE_CREDENTIALS in the organization, and CREATE_AND_EDIT_TEMPLATES
        too when the plan changes more than which projects may deploy. The
        caller is recorded as the approver. 409 with a code of
        trust_sync_not_waiting when the deployment is not the one waiting, or
        trust_sync_stale when the assignments changed after the plan was made.
      operationId: configuration-approve-aws-access-setup-trust-sync
      parameters:
        - name: id
          in: path
          description: ''
          required: true
          schema:
            type: string
        - name: organizationId
          in: query
          description: ''
          required: true
          allowEmptyValue: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/ConfigurationApi.ApproveAwsAccessSetupTrustSync.Request.Body
        description: ''
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ConfigurationApi.ApproveAwsAccessSetupTrustSync.Response
components:
  schemas:
    ConfigurationApi.ApproveAwsAccessSetupTrustSync.Request.Body:
      type: object
      properties:
        deploymentLogId:
          type: string
          description: The deployment of the trust sync that waits for approval.
      required:
        - deploymentLogId
      additionalProperties: false
    ConfigurationApi.ApproveAwsAccessSetupTrustSync.Response:
      $ref: '#/components/schemas/AwsAccessSetupDto'
    AwsAccessSetupDto:
      type: object
      properties:
        setupId:
          type: string
          description: The ID of the setup environment.
        organizationId:
          type: string
        accountMode:
          $ref: '#/components/schemas/CloudCompassAccountMode'
        includeCostData:
          type: boolean
        deployAccountIds:
          type: array
          items:
            $ref: '#/components/schemas/AwsAccountId'
          description: 'Organization mode: the member accounts that get a deploy role.'
        deployRolePolicyArns:
          type: array
          items:
            type: string
          description: >-
            Organization mode: the deploy roles' managed policies, when not
            AdministratorAccess.
        deployRolePermissionsBoundaryArn:
          type: string
          description: 'Organization mode: the deploy roles'' permissions boundary.'
        deployProjectIds:
          type: array
          items:
            type: string
          description: >-
            Organization mode with OIDC deploy roles: the projects whose
            deployments may sign in to them.
        deployTrustedPrincipalArn:
          type: string
          description: >-
            Organization mode: the self-hosted agent role the deploy roles trust
            instead of OIDC tokens.
        templateRepository:
          type: string
          description: >-
            The repository the setup deploys instead of env zero's template, the
            commit Start resolved its revision to, and its folder.
        templateRevision:
          type: string
        templateRef:
          type: string
          description: >-
            The branch, tag or commit Start was given for the repository. Absent
            for its default branch.
        templatePath:
          type: string
        deploySignInMethod:
          $ref: '#/components/schemas/AwsAccessSetupSignInMethod'
        draftId:
          type: string
          description: >-
            The Cloud Compass draft the environment creates the read role for.
            Absent only when readAccess is false.
        readAccess:
          type: boolean
          description: >-
            False: the setup has no read role, CUR export or Cloud Compass
            credential.
        organizationUnitIds:
          type: array
          items:
            $ref: '#/components/schemas/AwsOrganizationalUnitId'
          description: 'The OUs the read roles go in. Absent: the whole Organization.'
        deployToManagementAccount:
          type: boolean
          description: >-
            Organization mode: the management account gets a deploy role and
            credential.
        deploySingleAccount:
          type: boolean
          description: >-
            One account mode: the account gets a deploy role and credential for
            the user's code.
        projectName:
          type: string
        environmentName:
          type: string
        driftDetection:
          type: boolean
          description: Drift detection is on in the setup environment.
        resourceNames:
          $ref: '#/components/schemas/AwsSetupResourceNames'
        credentialsToCreate:
          type: array
          items:
            $ref: '#/components/schemas/AwsSetupCredentialToCreate'
          description: What env zero registers after the apply.
        templateVersionLabel:
          type: string
          description: >-
            The template's tag when known, else the first 7 characters of the
            pinned commit.
        trustMode:
          $ref: '#/components/schemas/AwsAccessSetupTrustMode'
        deployRoleFailures:
          type: array
          items:
            $ref: '#/components/schemas/AwsAccessSetupDeployRoleFailure'
          description: >-
            Organization mode, `done` only: the accounts whose deploy role stack
            instance is not current after the setup's apply. A Retry deploys
            them again.
        scopeChange:
          type: object
          properties:
            phase:
              type: string
              enum:
                - narrowing
                - starting
                - applying
                - widening
                - reverting
                - failed
            organizationUnitIds:
              type: array
              items:
                $ref: '#/components/schemas/AwsOrganizationalUnitId'
              description: >-
                The OUs the change moves the read roles to. Empty: the whole
                Organization.
            failure:
              type: string
          required:
            - phase
            - organizationUnitIds
          additionalProperties: false
          description: >-
            Present while the Cloud Compass scope follows a Retry that changed
            the OUs. `failed`: the change did not complete, see `failure`.
        appliedTemplateRevision:
          type: string
          description: >-
            The env zero template revision, or the fork commit, of the last
            successful setup apply. Trust syncs deploy it.
        trustSync:
          $ref: '#/components/schemas/AwsAccessSetupTrustSync'
          description: >-
            Present once a change to which projects the deploy credentials are
            assigned to reached the setup. Never changes `status`.
        cloudCompassCredentialName:
          type: string
          description: The name of the Cloud Compass credential, once created.
        cloudCompassCredentialRefusal:
          type: string
          description: >-
            Why env zero could not create the Cloud Compass credential after the
            apply, when it was refused.
        projectId:
          type: string
        environmentId:
          type: string
        deploymentLogId:
          type: string
        status:
          $ref: '#/components/schemas/AwsAccessSetupStatus'
        planSummary:
          type: object
          properties:
            added:
              type: number
            changed:
              type: number
            destroyed:
              type: number
          required:
            - added
            - changed
            - destroyed
          additionalProperties: false
          description: Known once the plan ran.
        failure:
          type: object
          properties:
            phase:
              $ref: '#/components/schemas/AwsAccessSetupFailedPhase'
            message:
              type: string
          required:
            - phase
            - message
          additionalProperties: false
        approvalsPending:
          type: boolean
          description: >-
            `waiting_for_approval` only: env zero approved the plan, which still
            waits, so the setup project's approval policy needs more approvers.
            They approve it in env zero.
        deployCredentials:
          type: array
          items:
            $ref: '#/components/schemas/AwsAccessSetupDeployCredential'
          description: >-
            The deployment credentials registered from the outputs, one per
            member account.
        readRoleFailures:
          type: array
          items:
            $ref: '#/components/schemas/AwsAccessSetupReadRoleFailure'
          description: >-
            Organization mode, `done` only: the member accounts whose read role
            stack is not current, read from AWS with the deploying credential.
            Empty when env zero read them and none failed; left out when it
            could not read them. A `done` setup with any can be retried with
            `repairReadRoles`, which deploys the member read roles again.
        readRoleRepair:
          type: boolean
          description: >-
            Organization mode: the setup's current run is a Retry that deploys
            failed member read roles again.
        readRolesRepairedAt:
          type: string
          description: When reading the last read role repair's outputs finished.
        readRolesUnchecked:
          type: string
          enum:
            - self_hosted_agent
            - no_sign_in
            - read_failed
          description: >-
            `done`, Organization mode, when env zero did not read the member
            read roles. `self_hosted_agent`: the deploying role trusts a
            self-hosted agent, which env zero cannot stand in for, so it never
            reads them. `no_sign_in`: the deploying credential is gone or the
            organization turned OIDC off, so no read works until that changes.
            `read_failed`: the read failed or AWS answered too slowly; a later
            read may work.
        cloudCompassCredentialId:
          type: string
          description: >-
            `done` only, on a read: the active Cloud Compass credential created
            from the draft, which outlives the draft.
      required:
        - setupId
        - organizationId
        - accountMode
        - includeCostData
        - deployAccountIds
        - deploySignInMethod
        - readAccess
        - projectName
        - environmentName
        - driftDetection
        - credentialsToCreate
        - templateVersionLabel
        - trustMode
        - projectId
        - environmentId
        - deploymentLogId
        - status
        - deployCredentials
      additionalProperties: false
    CloudCompassAccountMode:
      type: string
      enum:
        - single
        - organization
    AwsAccountId:
      type: string
      pattern: ^\d{12}$
    AwsAccessSetupSignInMethod:
      type: string
      enum:
        - oidc
        - assume_role
      description: >-
        How deployments sign in to the deploy roles. `oidc`: env zero's OIDC
        tokens of the setup's projects. `assume_role`: the organization's
        self-hosted agent role.
    AwsOrganizationalUnitId:
      type: string
      pattern: ^(ou-[0-9a-z]{4,32}-[a-z0-9]{8,32}|r-[0-9a-z]{4,32})$
    AwsSetupResourceNames:
      type: object
      properties:
        nameSuffix:
          type: string
          description: Six lower-case hex characters that end every name below.
        readRole:
          type: string
        readStackSet:
          type: string
        curBucket:
          type: string
        curExport:
          type: string
        deployRole:
          type: string
        deployStackSet:
          type: string
      required:
        - nameSuffix
      additionalProperties: false
    AwsSetupCredentialToCreate:
      type: object
      properties:
        kind:
          type: string
          enum:
            - deploy
            - cloud_compass
        name:
          type: string
        type:
          type: string
          enum:
            - AWS_OIDC
            - AWS_ASSUMED_ROLE_FOR_DEPLOYMENT
            - AWS_CLOUD_COMPASS
        awsAccountId:
          $ref: '#/components/schemas/AwsAccountId'
        awsAccountName:
          type: string
        awsOrganizationId:
          type: string
        isManagementAccount:
          type: boolean
      required:
        - kind
        - name
        - type
      additionalProperties: false
      description: A credential env zero registers once the apply finishes.
    AwsAccessSetupTrustMode:
      type: string
      enum:
        - static
        - assignments
      description: >-
        `static`: the trust does not follow assignments (deployProjectIds,
        assume role, self-hosted, or a setup from before). Wait for `trustSync`
        only on `assignments`.
    AwsAccessSetupDeployRoleFailure:
      type: object
      properties:
        awsAccountId:
          $ref: '#/components/schemas/AwsAccountId'
        status:
          type: string
          description: The stack instance's status, such as `OUTDATED`.
        detailedStatus:
          type: string
          description: Such as `FAILED` or `CANCELLED`.
        reason:
          type: string
          description: AWS's reason.
        stackId:
          type: string
          description: >-
            The ARN of the stack of this instance in the account, to open it in
            the AWS console.
      required:
        - awsAccountId
        - status
      additionalProperties: false
      description: >-
        Where a change to which projects a deploy credential is assigned to has
        got to in the setup's AWS roles. Deploy roles trust only the projects
        their credential is assigned to. `waiting_for_approval`: the change
        needs a person to approve it in the setup environment.
    AwsAccessSetupTrustSync:
      type: object
      properties:
        status:
          type: string
          enum:
            - pending
            - planning
            - waiting_for_approval
            - applying
            - done
            - failed
        projectIdsByAccount:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          propertyNames:
            pattern: ^\d{12}$
          description: The trust this sync applies, or applied.
        addedProjectIdsByAccount:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          propertyNames:
            pattern: ^\d{12}$
          description: Projects this sync adds per account. Empty when it only removes.
        pendingReason:
          type: string
          enum:
            - debounce
            - organization_busy
            - setup_running
            - sync_running
          description: '`pending` only.'
        approval:
          type: object
          properties:
            deploymentLogId:
              type: string
            environmentId:
              type: string
            projectId:
              type: string
            inline:
              type: boolean
              description: >-
                True when the plan changes only the deploy StackSet's project
                mapping: the inline approve is offered. False: review and
                approve on the environment page.
            approvedByEnvZero:
              type: boolean
              description: >-
                Set by the approve endpoint before it resumes the deployment, so
                env zero's own approval is told from one made elsewhere.
          required:
            - deploymentLogId
            - environmentId
            - projectId
            - inline
          additionalProperties: false
          description: '`waiting_for_approval` only.'
        deploymentLogId:
          type: string
        deployRoleFailures:
          type: array
          items:
            $ref: '#/components/schemas/AwsAccessSetupDeployRoleFailure'
          description: >-
            `done` or `failed`: the accounts whose deploy role stack instance is
            not current after the apply, read from AWS. Left out when not read.
        expectedDurationSeconds:
          type: number
          description: Rough planning and apply time from the number of member accounts.
        requestedAt:
          type: string
        updatedAt:
          type: string
        failure:
          type: string
      required:
        - status
        - projectIdsByAccount
        - addedProjectIdsByAccount
        - requestedAt
        - updatedAt
      additionalProperties: false
    AwsAccessSetupStatus:
      type: string
      enum:
        - planning
        - waiting_for_approval
        - applying
        - done
        - failed
      description: >-
        Where the setup environment is. `done`: the apply finished and env zero
        read its outputs, so the Cloud Compass draft can be verified.
    AwsAccessSetupFailedPhase:
      type: string
      enum:
        - plan
        - apply
        - cancelled
        - outputs
        - destroyed
        - cleanup
      description: >-
        `cancelled`: someone cancelled the plan before it was approved. A Retry
        plans again. `outputs`: the apply succeeded but env zero could not read
        its outputs or register the deploy credentials. `destroyed`: the setup
        environment was destroyed, which deleted its roles and their
        credentials. `cleanup`: the setup environment was destroyed, but env
        zero could not remove the credentials that used its roles. A Retry
        removes them again.
    AwsAccessSetupDeployCredential:
      type: object
      properties:
        awsAccountId:
          $ref: '#/components/schemas/AwsAccountId'
        credentialId:
          type: string
        name:
          type: string
          description: The credential's name.
        awsAccountName:
          type: string
          description: The account's name in AWS Organizations, when env zero read it.
        isManagementAccount:
          type: boolean
          description: The account is the Organization's management account.
      required:
        - awsAccountId
        - credentialId
        - name
      additionalProperties: false
    AwsAccessSetupReadRoleFailure:
      type: object
      properties:
        awsAccountId:
          $ref: '#/components/schemas/AwsAccountId'
        status:
          type: string
          description: >-
            The stack instance's status: `OUTDATED`, which a Retry repairs, or
            `INOPERABLE`, which only support can clear.
        detailedStatus:
          type: string
          description: Such as `FAILED` or `CANCELLED`.
        reason:
          type: string
          description: AWS's reason.
      required:
        - awsAccountId
        - status
      additionalProperties: false
      description: >-
        A member account whose read role stack did not deploy, so Cloud Compass
        may not read it.
  securitySchemes:
    env0_API_Key:
      type: http
      scheme: basic
      description: >
        env zero API authentication is done via API keys. An API Key can either
        be created by an organization administrator, in which case it will not
        be connected to any specific user, or via Personal API Keys to
        authenticate as a user.

        ### Creating an API Key with a Specific Role

        * Once you've created your organization, you can set up and manage API
        Keys.

        * Navigate to the Organization Settings page and click the API Keys tab.

        * Click Add API Key and enter a name for your key in the Name field.
        This name is for reference purposes only and isn't used directly in
        authentication.

        > ❗️Save Your API Key ID and secret

        > The secret will not be available after you close this window.

        ### Creating a Personal API Key

        * Click on your avatar (located on the top right of the screen)

        * Click on Personal Settings

        * Select the API Keys tab

        * Click Add API Key, and enter a name for your key in the Name field.

        This name is for reference purposes and isn't used directly in
        authentication.

        > ❗️Save your API Key ID & secret

        > The secret will not be available after you close this window.

        ### Using an API Key to Authenticate

        Authentication of the env zero API is done using the Basic
        Authentication method. Each request made should include the API Key ID
        as the username, and the API Key secret as the password. For example,
        when using curl, we can include these parameters via flag `--user {API
        Key ID}:{API Key Secret}`.

        ### API Key Permissions

        When creating an API key through the organization settings, you will
        need to choose if you’d like to grant it Organization Admin or User
        permissions. In case of the latter, you can assign fine-grained
        permissions per project. Personal API Keys can be created through the
        user’s profile page and will have the same permissions as the user has.

        ### Rate Limits

        env zero API allows up to 1K requests per 60 seconds, requests are
        aggregated by IP, HTTP Method and URI. If you exceed this limit, you
        will receive a `429` status code.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.