{
  "schemaVersion": 1,
  "operation": {
    "operationId": "applyDevelopmentProfile",
    "method": "POST",
    "path": "/api/v1/projects/{project}/targets/{target}/development-profile-application",
    "summary": "Apply an exact development profile to the local runtime",
    "description": "",
    "tags": [
      "Connections"
    ],
    "effect": "write",
    "confirmation": "conditional",
    "authorization": {
      "action": "project.settings.update",
      "mode": "privilege",
      "privilege": "RESOURCE_MANAGE",
      "resolver": "project"
    },
    "parameters": [
      {
        "name": "project",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "type": "string"
        }
      },
      {
        "name": "target",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$",
          "type": "string"
        }
      },
      {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 200,
          "minLength": 1,
          "type": "string"
        }
      }
    ],
    "requestBody": {
      "required": true,
      "description": "",
      "content": [
        {
          "contentType": "application/json",
          "schema": {
            "$ref": "#/components/schemas/DevelopmentProfileApplicationRequest"
          }
        }
      ]
    },
    "responses": [
      {
        "status": "200",
        "description": "The request has succeeded.",
        "content": [
          {
            "contentType": "application/json",
            "schema": {
              "$ref": "#/components/schemas/DevelopmentProfileApplicationResponse"
            }
          }
        ]
      },
      {
        "status": "400",
        "description": "The server could not understand the request due to invalid syntax.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "401",
        "description": "Access is unauthorized.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "403",
        "description": "Access is forbidden.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "404",
        "description": "The server cannot find the requested resource.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "409",
        "description": "The request conflicts with the current state of the server.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "412",
        "description": "Precondition failed.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "413",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "415",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "422",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "429",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "500",
        "description": "Server error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "502",
        "description": "Server error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "503",
        "description": "Service unavailable.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      }
    ]
  },
  "schemas": {
    "DevelopmentProfileApplicationMode": {
      "enum": [
        "new",
        "resume"
      ],
      "example": "new",
      "type": "string"
    },
    "DevelopmentProfileApplicationRequest": {
      "example": {
        "applicationId": "example",
        "connections": [
          {
            "authenticationMode": "none",
            "connectorKind": "example",
            "credentialReference": {
              "environment": "example",
              "projectId": "example",
              "secretKey": "example",
              "secretPath": "example"
            },
            "endpoint": {
              "database": "example",
              "host": "example",
              "objectScope": "example",
              "options": {
                "key": "example"
              },
              "port": 1,
              "sourceIdentity": "example",
              "tlsMode": "example"
            },
            "logicalConnection": "example"
          }
        ],
        "graphDigest": "example",
        "mode": "new",
        "profileDigest": "example",
        "sourceDigest": "example"
      },
      "properties": {
        "applicationId": {
          "example": "example",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$",
          "type": "string"
        },
        "connections": {
          "example": [
            {
              "authenticationMode": "none",
              "connectorKind": "example",
              "credentialReference": {
                "environment": "example",
                "projectId": "example",
                "secretKey": "example",
                "secretPath": "example"
              },
              "endpoint": {
                "database": "example",
                "host": "example",
                "objectScope": "example",
                "options": {
                  "key": "example"
                },
                "port": 1,
                "sourceIdentity": "example",
                "tlsMode": "example"
              },
              "logicalConnection": "example"
            }
          ],
          "items": {
            "$ref": "#/components/schemas/DevelopmentProfileConnectionIntent"
          },
          "type": "array"
        },
        "graphDigest": {
          "example": "example",
          "type": "string"
        },
        "mode": {
          "$ref": "#/components/schemas/DevelopmentProfileApplicationMode"
        },
        "profileDigest": {
          "example": "example",
          "type": "string"
        },
        "sourceDigest": {
          "description": "The immutable source snapshot observed when a new application begins. Ordinary source edits do not change profile identity.",
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "applicationId",
        "mode",
        "sourceDigest",
        "graphDigest",
        "profileDigest",
        "connections"
      ],
      "type": "object"
    },
    "DevelopmentProfileApplicationResponse": {
      "example": {
        "applicationId": "example",
        "appliedConnectionCount": 1,
        "graphDigest": "example",
        "incompleteConnections": [
          "example"
        ],
        "lastCompletedApplicationId": "example",
        "lastCompletedAt": "2026-01-02T15:04:05Z",
        "profileDigest": "example",
        "profileName": "example",
        "requiredConnectionCount": 1,
        "revision": 1,
        "sourceDigest": "example",
        "status": "applying",
        "updatedAt": "2026-01-02T15:04:05Z"
      },
      "properties": {
        "applicationId": {
          "example": "example",
          "type": "string"
        },
        "appliedConnectionCount": {
          "description": "Logical connections whose exact binding and protected credential evidence have been durably applied.",
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "graphDigest": {
          "example": "example",
          "type": "string"
        },
        "incompleteConnections": {
          "description": "Required logical connection IDs that are not yet durably applied. Credential references and provider versions are never returned.",
          "example": [
            "example"
          ],
          "items": {
            "maxLength": 200,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
            "type": "string"
          },
          "type": "array"
        },
        "lastCompletedApplicationId": {
          "description": "The completed application retained by this runtime. Absent while its first application is incomplete. In-place replacement is not exposed; use ownership-gated local runtime recreation.",
          "example": "example",
          "type": "string"
        },
        "lastCompletedAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        },
        "profileDigest": {
          "example": "example",
          "type": "string"
        },
        "profileName": {
          "example": "example",
          "type": "string"
        },
        "requiredConnectionCount": {
          "description": "Logical connections required by the retained profile intent. This count contains no credential material.",
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "revision": {
          "example": 1,
          "format": "int64",
          "minimum": 1,
          "type": "integer"
        },
        "sourceDigest": {
          "example": "example",
          "type": "string"
        },
        "status": {
          "$ref": "#/components/schemas/DevelopmentProfileApplicationStatus"
        },
        "updatedAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "applicationId",
        "status",
        "profileName",
        "requiredConnectionCount",
        "appliedConnectionCount",
        "incompleteConnections",
        "sourceDigest",
        "graphDigest",
        "profileDigest",
        "revision",
        "updatedAt"
      ],
      "type": "object"
    },
    "DevelopmentProfileApplicationStatus": {
      "enum": [
        "applying",
        "incomplete",
        "applied"
      ],
      "example": "applying",
      "type": "string"
    },
    "DevelopmentProfileConnectionIntent": {
      "example": {
        "authenticationMode": "none",
        "connectorKind": "example",
        "credentialReference": {
          "environment": "example",
          "projectId": "example",
          "secretKey": "example",
          "secretPath": "example"
        },
        "endpoint": {
          "database": "example",
          "host": "example",
          "objectScope": "example",
          "options": {
            "key": "example"
          },
          "port": 1,
          "sourceIdentity": "example",
          "tlsMode": "example"
        },
        "logicalConnection": "example"
      },
      "properties": {
        "authenticationMode": {
          "$ref": "#/components/schemas/TargetConnectionAuthenticationMode"
        },
        "connectorKind": {
          "example": "example",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$",
          "type": "string"
        },
        "credentialReference": {
          "$ref": "#/components/schemas/TargetConnectionCredentialReference"
        },
        "endpoint": {
          "$ref": "#/components/schemas/TargetConnectionEndpoint"
        },
        "logicalConnection": {
          "example": "example",
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "type": "string"
        }
      },
      "required": [
        "logicalConnection",
        "connectorKind",
        "authenticationMode",
        "endpoint"
      ],
      "type": "object"
    },
    "ProblemDetails": {
      "example": {
        "code": "example",
        "detail": "example",
        "errors": [
          {
            "code": "example",
            "detail": "example",
            "field": "example"
          }
        ],
        "instance": "example",
        "requestId": "example",
        "status": 1,
        "title": "example",
        "type": "example"
      },
      "properties": {
        "code": {
          "example": "example",
          "type": "string"
        },
        "detail": {
          "example": "example",
          "type": "string"
        },
        "errors": {
          "example": [
            {
              "code": "example",
              "detail": "example",
              "field": "example"
            }
          ],
          "items": {
            "$ref": "#/components/schemas/ProblemFieldError"
          },
          "type": "array"
        },
        "instance": {
          "example": "example",
          "type": "string"
        },
        "requestId": {
          "example": "example",
          "type": "string"
        },
        "status": {
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "title": {
          "example": "example",
          "type": "string"
        },
        "type": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "type",
        "title",
        "status",
        "detail",
        "instance",
        "code",
        "requestId",
        "errors"
      ],
      "type": "object"
    },
    "ProblemFieldError": {
      "example": {
        "code": "example",
        "detail": "example",
        "field": "example"
      },
      "properties": {
        "code": {
          "example": "example",
          "type": "string"
        },
        "detail": {
          "example": "example",
          "type": "string"
        },
        "field": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "field",
        "code",
        "detail"
      ],
      "type": "object"
    },
    "TargetConnectionAuthenticationMode": {
      "enum": [
        "none",
        "external_bundle",
        "workload_identity"
      ],
      "example": "none",
      "type": "string"
    },
    "TargetConnectionCredentialReference": {
      "description": "A provider-side reference only. LeapView never returns or accepts the referenced secret value.",
      "example": {
        "environment": "example",
        "projectId": "example",
        "secretKey": "example",
        "secretPath": "example"
      },
      "properties": {
        "environment": {
          "example": "example",
          "type": "string"
        },
        "projectId": {
          "example": "example",
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "type": "string"
        },
        "secretKey": {
          "example": "example",
          "type": "string"
        },
        "secretPath": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "projectId",
        "environment",
        "secretPath",
        "secretKey"
      ],
      "type": "object"
    },
    "TargetConnectionEndpoint": {
      "example": {
        "database": "example",
        "host": "example",
        "objectScope": "example",
        "options": {
          "key": "example"
        },
        "port": 1,
        "sourceIdentity": "example",
        "tlsMode": "example"
      },
      "properties": {
        "database": {
          "example": "example",
          "type": "string"
        },
        "host": {
          "example": "example",
          "type": "string"
        },
        "objectScope": {
          "example": "example",
          "type": "string"
        },
        "options": {
          "additionalProperties": {
            "type": "string"
          },
          "example": {
            "key": "example"
          },
          "type": "object"
        },
        "port": {
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "sourceIdentity": {
          "example": "example",
          "type": "string"
        },
        "tlsMode": {
          "example": "example",
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}
