> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/infrastructure-as-code-management/iacm-api-reference/workspaces/create-workspace.md).

# Create workspace

Create a new workspace.

```json
{"openapi":"3.0.3","info":{"title":"Infrastructure as Code Management","version":"0.1.0"},"tags":[{"name":"workspaces","description":"Workspaces Service handles the API for managing workspaces\nand triggering workflows against them."}],"servers":[{"url":"http://localhost:80"}],"paths":{"/api/orgs/{org}/projects/{project}/workspaces":{"post":{"tags":["workspaces"],"summary":"Create workspace","description":"Create a new workspace.","operationId":"workspaces#create-workspace","parameters":[{"name":"org","in":"path","description":"Org is the organisation identifier.","required":true,"schema":{"type":"string","description":"Org is the organisation identifier.","minLength":1,"maxLength":128}},{"name":"project","in":"path","description":"Project is the project identifier.","required":true,"schema":{"type":"string","description":"Project is the project identifier.","minLength":1,"maxLength":128}},{"name":"Harness-Account","in":"header","description":"Account is the internal customer account ID.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Account is the internal customer account ID.","minLength":1,"maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkspaceRequest"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspacesCreateWorkspaceResponseBody"}}}},"400":{"description":"BadRequestError: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/PolicyViolationError"}}}},"401":{"description":"UnauthorizedError: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ForbiddenError: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFoundError: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"408":{"description":"TimeoutError: Request Timeout response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"ConflictError: Conflict response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"423":{"description":"LockedError: Locked response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"499":{"description":"ContextCancelledError:  response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGatewayError: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"CreateWorkspaceRequest":{"type":"object","properties":{"associated_template":{"$ref":"#/components/schemas/AssociatedTemplate"},"budget":{"type":"number","description":"define the budget for a specific workspace","format":"float"},"ccm_cost_enabled":{"type":"boolean","description":"define if CCM cost integration is enabled for this workspace","default":false},"cost_breakdown_json":{"type":"string","description":"cost_breakdown_json is the identifier to the breakdown cost file from the current execution that was applied successfully"},"cost_diff_json":{"type":"string","description":"cost_diff_json is the identifier to the diff cost file between the previous and current successful executions"},"cost_estimation_enabled":{"type":"boolean","description":"define if cost estimation operations will be performed in this workspace","default":false},"create_default_pipelines":{"type":"boolean","description":"if true, auto-generate default pipelines for the workspace provisioner at creation time","default":true},"default_pipelines":{"type":"object","description":"List of default pipelines associated with this workspace and any per-workspace overrides.","additionalProperties":{"$ref":"#/components/schemas/DefaultPipelineOverride"}},"description":{"type":"string","description":"Description provides long-form text about the resource."},"environment_variables":{"type":"object","description":"list of environment variables configured on the workspace.","additionalProperties":{"$ref":"#/components/schemas/Variable"}},"id":{"type":"integer","description":"ID PK for internal uses","format":"int64"},"identifier":{"type":"string","description":"Workspace identifier.","minLength":1,"maxLength":128},"modules_json":{"type":"string","description":"modules_json is the identifier of any modules metadata associated with this workspace"},"name":{"type":"string","description":"Name is the human readable name for the resource.","minLength":1,"maxLength":128},"provider_connector":{"type":"string","description":"Provider Connector is the reference to the connector for the infrastructure provider."},"provider_connectors":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceProviderConnector"},"description":"define an array of provider connectors that belong to Workspace"},"providers_json":{"type":"string","description":"providers_json is the identifier of any modules metadata associated with this workspace"},"provisioner":{"type":"string","description":"Provisioner defines the provisioning tool to use."},"provisioner_configuration":{"type":"string","description":"Provisioner configuration metadata (key value pair provisioner specific configuration)."},"provisioner_version":{"type":"string","description":"Provisioner Version defines the tool version to use.","default":"latest"},"prune_sensitive_data":{"type":"boolean","description":"prune_sensitive_data is a flag to enable or disable pruning of sensitive data","default":false},"repository":{"type":"string","description":"Repository is the name of the repository to use."},"repository_branch":{"type":"string","description":"Repository Branch in which the code should be accessed."},"repository_commit":{"type":"string","description":"Repository Commit/Tag in which the code should be accessed."},"repository_connector":{"type":"string","description":"Repository Connector is the reference to the connector to use for this code."},"repository_path":{"type":"string","description":"Repository Path is the path in which the infra code resides.","default":""},"repository_sha":{"type":"string","description":"Repository SHA in which the code should be accessed."},"repository_submodules":{"type":"string","description":"repository_submodules is the instruction about whether to clone submodules in the pipeline step","default":"false","enum":["false","true","recursive"]},"run_all":{"type":"boolean","description":"Run-All terragrunt modules."},"sparse_checkout":{"type":"string","description":"List of patterens that will be used for sparse checkout option of git clone"},"state_checksum":{"type":"string","description":"state_checksum is the sha-256 checksum of terraform state file"},"tags":{"type":"object","description":"Tags associated with the workspace.","additionalProperties":{"type":"string"}},"terraform_plan_json":{"type":"string","description":"terraform_plan_json is the identifier to the current state file only in JSON format."},"terraform_state":{"type":"string","description":"terraform_state is the identifier to the plan file used to create the latest state."},"terraform_state_json":{"type":"string","description":"terraform_state_json is the identifier to the plan file used to create the latest state only in JSON format."},"terraform_variable_files":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceTerraformVariableFiles"},"description":"define an array of terraform variables files that belong to a different repository"},"terraform_variables":{"type":"object","description":"list of terraform variables configured on the workspace.","additionalProperties":{"$ref":"#/components/schemas/Variable"}},"terragrunt_provider":{"type":"boolean","description":"Whether this workspace uses terragrunt to provision infrastructure","default":false},"terragrunt_version":{"type":"string","description":"Terragrunt Version to use when provisioner is terragrunt."},"variable_sets":{"type":"array","items":{"type":"string"},"description":"Attached Variable Sets references"}},"required":["identifier","name","provider_connector","provisioner","terraform_variables","environment_variables"]},"AssociatedTemplate":{"type":"object","properties":{"template_id":{"type":"string","description":"Template ID of the template associated to the Workspace.","minLength":1,"maxLength":128},"version":{"type":"string","description":"Version of the template associated to the Workspace.","minLength":1,"maxLength":64}},"description":"AssociatedTemplate defines the template details with template_id and version."},"DefaultPipelineOverride":{"type":"object","properties":{"project_pipeline":{"type":"string","description":"Default pipeline assigned as the project-level"},"workspace_pipeline":{"type":"string","description":"Default pipeline assigned as the workspace-level"}},"description":"Per-workspace override to the assigned default pipelines."},"Variable":{"type":"object","properties":{"key":{"type":"string","description":"Key is the identifier for the secret.","pattern":"^[A-Za-z_][A-Za-z0-9_-]*$","minLength":1,"maxLength":128},"value":{"type":"string","description":"Value is the value of the secret."},"value_type":{"type":"string","description":"Type indicates the value type of the variable. In the case of secret this is a\nreference to an item in the secret store. Boolean values must be \"true\" or \"false\". JSON values must be valid JSON.","enum":["string","secret","boolean","json","number"]}},"description":"Variable is the representation for a single variable associated with a workspace.","required":["key","value","value_type","kind"]},"WorkspaceProviderConnector":{"type":"object","properties":{"connector_ref":{"type":"string","description":"Connector reference in harness platform.","minLength":1,"maxLength":128},"created":{"type":"integer","description":"Timestamp when the connector was created.","format":"int64"},"id":{"type":"integer","description":"ID PK for internal uses","format":"int64"},"terragrunt_provider":{"type":"boolean","description":"Whether this workspace uses terragrunt to provision infrastructure","default":false},"type":{"type":"string","description":"Type indicates the connector type.","enum":["aws","azure","gcp","vault"]},"updated":{"type":"integer","description":"Timestamp when the connector was last updated.","format":"int64"},"workspace_id":{"type":"integer","description":"Workspace ID FK for internal uses","format":"int64"}},"description":"Workspace provider connector","required":["connector_ref","type"]},"WorkspaceTerraformVariableFiles":{"type":"object","properties":{"repository":{"type":"string","description":"Repository is the name of the repository to use."},"repository_branch":{"type":"string","description":"Repository Branch in which the code should be accessed."},"repository_commit":{"type":"string","description":"Repository Commit/Tag in which the code should be accessed."},"repository_connector":{"type":"string","description":"Repository Connector is the reference to the connector to use for this code."},"repository_path":{"type":"string","description":"Repository Path is the path in which the infra code resides.","default":""},"repository_sha":{"type":"string","description":"Repository SHA in which the code should be accessed."}},"description":"WorkspaceTerraformVarFiles defines a variable file that lives in another repository than the workspace files.","required":["repository"]},"WorkspacesCreateWorkspaceResponseBody":{"type":"object","properties":{"policy_evaluation":{"$ref":"#/components/schemas/Evaluation"}},"description":"Create-WorkspaceResponseBody result type (default view)"},"Evaluation":{"type":"object","properties":{"account_id":{"type":"string","description":"The Harness account in which the evaluation was performed"},"action":{"type":"string","description":"The action that triggered evaluation"},"created":{"type":"integer","description":"The time at which the evaluation was performed in Unix time milliseconds","format":"int64"},"details":{"type":"array","items":{"$ref":"#/components/schemas/EvaluationDetail"},"description":"The detailed results of te evaluation"},"entity":{"type":"string","description":"An arbitrary user-supplied string that globally identifies the entity under evaluation"},"entity_metadata":{"type":"string","description":"Additional arbitrary user-supplied metadata about the entity under evaluation"},"id":{"type":"integer","description":"The ID of this evaluation","format":"int64"},"input":{"description":"The input provided at evaluation time"},"org_id":{"type":"string","description":"The Harness organisation in which the evaluation was performed"},"project_id":{"type":"string","description":"The Harness project in which the evaluation was performed"},"status":{"type":"string","description":"The overall status of the evaluation indicating whether it passed","enum":["error","warning","pass"]},"type":{"type":"string","description":"The types of the entity under evaluation"}},"description":"The result of a single evaluation","required":["id","status","entity","entity_metadata","type","action","account_id","org_id","project_id","created","input","details"]},"EvaluationDetail":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy set","default":""},"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"created":{"type":"integer","description":"Time the policy set was created","format":"int64"},"description":{"type":"string","description":"Description of the policy set"},"details":{"type":"array","items":{"$ref":"#/components/schemas/EvaluatedPolicy"}},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"identifier":{"type":"string","description":"Identifier of the policy set","minLength":1},"name":{"type":"string","description":"Name of the policy set","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy set","default":""},"project_id":{"type":"string","description":"Harness project ID associated with this policy set","default":""},"status":{"type":"string","description":"The overall status for this policy set indicating whether it passed","enum":["error","warning","pass"]},"type":{"type":"string","description":"Type of input suitable for the policy set","minLength":1},"updated":{"type":"integer","description":"Time the policy set was last updated","format":"int64"}},"required":["status","details","identifier","name","action","type","enabled","created","updated","account_id","org_id","project_id","entity_selector"]},"EvaluatedPolicy":{"type":"object","properties":{"deny_messages":{"type":"array","items":{"type":"string"},"description":"The values of any `deny` rego rules as returned by the rego engine"},"output":{"description":"The output returned by the rego engine when this policy was evaluated"},"policy":{"$ref":"#/components/schemas/Policy"},"rego_error":{"type":"string","description":"Any errors returned by the rego engine when this policy was evaluated"},"status":{"type":"string","description":"The overall status for this individual policy indicating whether it passed","enum":["error","warning","pass"]}},"required":["status","policy","output","deny_messages","rego_error"]},"Policy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["identifier","name","rego","created","updated","account_id","org_id","project_id"]},"PolicyViolationError":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"policy_evaluation":{"$ref":"#/components/schemas/Evaluation"},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}}}
```
