Terraform Teams API

Manage teams and memberships

OpenAPI Specification

terraform-teams-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: HCP Terraform Modules Teams API
  description: The HCP Terraform API provides programmatic access to HCP Terraform features including workspace management, runs, state versions, policies, teams, and organizations. The API follows the JSON API specification.
  version: '2.0'
  contact:
    name: HashiCorp Support
    url: https://support.hashicorp.com
  license:
    name: Business Source License 1.1
    url: https://github.com/hashicorp/terraform/blob/main/LICENSE
servers:
- url: https://app.terraform.io/api/v2
  description: HCP Terraform Production API
security:
- bearerAuth: []
tags:
- name: Teams
  description: Manage teams and memberships
paths:
  /organizations/{organization_name}/teams:
    get:
      operationId: ListTeams
      summary: List Teams
      description: Lists all teams in an organization.
      tags:
      - Teams
      parameters:
      - name: organization_name
        in: path
        required: true
        schema:
          type: string
      - name: page[number]
        in: query
        schema:
          type: integer
      - name: page[size]
        in: query
        schema:
          type: integer
      responses:
        '200':
          description: List of teams
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/TeamList'
    post:
      operationId: CreateTeam
      summary: Create a Team
      description: Creates a new team within an organization.
      tags:
      - Teams
      parameters:
      - name: organization_name
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/TeamCreateRequest'
      responses:
        '201':
          description: Team created
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/TeamResponse'
  /teams/{team_id}:
    get:
      operationId: GetTeam
      summary: Get a Team
      description: Retrieves details for a specific team.
      tags:
      - Teams
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Team details
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/TeamResponse'
    delete:
      operationId: DeleteTeam
      summary: Delete a Team
      description: Deletes a team.
      tags:
      - Teams
      parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Team deleted
components:
  schemas:
    TeamResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Team'
    PaginationMeta:
      type: object
      properties:
        pagination:
          type: object
          properties:
            current-page:
              type: integer
            prev-page:
              type: integer
              nullable: true
            next-page:
              type: integer
              nullable: true
            last-page:
              type: integer
            total-count:
              type: integer
    Team:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
          - teams
        attributes:
          type: object
          properties:
            name:
              type: string
            users-count:
              type: integer
            visibility:
              type: string
    TeamCreateRequest:
      type: object
      required:
      - data
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
              - teams
            attributes:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                visibility:
                  type: string
    TeamList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Team'
        meta:
          $ref: '#/components/schemas/PaginationMeta'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use organization, team, or user tokens.