Skip to content
Get started

Create or update snapshot schedule for an instance

client.Instances.SnapshotSchedule.Update(ctx, id, body) (*SnapshotSchedule, error)
put/instances/{id}/snapshot-schedule

Scheduled runs automatically choose snapshot behavior from current instance state:

  • Running or Standby source: create a Standby snapshot.
  • Stopped source: create a Stopped snapshot. For running instances, this includes a brief pause/resume cycle during each capture. The minimum supported interval is 1m, but larger intervals are recommended for heavier or latency-sensitive workloads. Updating only retention, metadata, or name_prefix preserves the next scheduled run; changing interval establishes a new cadence.
ParametersExpand Collapse
id string
body InstanceSnapshotScheduleUpdateParams
SetSnapshotScheduleRequest param.Field[SetSnapshotScheduleRequest]
ReturnsExpand Collapse
type SnapshotSchedule struct{…}
CreatedAt Time

Schedule creation timestamp.

formatdate-time
InstanceID string

Source instance ID.

Interval string

Snapshot interval (Go duration format).

NextRunAt Time

Next scheduled run time.

formatdate-time

Automatic cleanup policy for scheduled snapshots.

MaxAge stringoptional

Delete scheduled snapshots older than this duration (Go duration format).

MaxCount int64optional

Keep at most this many scheduled snapshots for the instance (0 disables count-based cleanup).

minimum0
UpdatedAt Time

Schedule update timestamp.

formatdate-time
LastError stringoptional

Last schedule run error, if any.

LastRunAt Timeoptional

Last schedule execution time.

formatdate-time
LastSnapshotID stringoptional

Snapshot ID produced by the last successful run.

Metadata map[string, string]optional

User-defined key-value tags.

NamePrefix stringoptional

Optional prefix used for generated scheduled snapshot names.

Create or update snapshot schedule for an instance
package main

import (
  "context"
  "fmt"

  "github.com/kernel/hypeman-go"
  "github.com/kernel/hypeman-go/option"
)

func main() {
  client := hypeman.NewClient(
    option.WithAPIKey("My API Key"),
  )
  snapshotSchedule, err := client.Instances.SnapshotSchedule.Update(
    context.TODO(),
    "id",
    hypeman.InstanceSnapshotScheduleUpdateParams{
      SetSnapshotScheduleRequest: hypeman.SetSnapshotScheduleRequestParam{
        Interval: "24h",
        Retention: hypeman.SnapshotScheduleRetentionParam{

        },
      },
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", snapshotSchedule.InstanceID)
}
{
  "created_at": "2026-03-09T01:00:00Z",
  "instance_id": "qilviffnqzck2jrim1x6s2b1",
  "interval": "24h",
  "next_run_at": "2026-03-10T02:00:00Z",
  "retention": {
    "max_age": "168h",
    "max_count": 7
  },
  "updated_at": "2026-03-09T01:30:00Z",
  "last_error": "invalid state transition: stopped snapshot requires source in Stopped, got Running",
  "last_run_at": "2026-03-09T02:00:00Z",
  "last_snapshot_id": "q7z1w7l2af4l8y7q1h7g2m3s",
  "metadata": {
    "team": "backend",
    "env": "staging"
  },
  "name_prefix": "nightly"
}
Returns Examples
{
  "created_at": "2026-03-09T01:00:00Z",
  "instance_id": "qilviffnqzck2jrim1x6s2b1",
  "interval": "24h",
  "next_run_at": "2026-03-10T02:00:00Z",
  "retention": {
    "max_age": "168h",
    "max_count": 7
  },
  "updated_at": "2026-03-09T01:30:00Z",
  "last_error": "invalid state transition: stopped snapshot requires source in Stopped, got Running",
  "last_run_at": "2026-03-09T02:00:00Z",
  "last_snapshot_id": "q7z1w7l2af4l8y7q1h7g2m3s",
  "metadata": {
    "team": "backend",
    "env": "staging"
  },
  "name_prefix": "nightly"
}