# Connect an app tunnel

`PUT /apis/cra.diagrid.io/v1beta1/projects/{ProjectId}/apptunnels/{ProjectSubresourceId}/connect`

Connect an app tunnel for local development.

## Request

### Path parameters

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

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `appTunnelId` | string | No | Identifier of the tunnel connection to refresh. |

### Request body

Optional app health check configuration for the tunnel connection.

`application/json`

- `appHealthCheck` (object) — Health check for the App ID application.
  - `path` (string)
  - `probe` (object) — Health check for the App ID application.
    - `enabled` (boolean) — Required. Indicates whether the probe is enabled.
    - `intervalInSec` (integer (int32)) — Nullable. Interval between probe checks in seconds.
    - `timeoutInMs` (integer (int32)) — Nullable. Timeout for each probe check in milliseconds.
    - `failureThreshold` (integer (int32)) — Nullable. Number of failures before marking as unhealthy.

`application/vnd.api+json`

- `appHealthCheck` (object) — Health check for the App ID application.
  - `path` (string)
  - `probe` (object) — Health check for the App ID application.
    - `enabled` (boolean) — Required. Indicates whether the probe is enabled.
    - `intervalInSec` (integer (int32)) — Nullable. Interval between probe checks in seconds.
    - `timeoutInMs` (integer (int32)) — Nullable. Timeout for each probe check in milliseconds.
    - `failureThreshold` (integer (int32)) — Nullable. Number of failures before marking as unhealthy.

## Responses

### 201 — The created app tunnel connection. The response includes the assigned `id` and any other server-set changes.

`application/json`

- `certBundle` (object)
  - `orgId` (string)
  - `projectId` (string)
  - `projectUId` (string)
  - `appId` (string)
  - `appUId` (string)
  - `certPEM` (string)
  - `keyPEM` (string)
  - `trustAnchors` (string)
  - `trustDomain` (string)
  - `controlplaneSentryEndpoint` (string)
  - `controlplaneTrustDomain` (string)
  - `controlplaneSentryTrustDomain` (string)
  - `controlplaneSentryNamespace` (string)
  - `regionHostTrustDomain` (string)
  - `regionHostSentryEndpoint` (string)
  - `regionHostSentryTrustDomain` (string)
  - `regionHostSentryNamespace` (string)
  - `controlplanePEMTrustEndpoint` (string)
  - `controlplanePEMTrustEndpointInsecure` (boolean)
  - `regionHostPEMTrustEndpoint` (string)
  - `regionHostPEMTrustEndpointInsecure` (boolean)
- `connection` (object) — AppTunnelConnection represents a tunnel connection.
  - `endpoint` (string) — Endpoint refers to the address that the client will reach to in order to connect to the tunnel, aka Upstream.
  - `proxy_endpoint` (string) — ProxyEndpoint is the address that the sidecar will forward the requests to from its side of the tunnel.
  - `proxy_tls` (boolean) — ProxyTLS controls the protocol to be used in Proxy side of the connection.
  - `credentials` (object) — AppTunnelCredentials represents credentials for a tunnel connection.
    - `id` (string)
    - `expiresAt` (string)
    - `token` (string)
    - `spiffeId` (string)
  - `extra_headers` (object<string, string>)

`application/vnd.api+json`

JSONAPI.org specification app tunnel connection response wrapper for UI.

- `data` (object) — Required.
  - `type` (string) — Type of the resource object.
  - `id` (string) — Unique identifier of the resource object.
  - `attributes` (object)
    - `certBundle` (object)
      - `orgId` (string)
      - `projectId` (string)
      - `projectUId` (string)
      - `appId` (string)
      - `appUId` (string)
      - `certPEM` (string)
      - `keyPEM` (string)
      - `trustAnchors` (string)
      - `trustDomain` (string)
      - `controlplaneSentryEndpoint` (string)
      - `controlplaneTrustDomain` (string)
      - `controlplaneSentryTrustDomain` (string)
      - `controlplaneSentryNamespace` (string)
      - `regionHostTrustDomain` (string)
      - `regionHostSentryEndpoint` (string)
      - `regionHostSentryTrustDomain` (string)
      - `regionHostSentryNamespace` (string)
      - `controlplanePEMTrustEndpoint` (string)
      - `controlplanePEMTrustEndpointInsecure` (boolean)
      - `regionHostPEMTrustEndpoint` (string)
      - `regionHostPEMTrustEndpointInsecure` (boolean)
    - `connection` (object) — AppTunnelConnection represents a tunnel connection.
      - `endpoint` (string) — Endpoint refers to the address that the client will reach to in order to connect to the tunnel, aka Upstream.
      - `proxy_endpoint` (string) — ProxyEndpoint is the address that the sidecar will forward the requests to from its side of the tunnel.
      - `proxy_tls` (boolean) — ProxyTLS controls the protocol to be used in Proxy side of the connection.
      - `credentials` (object) — AppTunnelCredentials represents credentials for a tunnel connection.
        - `id` (string)
        - `expiresAt` (string)
        - `token` (string)
        - `spiffeId` (string)
      - `extra_headers` (object<string, string>)
  - `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.

### 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 app tunnel connection 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.

### 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.
