• Infrastructure Lifecycle Management
    • TerraformManage infrastructure as code
    • PackerBuild machine images
    • NomadOrchestrate workloads
    • WaypointStandardize application patterns
    • VagrantBuild developer environments
  • Security Lifecycle Management
    • VaultCentrally manage secrets
    • BoundarySecure remote access
    • HCP Vault SecretsManage secrets as a service
    • ConsulSecure network services
    • HCP Vault RadarScan for embedded secrets
HashiCorp Cloud Platform
Get started in minutes with our cloud products
All HCP Products
Learn
  • CertificationsGet HashiCorp certified
  • TutorialsLearn HashiCorp products
  • Well-Architected FrameworkAdopt HashiCorp best practices
Terraform
  • Install
  • Tutorials
    • Docs Overview
    • Intro to Terraform
    • Configuration Language
    • Terraform CLI
    • HCP Terraform
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up

Terraform Home

Terraform Enterprise

  • Terraform Enterprise
  • Terraform Enterprise

  • Overview
    • Overview
    • Account
    • Agent Pools
    • Agent Tokens
    • Applies
    • Assessment Results
    • Comments
    • Configuration Versions
    • Cost Estimates
    • Data Retention Policies
    • GitHub App Installations
    • Invoices
    • Notification Configurations
    • No-Code Provisioning
    • OAuth Clients
    • OAuth Tokens
    • Organizations
    • Organization Memberships
    • Organization Tags
    • Organization Tokens
    • Plan Exports
    • Plans
    • Policies
    • Policy Checks
    • Policy Evaluations
    • Policy Sets
    • Policy Set Parameters
    • Projects
    • Project Team Access
    • Runs
    • Run Triggers
    • SSH Keys
    • State Versions
    • State Version Outputs
    • Team Access
    • Team Membership
    • Team Tokens
    • Teams
    • User Tokens
    • Users
    • Variables
    • VCS Events
    • Workspaces
    • Workspace-Specific Variables
    • Workspace Resources
    • Variable Sets
    • Changelog
    • Stability Policy

  • HCP Terraform Agents

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)

You are viewing documentation for version v202411-2. View latest version.

  1. Developer
  2. Terraform
  3. Terraform Enterprise v202411-2
  4. Organization Tokens
  • Terraform Enterprise
  • v202502-1 (latest)
  • v202501-1
  • v202411-1
  • v202410-1
  • v202409-3
  • v202409-2
  • v202409-1
  • v202408-1
  • v202407-1
  • v202406-1
  • v202405-1
  • v202404-2
  • v202404-1
  • v202402-2
  • v202402-1
  • v202401-2
  • v202401-1
  • v202312-1
  • v202311-1
  • v202310-1
  • v202309-1
  • v202308-1
  • v202307-1
  • v202306-1
  • v202305-2
  • v202305-1
  • v202304-1
  • v202303-1
  • v202302-1
  • v202301-2
  • v202301-1
  • v202212-2
  • v202212-1
  • v202211-1
  • v202210-1
  • v202209-2
  • v202209-1
  • v202208-3
  • v202208-2
  • v202208-1
  • v202207-2
  • v202207-1
  • v202206-1

Organization Token API

Generate a new organization token

POST /organizations/:organization_name/authentication-token

ParameterDescription
:organization_nameThe name of the organization to generate a token for.

Generates a new organization API token, replacing any existing token.

Only members of the owners team, the owners team API token, and the organization API token can access this endpoint.

This endpoint returns the secret text of the new authentication token. You can only access this token when you create it and can not recover it later.

StatusResponseReason
201JSON API document (type: "authentication-tokens")Success
404JSON API error objectUser not authorized

Request Body

This POST endpoint requires a JSON object with the following properties as a request payload.

Key pathTypeDefaultDescription
data.typestringMust be "authentication-token".
data.attributes.expired-atstringnullThe UTC date and time that the Organization Token will expire, in ISO 8601 format. If omitted or set to null the token will never expire.

Sample Payload

{
  "data": {
    "type": "authentication-token",
    "attributes": {
      "expired-at": "2023-04-06T12:00:00.000Z"
    }
  }
}

Sample Request

curl \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/vnd.api+json" \
  --request POST \
  --data @payload.json \
  https://app.terraform.io/api/v2/organizations/my-organization/authentication-token

Sample Response

{
  "data": {
    "id": "4111756",
    "type": "authentication-tokens",
    "attributes": {
      "created-at": "2017-11-29T19:11:28.075Z",
      "last-used-at": null,
      "description": null,
      "token": "ZgqYdzuvlv8Iyg.atlasv1.6nV7t1OyFls341jo1xdZTP72fN0uu9VL55ozqzekfmToGFbhoFvvygIRy2mwVAXomOE",
      "expired-at": "2023-04-06T12:00:00.000Z"
    },
    "relationships": {
      "created-by": {
        "data": {
          "id": "user-62goNpx1ThQf689e",
          "type": "users"
        }
      }
    }
  }
}

Delete the organization token

DELETE /organizations/:organization/authentication-token

ParameterDescription
:organization_nameWhich organization's token should be deleted.

Only members of the owners team, the owners team API token, and the organization API token can access this endpoint.

StatusResponseReason
204No ContentSuccess
404JSON API error objectUser not authorized

Sample Request

curl \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/vnd.api+json" \
  --request DELETE \
  https://app.terraform.io/api/v2/organizations/my-organization/authentication-token

On this page:

  1. Organization Token API
  2. Generate a new organization token
  3. Delete the organization token
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Accessibility
  • Give Feedback(opens in new tab)