---
title: "Create a new Resource Definition."
method: POST
path: "/orgs/{orgId}/resources/defs"
tags: ["public", "ResourceDefinition"]
---

# Create a new Resource Definition.

`POST /orgs/{orgId}/resources/defs`

## Path parameters

- `orgId` string, required

## Request body

- CreateResourceDefinitionRequestRequest — CreateResourceDefinitionRequest describes a new ResourceDefinition request.
  - `criteria` MatchingCriteriaRuleRequest[] — (Optional) The criteria to use when looking for a Resource Definition during the deployment.
    - `app_id` string — (Optional) The ID of the Application that the Resources should belong to.
    - `class` string — (Optional) The class of the Resource in the Deployment Set. Can not be empty, if is not defined, set to `default`.
    - `env_id` string — (Optional) The ID of the Environment that the Resources should belong to. If `env_type` is also set, it must match the Type of the Environment for the Criteria to match.
    - `env_type` string — (Optional) The Type of the Environment that the Resources should belong to. If `env_id` is also set, it must have an Environment Type that matches this parameter for the Criteria to match.
    - `res_id` string — (Optional) The ID of the Resource in the Deployment Set. The ID is normally a `.` separated path to the definition in the set, e.g. `modules.my-module.externals.my-database`.
  - `driver_account` string — (Optional) Security account required by the driver.
  - `driver_inputs` ValuesSecretsRefsRequest — ValuesSecretsRefs stores data that should be passed around split by sensitivity.
    - `secret_refs` object — Secrets section of the data set. They can hold sensitive information that will be stored in the primary organization secret store and replaced with the secret store paths when sent outside, or secret references stored in a defined secret store. Can't be used together with `secrets`. They can hold a nested structure but leaf objects need to be of type SecretReference, where: - `store` is a Secret Store id. It can't be `humanitec`. It's mandatory if `ref` is defined and can't be used in request payloads if `value` is defined. - `ref` is the secret key in the format of the target store. It can't be used in request payloads if `value` is defined. - `version` is the version of the secret as defined in the target store. It can be defined only if `ref` is defined. - `value` is the value to store in the organizations primary secret store. It can't be used in request payloads if `ref` is defined.
    - `secrets` object — Secrets section of the data set. Sensitive information is stored in the primary organization secret store and replaced with the secret store paths when sent outside. Can't be used together with `secret_refs`.
    - `values` object — Values section of the data set. Passed around as-is.
  - `driver_type` string, required — The driver to be used to create the resource.
  - `id` string, required — The Resource Definition ID.
  - `in_place_driver_change` boolean — (Optional) If true, the Operator will not delete resources provisioned by the previous driver when driver_type changes on a later update; the new driver takes over the existing infrastructure in place. Applies to the Operator provisioning path only.
  - `name` string, required — The display name.
  - `provision` object — (Optional) A map where the keys are resType#resId (if resId is omitted, the same id of the current resource definition is used) of the resources that should be provisioned when the current resource is provisioned. This also specifies if the resources have a dependency on the current resource.
  - `type` string, required — The Resource Type.

## Response `200`

The newly created Resources Definition details.

- ResourceDefinitionResponse — A Resource Definitions describes how and when a resource should be provisioned. It links a driver (the how) along with a Matching Criteria (the when) to a Resource Type. This allows Humanitec to invoke a particular driver for the required Resource Type in the context of a particular Application and Environment. The schema for the `driver_inputs` is defined by the `input_schema` property on the DriverDefinition identified by the `driver_type` property.
  - `created_at` string, date-time, required — The timestamp of when this record has been created.
  - `created_by` string, required — The user who created this record.
  - `updated_at` string, date-time — The timestamp of when this record has been updated.
  - `updated_by` string — The user who updated this record.
  - `criteria` MatchingCriteriaResponse[] — (Optional) The criteria to use when looking for a Resource Definition during the deployment.
    - `app_id` string — (Optional) The ID of the Application that the Resources should belong to.
    - `class` string, required — (Optional) The class of the Resource in the Deployment Set. Can not be empty, if is not defined, set to `default`.
    - `env_id` string — (Optional) The ID of the Environment that the Resources should belong to. If `env_type` is also set, it must match the Type of the Environment for the Criteria to match.
    - `env_type` string — (Optional) The Type of the Environment that the Resources should belong to. If `env_id` is also set, it must have an Environment Type that matches this parameter for the Criteria to match.
    - `id` string, required — Matching Criteria ID
    - `res_id` string — (Optional) The ID of the Resource in the Deployment Set. The ID is normally a `.` separated path to the definition in the set, e.g. `modules.my-module.externals.my-database`.
  - `driver_account` string — (Optional) Security account required by the driver.
  - `driver_inputs` ValuesSecretsRefsResponse — ValuesSecretsRefs stores data that should be passed around split by sensitivity.
    - `secret_refs` object — Secrets section of the data set. They can hold sensitive information that will be stored in the primary organization secret store and replaced with the secret store paths when sent outside, or secret references stored in a defined secret store. Can't be used together with `secrets`. They can hold a nested structure but leaf objects need to be of type SecretReference, where: - `store` is a Secret Store id. It can't be `humanitec`. It's mandatory if `ref` is defined and can't be used in request payloads if `value` is defined. - `ref` is the secret key in the format of the target store. It can't be used in request payloads if `value` is defined. - `version` is the version of the secret as defined in the target store. It can be defined only if `ref` is defined. - `value` is the value to store in the organizations primary secret store. It can't be used in request payloads if `ref` is defined.
    - `secrets` object — Secrets section of the data set. Sensitive information is stored in the primary organization secret store and replaced with the secret store paths when sent outside. Can't be used together with `secret_refs`.
    - `values` object — Values section of the data set. Passed around as-is.
  - `driver_type` string, required — The driver to be used to create the resource.
  - `id` string, required — The Resource Definition ID.
  - `active_version_id` string, required — The active Resource Definition Version ID.
  - `in_place_driver_change` boolean, required — If true, the Operator will not delete resources provisioned by the previous driver when driver_type changes on a later update; the new driver takes over the existing infrastructure in place. Applies to the Operator provisioning path only.
  - `is_default` boolean, required — Indicates this definition is a built-in one (provided by Humanitec).
  - `is_deleted` boolean, required — Indicates if this record has been marked for deletion. The Resource Definition that has been marked for deletion cannot be used to provision new resources.
  - `name` string, required — The display name.
  - `org_id` string, required — The Organization ID.
  - `provision` object — (Optional) A map where the keys are resType#resId (if resId is omitted, the same id of the current resource definition is used) of the resources that should be provisioned when the current resource is provisioned. This also specifies if the resources have a dependency on the current resource.
  - `type` string, required — The Resource Type.

## Other responses

- `400` — One or more request parameters is missing or invalid.
- `409` — A Resources Definition already exists.
- `500` — Internal application error.

---

[API](https://skmtc.net/humanitec/apis/humanitec-api.md) · [All operations](https://skmtc.net/humanitec/apis/humanitec-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/humanitec/humanitec-api/revisions/e21ad140ec3c/schema)
