# Create a Dapr component

`POST /apis/dapr.diagrid.io/v1beta1/projects/{ProjectId}/components`

Create a Dapr component in a project.

## Request

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `ProjectId` | string | Yes | Unique identifier of the project. |

### Request body

The Dapr component to create.

`application/json`

- `apiVersion` (string)
- `kind` (string)
- `metadata` (object)
  - `name` (string)
  - `uid` (string)
  - `resourceVersion` (integer)
  - `createdAt` (string)
  - `updatedAt` (string)
  - `deletedAt` (string)
  - `labels` (object<string, string>)
  - `annotations` (object)
- `spec` (object) — DaprComponentComponentSpec is the Dapr component specification: its type, version and metadata.
  - `type` (string)
  - `version` (string)
  - `ignoreErrors` (boolean)
  - `metadata` (object[]) — Metadata is omitted unless the caller has the componentMetadata.get permission.
    - `name` (string)
    - `value`
      - Any of:
        - **string**
        - **integer**
        - **number**
        - **boolean**
    - `secretKeyRef` (object) — SecretKeyRef is a reference to a secret holding the value for the name/value item.
      - `name` (string) — Secret name.
      - `key` (string) — Field in the secret.
  - `initTimeout` (string)
- `auth` (object) — Auth represents authentication details for the component.
  - `secretStore` (string)
- `scopes` (string[])
- `status` (object) — ConnectionStatus represents the status of a connection.
  - `status` (string) — Status is the current processing status of the resource.
  - `updatedAt` (string) — UpdatedAt is the time of the last status update.
  - `messages` (object[]) — Messages contains any status messages, such as error details.
    - `message` (string)
  - `instances` (object[]) — Instances includes the status for each instance of the resource.
    - `cluster` (string) — Cluster is the name of the cluster hosting this instance.
    - `region` (string) — Region is the region where the instance is located (e.g. "us-east-1").
    - `placementId` (string) — PlacementID is the project placement this instance belongs to (e.g. "1").
    - `status` (string) — Status is the current processing status of the resource.
    - `updatedAt` (string) — UpdatedAt is the time of the last status update.
    - `messages` (object[]) — Messages contains any status messages, such as error details.
      - `message` (string)
  - `appIdStatus` (object[]) — AppIDStatus is the per-App ID status of the component.
    - `cluster` (string) — Cluster is the name of the cluster hosting this instance.
    - `region` (string)
    - `placementId` (string)
    - `appId` (string)
    - `status` (string) — Status is the current processing status of the resource.
    - `updatedAt` (string) — UpdatedAt is the time of the last status update.
    - `messages` (object[]) — Messages contains any status messages, such as error details.
      - `message` (string)
  - `resiliencyStatus` (object)
    - `inbound` (object)
      - `retryPolicyName` (string)
      - `timeoutPolicyName` (string)
      - `circuitBreakerPolicyName` (string)
    - `outbound` (object)
      - `retryPolicyName` (string)
      - `timeoutPolicyName` (string)
      - `circuitBreakerPolicyName` (string)
  - `resiliency` (object)
    - `apiVersion` (string) — Required.
    - `kind` (string) — Required.
    - `metadata` (object)
      - `name` (string)
    - `spec` (object)
      - `projectId` (string) — Required. Immutable.
      - `resiliencySpec` (object) — Required. ResiliencySpec is the Dapr resiliency specification (policies and targets), based on the upstream Dapr Resiliency API. Fields present upstream but not listed here are not supported in Catalyst.
        - `policies` (object)
          - `timeouts` (object<string, string>)
          - `retries` (object<string, object>)
            - `policy` (string)
            - `duration` (string)
            - `maxInterval` (string)
            - `maxRetries` (integer)
            - `matching` (object) — RetryMatching specifies which status codes should trigger a retry. When set, only matching errors are retried; unmatched errors (e.g. 403) fail immediately instead of being retried into a timeout.
              - `httpStatusCodes` (string)
              - `gRPCStatusCodes` (string)
          - `circuitBreakers` (object<string, object>)
            - `maxRequests` (integer)
            - `interval` (string)
            - `timeout` (string)
            - `trip` (string)
        - `targets` (object)
          - `apps` (object<string, object>)
            - `timeout` (string)
            - `retry` (string)
            - `circuitBreaker` (string)
            - `circuitBreakerCacheSize` (integer)
          - `components` (object<string, object>)
            - `inbound` (object)
              - `timeout` (string)
              - `retry` (string)
              - `circuitBreaker` (string)
            - `outbound` (object)
              - `timeout` (string)
              - `retry` (string)
              - `circuitBreaker` (string)
      - `scopes` (string[])
  - `isActive` (boolean)

Example:

