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

# Create or revision-conditionally update one resident schedule

> Create requires If-None-Match: *. Update requires the exact ETag in If-Match. Identical lost-response retries are unchanged and retain the revision. A refused precondition answers 412 with the schedule's current revision (null when none exists). A definition the planner or the schedule validator refuses answers 422 with its findings; a malformed body, refused inputs or a refused workflow answer 422 with the error envelope.



## OpenAPI

````yaml /api-reference/openapi.json put /v1/schedules/{id}
openapi: 3.1.0
info:
  description: >-
    Authenticated loopback remote execution, declarative schedules, verified
    downloads of the artifacts a settled job's sealed journal records, and
    stateless source-only authoring (POST /v1/compile never runs, admits or
    writes). Schedule list/delete/trigger/backfill, /v1/arm, and POST /v1/run
    are absent.
  title: nika serve
  version: 0.124.1
servers:
  - url: http://127.0.0.1
security:
  - bearerAuth: []
paths:
  /v1/schedules/{id}:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          maxLength: 255
          minLength: 1
          type: string
    put:
      summary: Create or revision-conditionally update one resident schedule
      description: >-
        Create requires If-None-Match: *. Update requires the exact ETag in
        If-Match. Identical lost-response retries are unchanged and retain the
        revision. A refused precondition answers 412 with the schedule's current
        revision (null when none exists). A definition the planner or the
        schedule validator refuses answers 422 with its findings; a malformed
        body, refused inputs or a refused workflow answer 422 with the error
        envelope.
      parameters:
        - $ref: '#/components/parameters/IfNoneMatch'
        - $ref: '#/components/parameters/IfMatch'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchedulePut'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleApply'
          description: Applied or unchanged
          headers:
            ETag:
              schema:
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error envelope
        '412':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchedulePreconditionFailed'
          description: Precondition refused; carries the current revision
          headers:
            ETag:
              description: The current revision, when one exists
              schema:
                type: string
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error envelope
        '415':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error envelope
        '422':
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ScheduleFindings'
                  - $ref: '#/components/schemas/Error'
          description: 'Refused definition: its findings, or the error envelope'
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error envelope
        '507':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Durable schedule capacity exhausted
components:
  parameters:
    IfNoneMatch:
      in: header
      name: If-None-Match
      required: false
      schema:
        const: '*'
        type: string
    IfMatch:
      in: header
      name: If-Match
      required: false
      schema:
        maxLength: 96
        type: string
  schemas:
    SchedulePut:
      additionalProperties: false
      properties:
        active:
          type: boolean
        afterSkip:
          enum:
            - next_slot
            - on_completion
          type: string
        inputs:
          additionalProperties:
            oneOf:
              - type: string
              - type: number
              - type: boolean
          description: >-
            Per-fire inputs bound on every resident fire (#1370): one scalar per
            key the workflow declares under `inputs:`, coerced by the declared
            type exactly as the CLI `--var` edge does, then judged by the same
            literal admission validator as POST /v1/jobs. Unknown keys, values
            the declared type refuses, missing required inputs and the `@env:`
            channel are refused at PUT and again at fire.
          type: object
        jitter:
          enum:
            - hash
          type: string
        maxCostUsd:
          exclusiveMinimum: 0
          type: number
        maxLatenessSeconds:
          minimum: 0
          type: integer
        missed:
          enum:
            - catch-up
            - catch-up-once
            - skip
          type: string
        overlap:
          enum:
            - skip
            - queue
            - replace
          type: string
        pauseReason:
          maxLength: 1024
          type: string
        pauseUntil:
          format: date
          type: string
        tolerance:
          type: string
        when:
          oneOf:
            - additionalProperties: false
              properties:
                at:
                  format: date-time
                  type: string
                kind:
                  const: once
              required:
                - kind
                - at
              type: object
            - additionalProperties: false
              properties:
                expression:
                  maxLength: 4096
                  type: string
                kind:
                  const: cadence
              required:
                - kind
                - expression
              type: object
        workflow:
          maxLength: 1024
          pattern: ^[^/].*\.nika$
          type: string
      required:
        - workflow
        - when
        - maxCostUsd
        - missed
      type: object
    ScheduleApply:
      additionalProperties: false
      properties:
        applied:
          const: true
          type: boolean
        changed:
          type: boolean
        status:
          $ref: '#/components/schemas/ScheduleStatus'
      required:
        - applied
        - changed
        - status
      type: object
    Error:
      additionalProperties: false
      properties:
        error:
          additionalProperties: false
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
          type: object
      required:
        - error
      type: object
    SchedulePreconditionFailed:
      additionalProperties: false
      properties:
        error:
          additionalProperties: false
          properties:
            code:
              const: schedule_precondition_failed
              type: string
            currentRevision:
              anyOf:
                - pattern: ^sha256:[0-9a-f]{64}$
                  type: string
                - type: 'null'
            message:
              type: string
          required:
            - code
            - message
            - currentRevision
          type: object
      required:
        - error
      type: object
    ScheduleFindings:
      additionalProperties: false
      properties:
        findings:
          items:
            additionalProperties: false
            properties:
              code:
                minLength: 1
                type: string
              detail:
                type: string
            required:
              - code
              - detail
            type: object
          minItems: 1
          type: array
      required:
        - findings
      type: object
    ScheduleStatus:
      additionalProperties: true
      description: >-
        Normalized definition, origin, distinct schedule revision, active/pause
        state, due verdict, bounded next slots with shift evidence, earliest
        wake hint, and last durable decision.
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Exactly one Authorization: Bearer value from the token file'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.