{
  "openapi": "3.1.0",
  "info": {
    "title": "Creations3D REST API",
    "version": "1.0.0",
    "description": "Create 3D models from text or photos, manage your models and read account credits. Personal API keys are created on the website in Account, API keys. Generation uses account credits.",
    "contact": {
      "url": "https://creations3d.com/support"
    }
  },
  "servers": [
    {
      "url": "https://creations3d.com"
    }
  ],
  "externalDocs": {
    "url": "https://creations3d.com/docs/api"
  },
  "tags": [
    {
      "name": "Models",
      "description": "Create and manage your 3D models."
    },
    {
      "name": "Account",
      "description": "Read account credits and plan."
    }
  ],
  "security": [
    {
      "personalApiKey": []
    }
  ],
  "paths": {
    "/api/generations": {
      "get": {
        "operationId": "listModels",
        "summary": "List your models, newest first",
        "tags": [
          "Models"
        ],
        "responses": {
          "200": {
            "description": "Models",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "models"
                  ],
                  "properties": {
                    "models": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Number of models, clamped to 1 to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ]
      },
      "post": {
        "operationId": "createModel",
        "summary": "Create a model or continue a preview",
        "tags": [
          "Models"
        ],
        "responses": {
          "202": {
            "description": "Model accepted; poll every five seconds until ready or failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Model"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Model is building or preview cannot continue",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds 16 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateModel"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/UploadModel"
              }
            }
          }
        }
      }
    },
    "/api/generations/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Your model ID.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getModel",
        "summary": "Read a model and refresh signed download links",
        "tags": [
          "Models"
        ],
        "responses": {
          "200": {
            "description": "Model; signed file links expire after 15 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Model"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteModel",
        "summary": "Delete a finished model and its files",
        "tags": [
          "Models"
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Model is building or preview cannot continue",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/account": {
      "get": {
        "operationId": "getAccount",
        "summary": "Read credits, plan and model costs",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "Account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "personalApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Personal API key created in Account, API keys."
      }
    },
    "schemas": {
      "CreateModel": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 1000,
            "description": "Provide a prompt, image or both, unless continuing a preview."
          },
          "imageUrl": {
            "type": "string",
            "description": "HTTPS image URL or PNG, JPEG or WebP data URL, under 10 MB."
          },
          "use_for": {
            "type": "string",
            "enum": [
              "web",
              "game",
              "print",
              "render"
            ],
            "default": "web"
          },
          "style": {
            "type": "string",
            "maxLength": 200
          },
          "target_size": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000
          },
          "units": {
            "type": "string",
            "enum": [
              "mm",
              "cm",
              "m"
            ],
            "default": "m"
          },
          "max_triangles": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 500000
          },
          "texture_size": {
            "type": "integer",
            "enum": [
              512,
              1024,
              2048
            ]
          },
          "quad": {
            "type": "boolean",
            "description": "Effective only for game models; sourceUrl links the original quad FBX."
          },
          "preview_only": {
            "type": "boolean",
            "description": "Stop at preview. Photo previews require the full photo model credit balance."
          },
          "continue_id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,128}$",
            "description": "Continue a preview, charging the remaining model credits."
          }
        }
      },
      "UploadModel": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 1000,
            "description": "Provide a prompt, image or both, unless continuing a preview."
          },
          "use_for": {
            "type": "string",
            "enum": [
              "web",
              "game",
              "print",
              "render"
            ],
            "default": "web"
          },
          "style": {
            "type": "string",
            "maxLength": 200
          },
          "target_size": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000
          },
          "units": {
            "type": "string",
            "enum": [
              "mm",
              "cm",
              "m"
            ],
            "default": "m"
          },
          "max_triangles": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 500000
          },
          "texture_size": {
            "type": "integer",
            "enum": [
              512,
              1024,
              2048
            ]
          },
          "quad": {
            "type": "boolean",
            "description": "Effective only for game models; sourceUrl links the original quad FBX."
          },
          "preview_only": {
            "type": "boolean",
            "description": "Stop at preview. Photo previews require the full photo model credit balance."
          },
          "continue_id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,128}$",
            "description": "Continue a preview, charging the remaining model credits."
          },
          "image": {
            "type": "string",
            "format": "binary",
            "description": "PNG, JPEG or WebP photo, under 10 MB."
          }
        }
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "pageUrl": {
            "type": "string"
          },
          "prompt": {
            "type": [
              "string",
              "null"
            ]
          },
          "modelUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "previewUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceFormat": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "type": [
              "number",
              "null"
            ]
          },
          "fileSizeBytes": {
            "type": [
              "number",
              "null"
            ]
          },
          "triangles": {
            "type": [
              "number",
              "null"
            ]
          },
          "retryAfterSeconds": {
            "type": [
              "number",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "preview",
              "ready",
              "failed"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "text",
              "image"
            ]
          },
          "useFor": {
            "type": "string",
            "enum": [
              "web",
              "game",
              "print",
              "render"
            ]
          },
          "dimensions": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "creditsUsed": {
            "type": "number"
          },
          "retryable": {
            "type": "boolean"
          },
          "conversionWarnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "title",
          "format",
          "pageUrl",
          "prompt",
          "modelUrl",
          "previewUrl",
          "sourceUrl",
          "sourceFormat",
          "error",
          "createdAt",
          "completedAt",
          "size",
          "fileSizeBytes",
          "triangles",
          "retryAfterSeconds",
          "status",
          "mode",
          "useFor",
          "dimensions",
          "creditsUsed",
          "retryable",
          "conversionWarnings"
        ]
      },
      "Account": {
        "type": "object",
        "properties": {
          "credits": {
            "type": "number"
          },
          "plan": {
            "type": [
              "string",
              "null"
            ]
          },
          "subscriptionStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "periodEnd": {
            "type": "number",
            "description": "Unix epoch milliseconds; zero when unset."
          },
          "creditPools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "trialEligible": {
            "type": "boolean"
          },
          "pendingCheckout": {
            "type": "boolean"
          },
          "costs": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          }
        },
        "required": [
          "credits",
          "plan",
          "subscriptionStatus",
          "periodEnd",
          "creditPools",
          "trialEligible",
          "pendingCheckout",
          "costs"
        ]
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "retryAfterSeconds": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "additionalProperties": true
      }
    }
  }
}
