{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mint-gg/json-schema/mint-gg-operation-schema.json",
  "title": "Operation",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/mint-gg-api-openapi.json#/components/schemas/Operation",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "object",
    "id",
    "type",
    "generationMode",
    "status",
    "resource",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "object": {
      "type": "string",
      "const": "operation",
      "description": "Stable object discriminator for an asynchronous operation."
    },
    "id": {
      "type": "string",
      "description": "Mint operation ID used for polling and lifecycle calls."
    },
    "type": {
      "type": "string",
      "enum": [
        "world_generation",
        "model_generation",
        "asset_pack_generation",
        "material_generation",
        "material_pack_generation",
        "image_generation",
        "image_edit",
        "audio_generation",
        "video_generation",
        "reference_image_upload",
        "generation_retry",
        "generation_transition",
        "model_optimization",
        "model_retopology",
        "model_animation",
        "asset_pack_regeneration",
        "model_conversion",
        "modeler_generation",
        "modeler_revision"
      ],
      "description": "The work this operation performs."
    },
    "modeler": {
      "type": "object",
      "description": "Modeling stage, usage settlement state, parent model and delivered artifacts for Modeler operations.",
      "properties": {
        "pricing": {
          "type": "object",
          "description": "Credit rates fixed when the operation starts. The charge for actual usage is rounded up once to whole Credits and never exceeds the operation's Credit cap.",
          "properties": {
            "inputPerMillion": {
              "type": "number",
              "minimum": 0
            },
            "cachedInputPerMillion": {
              "type": "number",
              "minimum": 0
            },
            "cacheWritePerMillion": {
              "type": "number",
              "minimum": 0,
              "description": "Separately priced usage, when the operation has it."
            },
            "cacheWrite1hPerMillion": {
              "type": "number",
              "minimum": 0,
              "description": "Separately priced usage with longer retention, when the operation has it."
            },
            "outputPerMillion": {
              "type": "number",
              "minimum": 0
            },
            "reviewInputPerMillion": {
              "type": "number",
              "minimum": 0,
              "description": "Usage of the result review, when the operation prices it separately."
            },
            "reviewCachedInputPerMillion": {
              "type": "number",
              "minimum": 0,
              "description": "Reused usage of the result review, when priced separately."
            },
            "reviewOutputPerMillion": {
              "type": "number",
              "minimum": 0,
              "description": "Output usage of the result review, when priced separately."
            },
            "cpuPerCoreSecond": {
              "type": "number",
              "minimum": 0
            },
            "memoryPerGiBSecond": {
              "type": "number",
              "minimum": 0
            },
            "gpuPerSecond": {
              "type": "number",
              "minimum": 0
            }
          },
          "required": [
            "inputPerMillion",
            "cachedInputPerMillion",
            "outputPerMillion",
            "cpuPerCoreSecond",
            "memoryPerGiBSecond",
            "gpuPerSecond"
          ]
        },
        "maxCredits": {
          "type": "integer",
          "minimum": 1,
          "description": "The explicit Credit cap selected for this operation."
        },
        "stage": {
          "type": "string",
          "enum": [
            "queued",
            "starting",
            "modeling",
            "validating",
            "publishing",
            "succeeded",
            "failed",
            "canceled"
          ]
        },
        "billingState": {
          "type": "string",
          "enum": [
            "pending",
            "settled"
          ]
        },
        "parentModelId": {
          "type": "string"
        },
        "artifacts": {
          "type": "object",
          "properties": {
            "glb": {
              "type": "string",
              "format": "uri"
            },
            "preview": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "required": [
        "stage",
        "billingState"
      ]
    },
    "generationMode": {
      "type": "string",
      "enum": [
        "auto",
        "review"
      ],
      "description": "Generation workflow mode. auto continues to the asset; review pauses at preview_ready. See [Preview-based generation](https://docs.mint.gg/developers/api-overview#preview-based-generation)."
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "preview_ready",
        "billing_required",
        "succeeded",
        "partially_succeeded",
        "failed",
        "canceled"
      ],
      "description": "Current operation lifecycle status."
    },
    "prompt": {
      "type": "string",
      "description": "Original developer-visible prompt or revision feedback, when this operation has one."
    },
    "generationPreset": {
      "type": "string",
      "enum": [
        "fast",
        "standard",
        "production"
      ],
      "description": "Mint generation tier selected for this operation, when applicable."
    },
    "optimizationLevel": {
      "type": "string",
      "enum": [
        "light",
        "moderate",
        "aggressive"
      ],
      "description": "Optimization intensity for model_optimization operations."
    },
    "resource": {
      "description": "The Mint asset created or changed by this operation, or null before an asset exists.",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "world",
                "model",
                "asset_pack",
                "material",
                "material_pack",
                "image",
                "audio",
                "video",
                "reference_image",
                "animation"
              ],
              "description": "Mint resource type."
            },
            "id": {
              "type": "string",
              "description": "Mint resource ID."
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "assets": {
      "$ref": "#/$defs/GenerationAssets",
      "description": "Generation asset URLs when available."
    },
    "billing": {
      "type": "object",
      "additionalProperties": false,
      "description": "The billing action required before this operation can continue.",
      "required": [
        "reason",
        "resource",
        "stage",
        "requiredCredits",
        "actionUrl"
      ],
      "properties": {
        "reason": {
          "type": "string",
          "enum": [
            "subscription_required",
            "past_due",
            "quota_exhausted_upgrade_available",
            "quota_exhausted_top_tier",
            "insufficient_credits",
            "insufficient_completion_credits"
          ]
        },
        "resource": {
          "type": "string",
          "enum": [
            "preview",
            "world",
            "model",
            "asset_pack",
            "material",
            "material_pack",
            "image",
            "audio",
            "video"
          ]
        },
        "stage": {
          "type": "string",
          "enum": [
            "preview",
            "final"
          ]
        },
        "requiredCredits": {
          "type": "number",
          "minimum": 0
        },
        "availableCredits": {
          "type": "number",
          "minimum": 0
        },
        "committedCredits": {
          "type": "number",
          "minimum": 0
        },
        "stageCredits": {
          "type": "number",
          "minimum": 0
        },
        "completionCredits": {
          "type": "number",
          "minimum": 0
        },
        "ctaKind": {
          "type": "string",
          "enum": [
            "view_plans",
            "upgrade_plan",
            "buy_top_up_credits"
          ]
        },
        "actionUrl": {
          "type": "string",
          "format": "uri",
          "description": "Platform billing URL where the developer can add Credits or subscribe."
        }
      }
    },
    "credits": {
      "type": "object",
      "additionalProperties": false,
      "description": "Credit estimate, active reservation, finalized charge, and post-reservation balance for this operation.",
      "required": [
        "estimated",
        "reserved",
        "finalized",
        "availableAfterReservation"
      ],
      "properties": {
        "estimated": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Current best estimate for all requested stages of this operation."
        },
        "reserved": {
          "type": "number",
          "minimum": 0,
          "description": "Credits currently reserved for unfinished work."
        },
        "finalized": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Credits finalized for completed provider work, or null while Modeler usage is pending verification."
        },
        "availableAfterReservation": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Account Credits remaining after the latest reservation or settlement update."
        }
      }
    },
    "conversion": {
      "description": "Model conversion result when this is a model_conversion operation.",
      "$ref": "#/$defs/OperationConversion"
    },
    "error": {
      "type": "object",
      "additionalProperties": false,
      "description": "Terminal failure details when the operation failed.",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable machine-readable failure code."
        },
        "message": {
          "type": "string",
          "description": "Developer-readable failure explanation."
        }
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation was created."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation last changed."
    },
    "completedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation completed."
    },
    "canceledAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the operation was canceled."
    }
  },
  "$defs": {
    "ConvertedModelArtifact": {
      "type": "object",
      "description": "One downloadable converted model artifact.",
      "required": [
        "format",
        "url",
        "filename",
        "contentType",
        "extension",
        "byteSize",
        "packaging",
        "artifactVersion",
        "primaryPath"
      ],
      "properties": {
        "format": {
          "enum": [
            "glb",
            "obj",
            "stl",
            "usdz",
            "fbx"
          ],
          "description": "Requested model format."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Download URL for this artifact."
        },
        "filename": {
          "type": "string",
          "description": "Suggested download filename."
        },
        "contentType": {
          "type": "string",
          "description": "Artifact MIME type."
        },
        "extension": {
          "type": "string",
          "description": "Filename extension without a leading dot."
        },
        "byteSize": {
          "type": "integer",
          "minimum": 0,
          "description": "Artifact size in bytes."
        },
        "packaging": {
          "enum": [
            "single_file",
            "zip"
          ],
          "description": "Whether the URL downloads one file or a ZIP package."
        },
        "artifactVersion": {
          "type": "integer",
          "minimum": 1,
          "description": "Version of Mint's artifact packaging contract."
        },
        "primaryPath": {
          "type": "string",
          "description": "Primary model path inside the download or ZIP package."
        }
      }
    },
    "ConvertedModelArtifacts": {
      "type": "object",
      "description": "Converted artifact metadata keyed by file format.",
      "properties": {
        "glb": {
          "$ref": "#/$defs/ConvertedModelArtifact",
          "description": "GLB artifact metadata when requested."
        },
        "obj": {
          "$ref": "#/$defs/ConvertedModelArtifact",
          "description": "OBJ artifact metadata when requested."
        },
        "stl": {
          "$ref": "#/$defs/ConvertedModelArtifact",
          "description": "STL artifact metadata when requested."
        },
        "usdz": {
          "$ref": "#/$defs/ConvertedModelArtifact",
          "description": "USDZ artifact metadata when requested."
        },
        "fbx": {
          "$ref": "#/$defs/ConvertedModelArtifact",
          "description": "FBX artifact metadata when requested."
        }
      }
    },
    "ConvertedModelAssets": {
      "type": "object",
      "description": "Download URLs produced by a model conversion.",
      "properties": {
        "glbUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Converted GLB URL when GLB conversion output is available."
        },
        "objUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Converted OBJ download URL when requested and available."
        },
        "stlUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Converted STL download URL when requested and available."
        },
        "usdzUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Converted USDZ download URL when requested and available."
        },
        "fbxUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Converted FBX download URL when requested and available."
        },
        "artifacts": {
          "description": "Detailed metadata for each converted artifact.",
          "oneOf": [
            {
              "$ref": "#/$defs/ConvertedModelArtifacts"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "GenerationAssets": {
      "oneOf": [
        {
          "$ref": "#/$defs/WorldAssets"
        },
        {
          "$ref": "#/$defs/ModelAssets"
        }
      ]
    },
    "GlbBounds": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "min",
        "max",
        "size",
        "center"
      ],
      "properties": {
        "min": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "max": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "size": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "center": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        }
      }
    },
    "ModelAssets": {
      "type": "object",
      "description": "Downloadable files and previews for a 3D Model.",
      "required": [
        "fbxUrl",
        "glbUrl",
        "glbSizeBytes",
        "objUrl",
        "optimizedGlbUrl",
        "optimizedGlbSizeBytes",
        "previewImageUrl",
        "stlUrl",
        "thumbnailUrl",
        "usdzUrl",
        "bounds"
      ],
      "properties": {
        "fbxUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "FBX download URL, when available."
        },
        "glbUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Canonical GLB URL for the generated model. For new generations this is Y-up and +Z-forward; it may be a Mint-normalized CDN copy when provider output required orientation correction."
        },
        "glbSizeBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "GLB size in bytes, when known."
        },
        "objUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "OBJ download URL, when available."
        },
        "optimizedGlbUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Optimized GLB download URL, when available."
        },
        "optimizedGlbSizeBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "Optimized GLB size in bytes, when known."
        },
        "previewImageUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "3D Model Preview image URL, when available."
        },
        "stlUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "STL download URL, when available."
        },
        "thumbnailUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "3D Model thumbnail URL, when available."
        },
        "usdzUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "USDZ download URL, when available."
        },
        "bounds": {
          "description": "World-space GLB bounds in meters, or null for legacy models that have not been measured.",
          "oneOf": [
            {
              "$ref": "#/$defs/GlbBounds"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "OperationConversion": {
      "type": "object",
      "description": "Conversion job and its downloadable outputs.",
      "required": [
        "id",
        "assets"
      ],
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Internal conversion result ID, or null until conversion begins."
        },
        "assets": {
          "description": "Converted model URLs and artifact metadata, or null until available.",
          "oneOf": [
            {
              "$ref": "#/$defs/ConvertedModelAssets"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "WorldAssets": {
      "type": "object",
      "description": "Downloadable files and previews for a World.",
      "required": [
        "caption",
        "colliderMeshUrl",
        "panoUrl",
        "previewImageUrl",
        "radUrl",
        "spzUrls",
        "thumbnailUrl"
      ],
      "properties": {
        "caption": {
          "type": [
            "string",
            "null"
          ],
          "description": "Generated World caption, when available."
        },
        "colliderMeshUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Collider mesh download URL, when available."
        },
        "panoUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Panorama image URL, when available."
        },
        "previewImageUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "World Preview image URL, when available."
        },
        "radUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "RAD splat download URL, when available."
        },
        "spzUrls": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string",
            "format": "uri"
          },
          "description": "SPZ splat URLs keyed by quality or variant, when available."
        },
        "thumbnailUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "World thumbnail URL, when available."
        }
      }
    }
  }
}