Terraform Workspaces API

Manage infrastructure workspaces

Operations 7

GET /organizations/{organization_name}/workspaces List Workspaces #
POST /organizations/{organization_name}/workspaces Create a Workspace #
GET /workspaces/{workspace_id} Get a Workspace #
PATCH /workspaces/{workspace_id} Update a Workspace #
DELETE /workspaces/{workspace_id} Delete a Workspace #
POST /workspaces/{workspace_id}/actions/lock Lock a Workspace #
POST /workspaces/{workspace_id}/actions/unlock Unlock a Workspace #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/terraform-workspaces-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

terraform-workspaces-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: HCP Terraform Workspaces 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: Workspaces
  description: Manage infrastructure workspaces
paths:
  /organizations/{organization_name}/workspaces:
    get:
      operationId: ListWorkspaces
      summary: List Workspaces
      description: Lists workspaces within an organization.
      tags:
      - Workspaces
      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
      - name: search[name]
        in: query
        schema:
          type: string
        description: Filter workspaces by name
      - name: search[tags]
        in: query
        schema:
          type: string
        description: Filter workspaces by tags
      - name: filter[project][id]
        in: query
        schema:
          type: string
        description: Filter workspaces by project ID
      responses:
        '200':
          description: List of workspaces
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/WorkspaceList'
    post:
      operationId: CreateWorkspace
      summary: Create a Workspace
      description: Creates a new workspace within an organization.
      tags:
      - Workspaces
      parameters:
      - name: organization_name
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/WorkspaceCreateRequest'
      responses:
        '201':
          description: Workspace created
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/WorkspaceResponse'
  /workspaces/{workspace_id}:
    get:
      operationId: GetWorkspace
      summary: Get a Workspace
      description: Retrieves details for a specific workspace.
      tags:
      - Workspaces
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Workspace details
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/WorkspaceResponse'
    patch:
      operationId: UpdateWorkspace
      summary: Update a Workspace
      description: Updates settings for an existing workspace.
      tags:
      - Workspaces
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/WorkspaceUpdateRequest'
      responses:
        '200':
          description: Workspace updated
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/WorkspaceResponse'
    delete:
      operationId: DeleteWorkspace
      summary: Delete a Workspace
      description: Destroys a workspace and all its contents.
      tags:
      - Workspaces
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Workspace deleted
  /workspaces/{workspace_id}/actions/lock:
    post:
      operationId: LockWorkspace
      summary: Lock a Workspace
      description: Locks a workspace to prevent runs.
      tags:
      - Workspaces
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              type: object
              properties:
                reason:
                  type: string
      responses:
        '200':
          description: Workspace locked
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/WorkspaceResponse'
  /workspaces/{workspace_id}/actions/unlock:
    post:
      operationId: UnlockWorkspace
      summary: Unlock a Workspace
      description: Unlocks a workspace to allow runs.
      tags:
      - Workspaces
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Workspace unlocked
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/WorkspaceResponse'
components:
  schemas:
    WorkspaceUpdateRequest:
      type: object
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
              - workspaces
            attributes:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                auto-apply:
                  type: boolean
                execution-mode:
                  type: string
    WorkspaceCreateRequest:
      type: object
      required:
      - data
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
              - workspaces
            attributes:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                description:
                  type: string
                auto-apply:
                  type: boolean
                execution-mode:
                  type: string
                terraform-version:
                  type: string
    WorkspaceResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Workspace'
    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
    Workspace:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
          - workspaces
        attributes:
          type: object
          properties:
            name:
              type: string
            description:
              type: string
            auto-apply:
              type: boolean
            locked:
              type: boolean
            execution-mode:
              type: string
              enum:
              - remote
              - local
              - agent
            terraform-version:
              type: string
            working-directory:
              type: string
            created-at:
              type: string
              format: date-time
            updated-at:
              type: string
              format: date-time
    WorkspaceList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Workspace'
        meta:
          $ref: '#/components/schemas/PaginationMeta'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use organization, team, or user tokens.