> ## Documentation Index
> Fetch the complete documentation index at: https://docs.korve.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply

> Apply a manifest: create and update declared resources. Never deletes; orphans are reported.



## OpenAPI

````yaml /openapi.json post /v1/orgs/{orgId}/manifest/apply
openapi: 3.1.0
info:
  title: Korve API
  version: 0.1.0
  description: >-
    Typed control plane for deploying applications and explicitly provisioning
    their managed infrastructure.
servers:
  - url: https://api.korve.dev
security: []
paths:
  /v1/orgs/{orgId}/manifest/apply:
    post:
      tags:
        - manifest
      summary: Apply
      description: >-
        Apply a manifest: create and update declared resources. Never deletes;
        orphans are reported.
      operationId: manifest.apply
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
          description: The organization's id (UUID) or slug — either form is accepted.
      requestBody:
        required: true
        x-korve-max-bytes: 1048576
        content:
          application/json:
            schema:
              type: object
              description: >-
                Korve manifest (infrastructure as code): the desired state of an
                organization's projects, environment, and platform resources.
              properties:
                version:
                  type: integer
                  enum:
                    - 1
                organization:
                  type: string
                  description: Organization slug the manifest targets.
                projects:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      slug:
                        type: string
                        pattern: ^[a-z][a-z0-9-]{1,61}$
                      runtimeClass:
                        type: string
                        enum:
                          - scale-to-zero
                          - always-on
                      region:
                        type: string
                        description: >-
                          Compute region for an always-on project. Omit for the
                          global scale-to-zero runtime.
                      git:
                        type: object
                        properties:
                          repo:
                            type: string
                            pattern: ^[\w.-]+/[\w.-]+$
                          ref:
                            type: string
                            minLength: 1
                            maxLength: 255
                        required:
                          - repo
                      env:
                        type: object
                        additionalProperties:
                          type: string
                        description: >-
                          The production environment's variables. Masked values
                          ("********") are ignored on apply.
                      environments:
                        type: object
                        description: >-
                          Custom environments by slug. "production" and
                          "preview" are implicit and never declared here.
                        additionalProperties:
                          type: object
                          properties:
                            name:
                              type: string
                              description: Display name — unmanaged when omitted.
                            env:
                              type: object
                              additionalProperties:
                                type: string
                              description: Masked values ("********") are ignored on apply.
                      domains:
                        type: array
                        items:
                          type: string
                      storage:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                            region:
                              type: string
                              description: >-
                                Storage area for a new bucket; immutable after
                                creation.
                          required:
                            - name
                      queues:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              pattern: ^[a-z][a-z0-9-]{1,61}$
                            environment:
                              type: string
                              pattern: ^[a-z][a-z0-9-]{0,38}$
                            retentionSeconds:
                              type: integer
                            deliveryDelaySeconds:
                              type: integer
                            deadLetterQueue:
                              type:
                                - string
                                - 'null'
                            paused:
                              type: boolean
                            consumer:
                              type: object
                              properties:
                                path:
                                  type: string
                                  pattern: ^/(?!/)
                                maxBatchSize:
                                  type: integer
                                maxBatchWaitSeconds:
                                  type: integer
                                maxRetries:
                                  type: integer
                                retryDelaySeconds:
                                  type: integer
                                maxConcurrency:
                                  type:
                                    - integer
                                    - 'null'
                              required:
                                - path
                              additionalProperties: false
                          required:
                            - name
                          additionalProperties: false
                      crons:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              pattern: ^[a-z][a-z0-9-]{1,61}$
                            environment:
                              type: string
                              pattern: ^[a-z][a-z0-9-]{0,38}$
                            schedule:
                              type: string
                            timezone:
                              type: string
                            enabled:
                              type: boolean
                            target:
                              oneOf:
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      enum:
                                        - http
                                    path:
                                      type: string
                                      pattern: ^/(?!/)
                                    method:
                                      type: string
                                      enum:
                                        - POST
                                        - PUT
                                        - PATCH
                                    body:
                                      description: >-
                                        Optional JSON request body, at most
                                        122,880 encoded bytes before the signed
                                        128,000-byte invocation envelope.
                                  required:
                                    - kind
                                    - path
                                  additionalProperties: false
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      enum:
                                        - queue
                                    queue:
                                      type: string
                                      pattern: ^[a-z][a-z0-9-]{1,61}$
                                    body:
                                      description: >-
                                        JSON queue body, at most 122,880 bytes
                                        before the 128,000-byte message
                                        envelope. Defaults to null.
                                  required:
                                    - kind
                                    - queue
                                  additionalProperties: false
                            retry:
                              type: object
                              properties:
                                maxAttempts:
                                  type: integer
                                initialDelaySeconds:
                                  type: integer
                                maxDelaySeconds:
                                  type: integer
                              additionalProperties: false
                            concurrencyPolicy:
                              type: string
                              enum:
                                - allow
                                - skip
                                - replace
                            timeoutSeconds:
                              type: integer
                              minimum: 1
                              maximum: 840
                              description: Target timeout in seconds. Defaults to 300.
                          required:
                            - name
                            - environment
                            - schedule
                            - target
                          additionalProperties: false
                      databases:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              pattern: ^[a-z][a-z0-9-]{1,61}$
                            environment:
                              type: string
                              pattern: ^[a-z][a-z0-9-]{0,38}$
                            sku:
                              type: string
                            region:
                              type: string
                            replicas:
                              type: integer
                              enum:
                                - 0
                                - 2
                            backup:
                              type: object
                              properties:
                                pitrDays:
                                  type: integer
                                dailyDays:
                                  type: integer
                                weeklyWeeks:
                                  type: integer
                                monthlyMonths:
                                  type: integer
                                destinationIds:
                                  type: array
                                  items:
                                    type: string
                                copyRegions:
                                  type: array
                                  items:
                                    type: string
                                  maxItems: 0
                                  description: >-
                                    Reserved for regional backup-copy execution;
                                    must remain empty.
                              additionalProperties: false
                          required:
                            - name
                            - sku
                            - region
                          additionalProperties: false
                      databaseBranch:
                        type: object
                        properties:
                          sourceEnvironment:
                            type: string
                            pattern: ^[a-z][a-z0-9-]{0,38}$
                          sourceDatabase:
                            type: string
                            pattern: ^[a-z][a-z0-9-]{1,61}$
                          expiresInDays:
                            type:
                              - integer
                              - 'null'
                          deleteOnPreviewClose:
                            type: boolean
                        required:
                          - sourceEnvironment
                          - sourceDatabase
                        additionalProperties: false
                      alerts:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              pattern: ^[a-z][a-z0-9-]{1,61}$
                            enabled:
                              type: boolean
                            severity:
                              type: string
                              enum:
                                - info
                                - warning
                                - critical
                            scope:
                              type: object
                              properties:
                                environment:
                                  type: string
                                  pattern: ^[a-z][a-z0-9-]{0,38}$
                                database:
                                  type:
                                    - string
                                    - 'null'
                                queue:
                                  type:
                                    - string
                                    - 'null'
                                cron:
                                  type:
                                    - string
                                    - 'null'
                              additionalProperties: false
                            condition:
                              type: object
                              properties:
                                signal:
                                  type: string
                                  enum:
                                    - database.unavailable
                                    - backup.archive_failed
                                    - storage.capacity
                                    - cpu.pressure
                                    - memory.pressure
                                    - database.pool_saturation
                                    - queue.backlog
                                    - cpu.percent
                                    - memory.used_bytes
                                    - memory.limit_bytes
                                    - disk.used_bytes
                                    - disk.limit_bytes
                                    - disk.read_iops
                                    - disk.write_iops
                                    - network.receive_bytes
                                    - network.transmit_bytes
                                    - runtime.restarts
                                    - runtime.uptime_seconds
                                    - http.requests
                                    - http.errors
                                    - database.connections
                                    - database.pool_waiting
                                    - database.queries_per_second
                                    - database.query_latency_avg_ms
                                    - database.query_latency_p50_ms
                                    - database.query_latency_p90_ms
                                    - database.query_latency_p95_ms
                                    - database.query_latency_p99_ms
                                    - queue.backlog_messages
                                    - queue.oldest_message_age_seconds
                                    - cron.failures
                                operator:
                                  type: string
                                  enum:
                                    - gt
                                    - gte
                                    - lt
                                    - lte
                                    - eq
                                threshold:
                                  type:
                                    - number
                                    - 'null'
                                durationSeconds:
                                  type: integer
                              required:
                                - signal
                                - operator
                                - threshold
                                - durationSeconds
                              additionalProperties: false
                            channels:
                              type: array
                              items:
                                oneOf:
                                  - type: object
                                    properties:
                                      kind:
                                        type: string
                                        enum:
                                          - dashboard
                                      destination:
                                        type: 'null'
                                    required:
                                      - kind
                                      - destination
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      kind:
                                        type: string
                                        enum:
                                          - email
                                      destination:
                                        type: string
                                        description: >-
                                          Valid email address or the exported
                                          preserve marker "********".
                                    required:
                                      - kind
                                      - destination
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      kind:
                                        type: string
                                        enum:
                                          - webhook
                                      destination:
                                        type: string
                                        description: >-
                                          HTTPS URL or the exported preserve
                                          marker "********".
                                    required:
                                      - kind
                                      - destination
                                    additionalProperties: false
                              minItems: 1
                              maxItems: 10
                            cooldownSeconds:
                              type: integer
                          required:
                            - name
                            - severity
                            - scope
                            - condition
                            - channels
                          additionalProperties: false
                      access:
                        type: object
                        description: >-
                          Application sharing policy. Omit to leave the live
                          policy unmanaged.
                        properties:
                          mode:
                            type: string
                            enum:
                              - public
                              - authenticated
                              - organization
                              - invite_only
                          previewMode:
                            type: string
                            enum:
                              - inherit
                              - public
                              - authenticated
                              - organization
                              - invite_only
                          environments:
                            type: object
                            description: >-
                              Explicit environment-mode overrides by environment
                              slug.
                            additionalProperties:
                              type: string
                              enum:
                                - public
                                - authenticated
                                - organization
                                - invite_only
                        required:
                          - mode
                        additionalProperties: false
                    required:
                      - name
                      - slug
                      - runtimeClass
                    additionalProperties: false
              required:
                - version
                - organization
              additionalProperties: false
      responses:
        '200':
          description: Apply results with the executed actions and the resulting plan.
          content:
            application/json:
              schema:
                type: object
                properties:
                  applied:
                    type: array
                    items:
                      type: object
                      properties:
                        action:
                          type: string
                        project:
                          type: string
                        ok:
                          type: boolean
                        error:
                          type: string
                      required:
                        - action
                        - project
                        - ok
                      additionalProperties: false
                  plan:
                    type: object
                    properties:
                      organization:
                        type: string
                      actions:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - create
                                - update
                                - noop
                                - orphaned
                                - deferred
                                - invalid
                            resource:
                              type: string
                              enum:
                                - project
                                - git
                                - env
                                - environment
                                - domain
                                - storage
                                - queue
                                - cron
                                - database
                                - cache
                                - backup
                                - preview-database
                                - alert
                                - access
                            project:
                              type: string
                            detail:
                              type: string
                          required:
                            - type
                            - resource
                            - project
                            - detail
                      summary:
                        type: object
                        additionalProperties:
                          type: integer
                    required:
                      - organization
                      - actions
                      - summary
                required:
                  - applied
                  - plan
                additionalProperties: false
        '422':
          description: Manifest failed validation or contains invalid changes.
      security:
        - apiKey: []
        - session: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: korve_api_key
    session:
      type: apiKey
      in: cookie
      name: korve.session_token

````