{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/useorgx-com/json-schema/useorgx-com-artifact-create-request-schema.json",
  "title": "ArtifactCreateRequest",
  "description": "One of `artifact_url` or `external_url` is required.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/useorgx-com-openapi.yml#/components/schemas/ArtifactCreateRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "entity_type",
    "entity_id",
    "name",
    "artifact_type"
  ],
  "properties": {
    "artifact_id": {
      "type": "string",
      "format": "uuid",
      "description": "Optional stable artifact identity for a prepared delivery."
    },
    "expected_scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "workspace_id",
        "expected_updated_at"
      ],
      "description": "Opt-in atomic workspace and work-target timestamp assertion. Supported for project, initiative, workstream, milestone, and task targets in draft or in_review status. Requires Idempotency-Key. It does not approve or complete work.",
      "properties": {
        "workspace_id": {
          "type": "string",
          "format": "uuid"
        },
        "expected_updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "content_snapshot": {
      "$ref": "#/$defs/ArtifactContentSnapshot"
    },
    "entity_type": {
      "type": "string",
      "enum": [
        "project",
        "initiative",
        "workstream",
        "milestone",
        "task",
        "decision"
      ]
    },
    "entity_id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "artifact_type": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "artifact_url": {
      "type": "string",
      "maxLength": 2000
    },
    "external_url": {
      "type": "string",
      "maxLength": 2000
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 4000
    },
    "preview_markdown": {
      "type": "string",
      "maxLength": 25000
    },
    "initiative_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "in_review",
        "changes_requested",
        "superseded",
        "archived"
      ]
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true
    },
    "created_by_type": {
      "type": "string",
      "enum": [
        "human",
        "agent"
      ]
    },
    "created_by_id": {
      "type": "string",
      "format": "uuid"
    }
  },
  "$defs": {
    "ArtifactContentSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "semanticProfile",
        "contentBase64",
        "mediaType"
      ],
      "properties": {
        "schemaVersion": {
          "const": "1.0.0"
        },
        "semanticProfile": {
          "const": "orgx.artifact-bytes.sha256.v1"
        },
        "contentBase64": {
          "type": "string",
          "maxLength": 699052,
          "description": "Canonical base64 encoding of at most 524288 raw bytes."
        },
        "mediaType": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "declaredDigest": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$",
          "description": "Optional producer claim checked against the actual captured bytes."
        }
      }
    }
  }
}