{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/timescale/main/json-schema/timescale-fork-service-create-schema.json",
  "title": "ForkServiceCreate",
  "description": "Create a fork of an existing service. Service type, region code, and storage are always inherited from the parent service.\nHA replica count is always set to 0 for forked services.\n",
  "x-generated": "2026-10-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/timescale-services-api-openapi.yml#/components/schemas/ForkServiceCreate",
  "type": "object",
  "required": [
    "fork_strategy"
  ],
  "properties": {
    "name": {
      "type": "string",
      "description": "A human-readable name for the forked service. If not provided, will use parent service name with \"-fork\" suffix."
    },
    "cpu_millis": {
      "type": "string",
      "description": "The initial CPU allocation in milli-cores, or 'shared' for a shared-resource service. If not provided, will inherit from parent service."
    },
    "memory_gbs": {
      "type": "string",
      "description": "The initial memory allocation in gigabytes, or 'shared' for a shared-resource service. If not provided, will inherit from parent service."
    },
    "fork_strategy": {
      "$ref": "#/$defs/ForkStrategy",
      "description": "Strategy for creating the fork. This field is required."
    },
    "target_time": {
      "type": "string",
      "format": "date-time",
      "description": "Target time for point-in-time recovery. Required when fork_strategy is PITR."
    },
    "environment_tag": {
      "$ref": "#/$defs/EnvironmentTag",
      "description": "The environment tag for the forked service, 'DEV' by default.",
      "default": "DEV"
    }
  },
  "$defs": {
    "EnvironmentTag": {
      "type": "string",
      "enum": [
        "DEV",
        "PROD"
      ],
      "description": "The environment tag for the service."
    },
    "ForkStrategy": {
      "type": "string",
      "enum": [
        "LAST_SNAPSHOT",
        "NOW",
        "PITR"
      ],
      "description": "Strategy for creating the fork:\n- LAST_SNAPSHOT: Use existing snapshot for fast fork\n- NOW: Create new snapshot for up-to-date fork\n- PITR: Point-in-time recovery using target_time\n"
    }
  }
}