```json
{
  "apiVersion": "dapr.io/v1alpha1",
  "kind": "Component",
  "metadata": {
    "name": "statestore"
  },
  "spec": {
    "type": "state.redis",
    "version": "v1",
    "metadata": [
      {
        "name": "redisHost",
        "value": "redis:6379"
      },
      {
        "name": "redisPassword",
        "secretKeyRef": {
          "name": "redis",
          "key": "password"
        }
      }
    ]
  },
  "scopes": [
    "order-api"
  ]
}
```

`application/vnd.api+json`

JSONAPI.org specification component response wrapper for UI.

- `data` (object) — Required.
  - `type` (string) — Type of the resource object.
  - `id` (string) — Unique identifier of the resource object.
  - `attributes` (object)
    - `apiVersion` (string)
    - `kind` (string)
    - `metadata` (object)
      - `name` (string)
      - `uid` (string)
      - `resourceVersion` (integer)
      - `createdAt` (string)
      - `updatedAt` (string)
      - `deletedAt` (string)
      - `labels` (object<string, string>)
      - `annotations` (object)
    - `spec` (object) — DaprComponentComponentSpec is the Dapr component specification: its type, version and metadata.
      - `type` (string)
      - `version` (string)
      - `ignoreErrors` (boolean)
      - `metadata` (object[]) — Metadata is omitted unless the caller has the componentMetadata.get permission.
        - `name` (string)
        - `value`
          - Any of:
            - **string**
            - **integer**
            - **number**
            - **boolean**
        - `secretKeyRef` (object) — SecretKeyRef is a reference to a secret holding the value for the name/value item.
          - `name` (string) — Secret name.
          - `key` (string) — Field in the secret.
      - `initTimeout` (string)
    - `auth` (object) — Auth represents authentication details for the component.
      - `secretStore` (string)
    - `scopes` (string[])
    - `status` (object) — ConnectionStatus represents the status of a connection.
      - `status` (string) — Status is the current processing status of the resource.
      - `updatedAt` (string) — UpdatedAt is the time of the last status update.
      - `messages` (object[]) — Messages contains any status messages, such as error details.
        - `message` (string)
      - `instances` (object[]) — Instances includes the status for each instance of the resource.
        - `cluster` (string) — Cluster is the name of the cluster hosting this instance.
        - `region` (string) — Region is the region where the instance is located (e.g. "us-east-1").
        - `placementId` (string) — PlacementID is the project placement this instance belongs to (e.g. "1").
        - `status` (string) — Status is the current processing status of the resource.
        - `updatedAt` (string) — UpdatedAt is the time of the last status update.
        - `messages` (object[]) — Messages contains any status messages, such as error details.
          - `message` (string)
      - `appIdStatus` (object[]) — AppIDStatus is the per-App ID status of the component.
        - `cluster` (string) — Cluster is the name of the cluster hosting this instance.
        - `region` (string)
        - `placementId` (string)
        - `appId` (string)
        - `status` (string) — Status is the current processing status of the resource.
        - `updatedAt` (string) — UpdatedAt is the time of the last status update.
        - `messages` (object[]) — Messages contains any status messages, such as error details.
          - `message` (string)
      - `resiliencyStatus` (object)
        - `inbound` (object)
          - `retryPolicyName` (string)
          - `timeoutPolicyName` (string)
          - `circuitBreakerPolicyName` (string)
        - `outbound` (object)
          - `retryPolicyName` (string)
          - `timeoutPolicyName` (string)
          - `circuitBreakerPolicyName` (string)
      - `resiliency` (object)
        - `apiVersion` (string) — Required.
        - `kind` (string) — Required.
        - `metadata` (object)
          - `name` (string)
        - `spec` (object)
          - `projectId` (string) — Required. Immutable.
          - `resiliencySpec` (object) — Required. ResiliencySpec is the Dapr resiliency specification (policies and targets), based on the upstream Dapr Resiliency API. Fields present upstream but not listed here are not supported in Catalyst.
            - `policies` (object)
              - `timeouts` (object<string, string>)
              - `retries` (object<string, object>)
                - *(nested fields omitted at this depth)*
              - `circuitBreakers` (object<string, object>)
                - *(nested fields omitted at this depth)*
            - `targets` (object)
              - `apps` (object<string, object>)
                - *(nested fields omitted at this depth)*
              - `components` (object<string, object>)
                - *(nested fields omitted at this depth)*
          - `scopes` (string[])
      - `isActive` (boolean)
  - `relationships` (object<string, object>) — Members of the relationships object represent references from the resource object in which it's defined to other resource objects.
    - Any of:
      - **option 1**
      - **option 2**
      - **option 3**
  - `links` (object<string, object>) — Link members related to the primary data.
    - One of:
      - **string (uri-reference)** — A string containing the link's URL.
      - **object**
        - `href` (string (uri-reference)) — Required. A string containing the link's URL.
        - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
  - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

## Responses

### 202 — Accepted for asynchronous processing.

### 403 — You are not authorized to perform this action.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### 404 — The Dapr component was not found.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### 409 — The request conflicts with the current state of the Dapr component.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### default — Unexpected error.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
