{
  "openapi": "3.1.0",
  "info": {
    "title": "Figurement API",
    "version": "1.0.0",
    "description": "The REST API of Figurement. Sign in with an API key as a bearer token (`Authorization: Bearer <API key>`); create keys under Account → API Keys. Guides: [API](/docs/content/getting-started/api) and [Automation and Integrations](/docs/content/getting-started/automation)."
  },
  "tags": [
    {
      "name": "Scenes",
      "description": "Create, import into, export and inspect scenes. Recipes: [Automation and Integrations](/docs/content/getting-started/automation)."
    },
    {
      "name": "Rendering",
      "description": "Render scenes in the cloud. Recipe: [Render through the API](/docs/content/getting-started/automation#render-through-the-api)."
    },
    {
      "name": "Webhooks",
      "description": "Let other systems know when something happens in Figurement. Guide: [Webhooks](/docs/content/getting-started/automation#tell-other-systems-about-figurement-webhooks)."
    },
    {
      "name": "API Keys",
      "description": "Keys for scripts and integrations. Guide: [API](/docs/content/getting-started/api#managing-api-keys)."
    },
    {
      "name": "MCP",
      "description": "The endpoint AI assistants such as Claude and ChatGPT connect to. Guide: [Work from an AI assistant](/docs/content/getting-started/automation#work-from-an-ai-assistant)."
    },
    {
      "name": "OAuth",
      "description": "Sign-in for AI assistants that connect over MCP. Scripts use API keys instead."
    },
    {
      "name": "Libraries",
      "description": "Libraries hold scenes, materials, environments and renders, and can be shared."
    },
    {
      "name": "Assets",
      "description": "Items in libraries: scenes, materials, environments, renders and more."
    },
    {
      "name": "Blob Storage",
      "description": "Files stored by their content digest, such as render images and textures."
    }
  ],
  "paths": {
    "/api/ai/generate": {
      "post": {
        "summary": "Generate an image from a text prompt",
        "tags": [
          "AI"
        ],
        "description": "Creates a brand-new image from a text prompt (text-to-image). No input image is required.\n\nReturns the `digest` of the generated image (download it from `GET /api/blobs/{digest}`) plus an optional model-suggested `name`.\n\n**Example**\n\n```\nPOST /api/ai/generate\n{ \"prompt\": \"a low-poly red fox, studio lighting\", \"usePro\": false }\n```\n\n### Working with digests\n\nFigurement stores every image in content-addressable blob storage and refers to it by an\nopaque `digest` string — you never send raw files directly to the AI endpoints.\n\n**1. Upload an image to obtain a digest**\n\n```\nPOST /api/blobs\nContent-Type: image/png      # the raw image bytes are the request body\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```\n\n**2. Pass that digest** wherever an endpoint asks for one (in the path or the JSON body).\n\n**3. Download a result digest** returned by these endpoints:\n\n```\nGET /api/blobs/{digest}         # the generated image bytes\nGET /api/blobs/{digest}/head    # dimensions / mime-type metadata (JSON)\n```\n",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Text description of the image to create."
                  },
                  "usePro": {
                    "description": "Use the higher-quality \"pro\" model (slower, costs more credits). Defaults to false.",
                    "type": "boolean"
                  },
                  "skipSystemPrompt": {
                    "description": "Leave out the built-in system prompt this endpoint normally puts in front of `prompt`. The endpoint still appends an instruction asking the model for a short title, and a retry after a failed attempt appends a `[Variation xxxx]` suffix. Defaults to false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The image was generated.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "success"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "digest": {
                              "type": "string"
                            },
                            "name": {
                              "description": "Short, human-friendly title suggested by the model. May be null.",
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "digest",
                            "name"
                          ],
                          "additionalProperties": false,
                          "description": "Digest of the generated image, plus an optional model-suggested name."
                        }
                      },
                      "required": [
                        "status",
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "error"
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "SAFETY",
                                "RECITATION",
                                "OTHER",
                                "EMPTY",
                                "BAD_REQUEST",
                                "NOT_FOUND",
                                "INTERNAL",
                                "UNAUTHENTICATED",
                                "RATE_LIMIT"
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request — e.g. a missing prompt or malformed digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Provide a session cookie or a bearer API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Subscription or usage limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/img-to-img/{digest}": {
      "post": {
        "summary": "Transform an image (image-to-image)",
        "tags": [
          "AI"
        ],
        "description": "Transforms an existing image according to a text prompt — style transfer, restyling, or global edits.\n\nThe source image is identified by the `{digest}` path parameter, so you must upload it first (see below). Returns the `digest` of the transformed image plus an optional model-suggested `name`.\n\n**Example**\n\n```\nPOST /api/ai/img-to-img/b3f1c2…\n{ \"prompt\": \"make it look like a watercolor painting\", \"usePro\": false }\n```\n\n### Working with digests\n\nFigurement stores every image in content-addressable blob storage and refers to it by an\nopaque `digest` string — you never send raw files directly to the AI endpoints.\n\n**1. Upload an image to obtain a digest**\n\n```\nPOST /api/blobs\nContent-Type: image/png      # the raw image bytes are the request body\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```\n\n**2. Pass that digest** wherever an endpoint asks for one (in the path or the JSON body).\n\n**3. Download a result digest** returned by these endpoints:\n\n```\nGET /api/blobs/{digest}         # the generated image bytes\nGET /api/blobs/{digest}/head    # dimensions / mime-type metadata (JSON)\n```\n",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "digest",
            "schema": {
              "type": "string",
              "description": "Digest of the source image to transform. Upload it first with `POST /api/blobs`."
            },
            "required": true,
            "description": "Digest of the source image to transform. Upload it first with `POST /api/blobs`."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Text description of how the source image should be transformed."
                  },
                  "usePro": {
                    "description": "Use the higher-quality \"pro\" model (slower, costs more credits). Defaults to false.",
                    "type": "boolean"
                  },
                  "skipSystemPrompt": {
                    "description": "Leave out the built-in system prompt this endpoint normally puts in front of `prompt`. The endpoint still appends an instruction asking the model for a short title, and a retry after a failed attempt appends a `[Variation xxxx]` suffix. Defaults to false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transformed image was generated.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "success"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "digest": {
                              "type": "string"
                            },
                            "name": {
                              "description": "Short, human-friendly title suggested by the model. May be null.",
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "digest",
                            "name"
                          ],
                          "additionalProperties": false,
                          "description": "Digest of the generated image, plus an optional model-suggested name."
                        }
                      },
                      "required": [
                        "status",
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "error"
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "SAFETY",
                                "RECITATION",
                                "OTHER",
                                "EMPTY",
                                "BAD_REQUEST",
                                "NOT_FOUND",
                                "INTERNAL",
                                "UNAUTHENTICATED",
                                "RATE_LIMIT"
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request — e.g. a missing prompt or malformed digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Provide a session cookie or a bearer API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No image was found for the supplied digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Subscription or usage limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/mix-images": {
      "post": {
        "summary": "Combine multiple images into one",
        "tags": [
          "AI"
        ],
        "description": "Blends or composes several source images into a single new image, guided by a prompt (e.g. place the product from image A into the scene from image B).\n\nProvide the `digests` of two or more previously-uploaded images. Returns the `digest` of the combined image plus an optional model-suggested `name`.\n\n**Example**\n\n```\nPOST /api/ai/mix-images\n{ \"prompt\": \"put the sofa into the living room\", \"digests\": [\"a1…\", \"b2…\"] }\n```\n\n### Working with digests\n\nFigurement stores every image in content-addressable blob storage and refers to it by an\nopaque `digest` string — you never send raw files directly to the AI endpoints.\n\n**1. Upload an image to obtain a digest**\n\n```\nPOST /api/blobs\nContent-Type: image/png      # the raw image bytes are the request body\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```\n\n**2. Pass that digest** wherever an endpoint asks for one (in the path or the JSON body).\n\n**3. Download a result digest** returned by these endpoints:\n\n```\nGET /api/blobs/{digest}         # the generated image bytes\nGET /api/blobs/{digest}/head    # dimensions / mime-type metadata (JSON)\n```\n",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Text description of how the images should be combined."
                  },
                  "digests": {
                    "minItems": 2,
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Digests of two or more previously-uploaded source images to combine."
                  },
                  "usePro": {
                    "description": "Use the higher-quality \"pro\" model (slower, costs more credits). Defaults to false.",
                    "type": "boolean"
                  },
                  "skipSystemPrompt": {
                    "description": "Leave out the built-in system prompt this endpoint normally puts in front of `prompt`. The endpoint still appends an instruction asking the model for a short title, and a retry after a failed attempt appends a `[Variation xxxx]` suffix. Defaults to false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "prompt",
                  "digests"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The combined image was generated.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "success"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "digest": {
                              "type": "string"
                            },
                            "name": {
                              "description": "Short, human-friendly title suggested by the model. May be null.",
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "digest",
                            "name"
                          ],
                          "additionalProperties": false,
                          "description": "Digest of the generated image, plus an optional model-suggested name."
                        }
                      },
                      "required": [
                        "status",
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "error"
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "SAFETY",
                                "RECITATION",
                                "OTHER",
                                "EMPTY",
                                "BAD_REQUEST",
                                "NOT_FOUND",
                                "INTERNAL",
                                "UNAUTHENTICATED",
                                "RATE_LIMIT"
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request — e.g. a missing prompt or malformed digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Provide a session cookie or a bearer API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No image was found for the supplied digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Subscription or usage limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/texture": {
      "post": {
        "summary": "Generate a seamless PBR texture",
        "tags": [
          "AI"
        ],
        "description": "Generates a seamless, tileable texture (the albedo / base-color map) from a prompt. Optionally pass a reference image `digest` to steer the look.\n\nReturns the `digest` of the generated texture plus an optional model-suggested `name`.\n\n**Example**\n\n```\nPOST /api/ai/texture\n{ \"prompt\": \"weathered oak planks\", \"digest\": null }\n```\n\n### Working with digests\n\nFigurement stores every image in content-addressable blob storage and refers to it by an\nopaque `digest` string — you never send raw files directly to the AI endpoints.\n\n**1. Upload an image to obtain a digest**\n\n```\nPOST /api/blobs\nContent-Type: image/png      # the raw image bytes are the request body\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```\n\n**2. Pass that digest** wherever an endpoint asks for one (in the path or the JSON body).\n\n**3. Download a result digest** returned by these endpoints:\n\n```\nGET /api/blobs/{digest}         # the generated image bytes\nGET /api/blobs/{digest}/head    # dimensions / mime-type metadata (JSON)\n```\n",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Text description of the texture to generate."
                  },
                  "digest": {
                    "description": "Optional digest of a reference image to guide the texture. Omit or send null for none.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "usePro": {
                    "description": "Use the higher-quality \"pro\" model (slower, costs more credits). Defaults to false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The texture was generated.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "success"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "digest": {
                              "type": "string"
                            },
                            "name": {
                              "description": "Short, human-friendly title suggested by the model. May be null.",
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "digest",
                            "name"
                          ],
                          "additionalProperties": false,
                          "description": "Digest of the generated image, plus an optional model-suggested name."
                        }
                      },
                      "required": [
                        "status",
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "error"
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "SAFETY",
                                "RECITATION",
                                "OTHER",
                                "EMPTY",
                                "BAD_REQUEST",
                                "NOT_FOUND",
                                "INTERNAL",
                                "UNAUTHENTICATED",
                                "RATE_LIMIT"
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request — e.g. a missing prompt or malformed digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Provide a session cookie or a bearer API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No image was found for the supplied digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Subscription or usage limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/material": {
      "post": {
        "summary": "Generate a full PBR material",
        "tags": [
          "AI"
        ],
        "description": "Generates a complete PBR material set — `albedo`, `metalness`, `roughness`, and `bumpMap` — from a prompt. Optionally pass a reference image `digest` to steer the look.\n\nReturns a `maps` object whose four values are the blob **digests** of each generated map (download each with `GET /api/blobs/{digest}`), plus an optional model-suggested `name`.\n\n**Example**\n\n```\nPOST /api/ai/material\n{ \"prompt\": \"hammered copper\", \"usePro\": true }\n```\n\n### Working with digests\n\nFigurement stores every image in content-addressable blob storage and refers to it by an\nopaque `digest` string — you never send raw files directly to the AI endpoints.\n\n**1. Upload an image to obtain a digest**\n\n```\nPOST /api/blobs\nContent-Type: image/png      # the raw image bytes are the request body\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```\n\n**2. Pass that digest** wherever an endpoint asks for one (in the path or the JSON body).\n\n**3. Download a result digest** returned by these endpoints:\n\n```\nGET /api/blobs/{digest}         # the generated image bytes\nGET /api/blobs/{digest}/head    # dimensions / mime-type metadata (JSON)\n```\n",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Text description of the material to generate."
                  },
                  "digest": {
                    "description": "Optional digest of a reference image to guide the material. Omit or send null for none.",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "usePro": {
                    "description": "Use the higher-quality \"pro\" model (slower, costs more credits). Defaults to false.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The material bundle was generated.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "success"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "maps": {
                              "type": "object",
                              "properties": {
                                "albedo": {
                                  "type": "string"
                                },
                                "metalness": {
                                  "type": "string"
                                },
                                "roughness": {
                                  "type": "string"
                                },
                                "bumpMap": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "albedo",
                                "metalness",
                                "roughness",
                                "bumpMap"
                              ],
                              "additionalProperties": false
                            },
                            "name": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "maps"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "error"
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "SAFETY",
                                "RECITATION",
                                "OTHER",
                                "EMPTY",
                                "BAD_REQUEST",
                                "NOT_FOUND",
                                "INTERNAL",
                                "UNAUTHENTICATED",
                                "RATE_LIMIT"
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request — e.g. a missing prompt or malformed digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Provide a session cookie or a bearer API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No image was found for the supplied digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Subscription or usage limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/material/describe": {
      "post": {
        "summary": "Describe a material reference photo",
        "tags": [
          "AI"
        ],
        "description": "Analyzes a reference photo of a material and returns a short natural-language `description` you can use to pre-fill a material-generation prompt. This does **not** generate an image, but it still consumes AI credits from the shared pool.\n\nProvide the `digest` of a previously-uploaded reference photo.\n\n**Example**\n\n```\nPOST /api/ai/material/describe\n{ \"digest\": \"b3f1c2…\" }\n→ { \"status\": \"success\", \"data\": { \"description\": \"Brushed stainless steel…\" } }\n```\n\n### Working with digests\n\nFigurement stores every image in content-addressable blob storage and refers to it by an\nopaque `digest` string — you never send raw files directly to the AI endpoints.\n\n**1. Upload an image to obtain a digest**\n\n```\nPOST /api/blobs\nContent-Type: image/png      # the raw image bytes are the request body\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```\n\n**2. Pass that digest** wherever an endpoint asks for one (in the path or the JSON body).\n\n**3. Download a result digest** returned by these endpoints:\n\n```\nGET /api/blobs/{digest}         # the generated image bytes\nGET /api/blobs/{digest}/head    # dimensions / mime-type metadata (JSON)\n```\n",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "digest": {
                    "type": "string",
                    "description": "Digest of a previously-uploaded reference photo to describe."
                  }
                },
                "required": [
                  "digest"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A natural-language description of the material.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "success"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "description": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "description"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "error"
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "SAFETY",
                                "RECITATION",
                                "OTHER",
                                "EMPTY",
                                "BAD_REQUEST",
                                "NOT_FOUND",
                                "INTERNAL",
                                "UNAUTHENTICATED",
                                "RATE_LIMIT"
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request — e.g. a missing prompt or malformed digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Provide a session cookie or a bearer API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No image was found for the supplied digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Subscription or usage limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/command": {
      "post": {
        "summary": "Extract colors, detect parts, or isolate a part of an image",
        "tags": [
          "AI"
        ],
        "description": "A single multiplexed endpoint for image analysis and part-extraction operations. The `type` field selects the operation (a discriminated union), and every variant takes a `digest` identifying a previously-uploaded image:\n\n- **`extractColors`** — returns the dominant `colors` of the image as `{ hex, name }[]`. No image is generated.\n- **`extractParts`** — returns the detected `objectType` and its list of `parts`. No image is generated.\n- **`extractPartImage`** — generates a new image isolating a single `part`; returns the new image `digest` and optional `name`. Consumes an image credit.\n\n**Examples**\n\n```\nPOST /api/ai/command\n{ \"type\": \"extractColors\", \"digest\": \"b3f1c2…\" }\n\n{ \"type\": \"extractPartImage\", \"digest\": \"b3f1c2…\", \"objectType\": \"Bicycle\", \"part\": \"Front wheel\" }\n```\n\n### Working with digests\n\nFigurement stores every image in content-addressable blob storage and refers to it by an\nopaque `digest` string — you never send raw files directly to the AI endpoints.\n\n**1. Upload an image to obtain a digest**\n\n```\nPOST /api/blobs\nContent-Type: image/png      # the raw image bytes are the request body\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```\n\n**2. Pass that digest** wherever an endpoint asks for one (in the path or the JSON body).\n\n**3. Download a result digest** returned by these endpoints:\n\n```\nGET /api/blobs/{digest}         # the generated image bytes\nGET /api/blobs/{digest}/head    # dimensions / mime-type metadata (JSON)\n```\n",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "extractColors"
                      },
                      "digest": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "type",
                      "digest"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "extractParts"
                      },
                      "digest": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "type",
                      "digest"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "extractPartImage"
                      },
                      "digest": {
                        "type": "string",
                        "minLength": 1
                      },
                      "part": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      "objectType": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      "usePro": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "type",
                      "digest",
                      "part",
                      "objectType"
                    ]
                  }
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The command result. The shape depends on `type`: extracted colors, extracted parts, or a new image digest.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "success"
                        },
                        "data": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "colors": {
                                  "minItems": 1,
                                  "maxItems": 20,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "hex": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 60
                                      }
                                    },
                                    "required": [
                                      "hex",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "colors"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "objectType": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 80
                                },
                                "parts": {
                                  "minItems": 1,
                                  "maxItems": 30,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 80
                                  }
                                }
                              },
                              "required": [
                                "objectType",
                                "parts"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "digest": {
                                  "type": "string"
                                },
                                "name": {
                                  "description": "Short, human-friendly title suggested by the model. May be null.",
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "digest",
                                "name"
                              ],
                              "additionalProperties": false,
                              "description": "Digest of the generated image, plus an optional model-suggested name."
                            }
                          ]
                        }
                      },
                      "required": [
                        "status",
                        "data"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "error"
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "enum": [
                                "SAFETY",
                                "RECITATION",
                                "OTHER",
                                "EMPTY",
                                "BAD_REQUEST",
                                "NOT_FOUND",
                                "INTERNAL",
                                "UNAUTHENTICATED",
                                "RATE_LIMIT"
                              ]
                            },
                            "message": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status",
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request — e.g. a missing prompt or malformed digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Provide a session cookie or a bearer API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No image was found for the supplied digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Subscription or usage limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "error"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAFETY",
                            "RECITATION",
                            "OTHER",
                            "EMPTY",
                            "BAD_REQUEST",
                            "NOT_FOUND",
                            "INTERNAL",
                            "UNAUTHENTICATED",
                            "RATE_LIMIT"
                          ]
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "status",
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/try-figurement-scene": {
      "post": {
        "summary": "Create trial scene",
        "tags": [
          "Scenes"
        ],
        "responses": {
          "200": {
            "description": "Trial scene created"
          }
        }
      }
    },
    "/api/scenes": {
      "post": {
        "summary": "Create scene",
        "tags": [
          "Scenes"
        ],
        "description": "Creates an empty scene named `name` and returns its descriptor. `POST /api/scenes` puts it in the first scene library the caller can edit, preferring one named \"Scenes\" and creating one if there is none; `POST /api/libraries/{libraryId}/assets/of-type/scene` puts it in that library. Counts against the plan's scene limit.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "blobDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "thumbnailVersion": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "isTemporary": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new scene",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "thumbnail": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "material",
                        "color",
                        "environment",
                        "scene",
                        "render",
                        "texture"
                      ]
                    },
                    "modified": {
                      "type": "number"
                    },
                    "metadata": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "access": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "can view"
                        },
                        {
                          "type": "string",
                          "const": "can edit"
                        },
                        {
                          "type": "string",
                          "const": "no access"
                        }
                      ]
                    },
                    "libraryId": {
                      "type": "string"
                    },
                    "ownerUserId": {
                      "type": "string"
                    },
                    "blobDigest": {
                      "type": "string"
                    },
                    "derivedFrom": {
                      "type": "string"
                    },
                    "distance": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "thumbnail",
                    "type",
                    "modified",
                    "metadata",
                    "access",
                    "libraryId",
                    "ownerUserId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "`name` is missing, or the library does not exist (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "No subscription, the scene limit is reached, or no edit access to the library"
          }
        }
      }
    },
    "/api/scenes/{sceneId}": {
      "get": {
        "summary": "Get scene metadata",
        "tags": [
          "Scenes"
        ],
        "description": "Returns the scene's descriptor: name, thumbnail link, metadata, library and the caller's `access`. Needs view access, which a scene shared with everyone with the link gives without signing in.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The scene descriptor",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "thumbnail": {
                          "type": "string"
                        },
                        "modified": {
                          "type": "number"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "access": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "can view"
                            },
                            {
                              "type": "string",
                              "const": "can edit"
                            },
                            {
                              "type": "string",
                              "const": "no access"
                            }
                          ]
                        },
                        "libraryId": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "blobDigest": {
                          "type": "string"
                        },
                        "derivedFrom": {
                          "type": "string"
                        },
                        "distance": {
                          "type": "number"
                        },
                        "type": {
                          "type": "string",
                          "const": "color"
                        },
                        "swatch": {
                          "type": "string"
                        },
                        "xyz": {
                          "type": "array",
                          "prefixItems": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            }
                          ],
                          "items": false,
                          "minItems": 3,
                          "maxItems": 3
                        },
                        "canBrowseLibrary": {
                          "type": "boolean",
                          "description": "Whether the caller can open the library the asset is in"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "thumbnail",
                        "modified",
                        "metadata",
                        "access",
                        "libraryId",
                        "ownerUserId",
                        "type",
                        "swatch",
                        "xyz",
                        "canBrowseLibrary"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "thumbnail": {
                          "type": "string"
                        },
                        "modified": {
                          "type": "number"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "access": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "can view"
                            },
                            {
                              "type": "string",
                              "const": "can edit"
                            },
                            {
                              "type": "string",
                              "const": "no access"
                            }
                          ]
                        },
                        "libraryId": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "blobDigest": {
                          "type": "string"
                        },
                        "derivedFrom": {
                          "type": "string"
                        },
                        "distance": {
                          "type": "number"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "material",
                            "environment",
                            "scene",
                            "render",
                            "texture"
                          ]
                        },
                        "canBrowseLibrary": {
                          "type": "boolean",
                          "description": "Whether the caller can open the library the asset is in"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "thumbnail",
                        "modified",
                        "metadata",
                        "access",
                        "libraryId",
                        "ownerUserId",
                        "type",
                        "canBrowseLibrary"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No access to the scene"
          },
          "404": {
            "description": "No scene with this id"
          }
        }
      },
      "delete": {
        "summary": "Delete scene",
        "tags": [
          "Scenes"
        ],
        "description": "Deletes the scene and its files, closing any sessions that have it open. Needs edit access. Cannot be undone.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "Scene deleted"
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No edit access to the scene"
          },
          "404": {
            "description": "No scene with this id"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/opened": {
      "post": {
        "summary": "Report a scene open conversion event",
        "tags": [
          "Scenes"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Recorded"
          },
          "400": {
            "description": "Invalid scene id"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "No access to this scene"
          },
          "404": {
            "description": "Scene not found"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/clones/{libraryId}/{assetId}": {
      "put": {
        "summary": "Clone scene",
        "tags": [
          "Scenes"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "assetId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Scene cloned"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/clones/{libraryId}": {
      "post": {
        "summary": "Clone scene",
        "tags": [
          "Scenes"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Scene cloned"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/clones": {
      "post": {
        "summary": "Clone scene",
        "tags": [
          "Scenes"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Scene cloned"
          }
        }
      }
    },
    "/api/scenes/{id}/thumbnail": {
      "put": {
        "summary": "Upload asset thumbnail",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Thumbnail stored"
          }
        }
      },
      "get": {
        "summary": "Get asset thumbnail",
        "tags": [
          "Assets"
        ],
        "description": "Returns the asset's thumbnail, usually as a 302 redirect to `/api/blobs/{digest}/thumbnail`; a scene or material without one gets a default image. While a render or a material thumbnail is still being made it responds 222 with the progress (0 to 1) in the `X-Progress` header. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The default thumbnail",
            "content": {
              "image/avif": {}
            }
          },
          "222": {
            "description": "Not ready yet; progress in the `X-Progress` header (plain text body)"
          },
          "302": {
            "description": "Redirect to the thumbnail's blob"
          },
          "401": {
            "description": "Not signed in, and the asset is not public (empty body)"
          },
          "403": {
            "description": "No access to the asset"
          },
          "404": {
            "description": "No asset with this id, it is in another library, or it has no thumbnail"
          }
        }
      }
    },
    "/api/scenes/{id}/thumbnail/share": {
      "put": {
        "summary": "Upload the share image of a scene",
        "tags": [
          "Assets"
        ],
        "description": "The picture link previews show for the scene: a 1200 x 630 JPEG that goes with one thumbnail, named by `thumbnail`: the `X-Thumbnail-Digest` the thumbnail upload answered with. It is refused if the scene has a newer thumbnail by then, and a new thumbnail removes the share image of the one before. A scene without one gets a preview made from its thumbnail. Needs edit access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "thumbnail",
            "schema": {
              "type": "string",
              "description": "The digest of the thumbnail this image goes with"
            },
            "required": true,
            "description": "The digest of the thumbnail this image goes with"
          }
        ],
        "responses": {
          "204": {
            "description": "Share image stored"
          },
          "400": {
            "description": "Not a JPEG, not a scene, or no thumbnail named"
          },
          "409": {
            "description": "The scene has a newer thumbnail than the one named"
          },
          "413": {
            "description": "Too large"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/history": {
      "get": {
        "summary": "List scene version history",
        "tags": [
          "Scenes"
        ],
        "description": "Lists the saved versions of the scene with the time each was saved. Needs edit access. The list is not sorted; sort it by `version`.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The versions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "timestamp": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "version",
                      "timestamp"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No edit access to the scene"
          },
          "404": {
            "description": "No scene with this id"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/history/{version}": {
      "post": {
        "summary": "Revert scene to version",
        "tags": [
          "Scenes"
        ],
        "description": "Restores a saved version by copying its files over the scene's current ones. Needs edit access. Sessions that are only held open for a dropped connection, and a process that is still shutting down, are cleared first. If browsers are connected the request is refused, unless `force=true`: then every session is told to reload and closed, and changes from the last few seconds may be lost.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "force",
            "schema": {
              "description": "Close the sessions of connected browsers",
              "type": "string",
              "enum": [
                "true"
              ]
            },
            "description": "Close the sessions of connected browsers"
          }
        ],
        "responses": {
          "204": {
            "description": "Scene reverted"
          },
          "400": {
            "description": "`force` is given but is not `true`"
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No edit access to the scene"
          },
          "404": {
            "description": "No scene with this id, or no such version"
          },
          "409": {
            "description": "Browsers are connected (and `force` is not set), or the scene could not be closed in time, or another restore or import is writing it"
          }
        }
      },
      "get": {
        "summary": "Get specific scene version",
        "tags": [
          "Scenes"
        ],
        "description": "Returns the files of a saved version in one JSON object keyed by file name (`scene.json`, `materials.json`, ...). Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The version files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/JsonValue"
                  },
                  "description": "The files of the version, keyed by file name, such as `scene.json`"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No access to the scene"
          },
          "404": {
            "description": "No scene with this id, or no such version"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/history/{version}/thumbnail": {
      "get": {
        "summary": "Get version thumbnail",
        "tags": [
          "Scenes"
        ],
        "description": "Returns the JPEG thumbnail saved with a version. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The thumbnail",
            "content": {
              "image/jpeg": {}
            }
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No access to the scene"
          },
          "404": {
            "description": "No scene with this id, or the version has no thumbnail"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/history/{version}/clones": {
      "post": {
        "summary": "Duplicate a scene version",
        "tags": [
          "Scenes"
        ],
        "description": "Creates a new scene in the caller's default scene library from a saved version of this scene. The new scene keeps the history up to and including that version. The name defaults to the scene name followed by the version. Needs view access to the scene. The scene itself is not touched.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new scene",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "thumbnail": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "material",
                        "color",
                        "environment",
                        "scene",
                        "render",
                        "texture"
                      ]
                    },
                    "modified": {
                      "type": "number"
                    },
                    "metadata": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "access": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "can view"
                        },
                        {
                          "type": "string",
                          "const": "can edit"
                        },
                        {
                          "type": "string",
                          "const": "no access"
                        }
                      ]
                    },
                    "libraryId": {
                      "type": "string"
                    },
                    "ownerUserId": {
                      "type": "string"
                    },
                    "blobDigest": {
                      "type": "string"
                    },
                    "derivedFrom": {
                      "type": "string"
                    },
                    "distance": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "thumbnail",
                    "type",
                    "modified",
                    "metadata",
                    "access",
                    "libraryId",
                    "ownerUserId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No access to the scene"
          },
          "404": {
            "description": "No scene with this id, or no such version"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/json": {
      "get": {
        "summary": "Get scene as JSON",
        "tags": [
          "Scenes"
        ],
        "description": "Returns the scene's current files (`hdris`, `materials`, `metadata`, `scene`, `textures`) in one JSON object. A file that cannot be read is `null` and listed in `_missingFiles`. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The scene files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hdris": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/JsonValue"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "materials": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/JsonValue"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "metadata": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/JsonValue"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "scene": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/JsonValue"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "textures": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/JsonValue"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "_missingFiles": {
                      "description": "Files that could not be read; their keys are null",
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "hdris",
                    "materials",
                    "metadata",
                    "scene",
                    "textures"
                  ],
                  "additionalProperties": false,
                  "description": "The scene's files, keyed by file name without `.json`"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the scene is not public (empty body)"
          },
          "403": {
            "description": "No access to the scene"
          },
          "404": {
            "description": "No scene with this id"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/{version}/describe": {
      "get": {
        "summary": "Describe a scene version",
        "tags": [
          "Scenes"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Simplified scene JSON"
          },
          "500": {
            "description": "Processing error"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/zipped": {
      "get": {
        "summary": "Download scene as ZIP",
        "tags": [
          "Scenes"
        ],
        "description": "Downloads the scene's JSON files and every blob they reference as a ZIP archive, named after the scene. Needs edit access, which system admins have to every scene. With `history=true` the archive also has every saved version, and the blobs those versions reference, so the scene and its history can be restored elsewhere (see `backend/tools/fetch-scene.ts`).",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "history",
            "schema": {
              "description": "Also include every saved version of the scene (`history/`)",
              "type": "string",
              "enum": [
                "true"
              ]
            },
            "description": "Also include every saved version of the scene (`history/`)"
          }
        ],
        "responses": {
          "200": {
            "description": "The ZIP archive",
            "content": {
              "application/zip": {}
            }
          },
          "400": {
            "description": "Invalid query (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "No edit access to the scene"
          },
          "404": {
            "description": "No scene with this id"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/export": {
      "get": {
        "summary": "Export scene to glb/usd",
        "tags": [
          "Scenes"
        ],
        "description": "Downloads the scene as a file, named after the scene: GLB (`model/gltf-binary`) or USDZ (`model/vnd.usdz+zip`). Needs view access. Sign in with the session or an API key, or use a signed link from the MCP `export_scene` tool (the same URL with `uid`, `exp` and `sig`), which works without credentials for a few minutes. Opening a signed link checks the access again.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          },
          {
            "signedLink": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "type": "string",
              "enum": [
                "glb",
                "usd"
              ]
            },
            "required": true
          },
          {
            "in": "query",
            "name": "configurationId",
            "schema": {
              "description": "A variant id; the default variant if omitted",
              "type": "string",
              "format": "starts_with",
              "pattern": "^cf.*"
            },
            "description": "A variant id; the default variant if omitted"
          },
          {
            "in": "query",
            "name": "bake",
            "schema": {
              "description": "1 to bake procedural materials into image textures (see BAKE_OPTIONS)",
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            },
            "description": "1 to bake procedural materials into image textures (see BAKE_OPTIONS)"
          }
        ],
        "responses": {
          "200": {
            "description": "The exported file",
            "content": {
              "application/octet-stream": {}
            }
          },
          "400": {
            "description": "Invalid export request (plain text)"
          },
          "401": {
            "description": "Not signed in, or an invalid or expired link (empty body)"
          },
          "403": {
            "description": "No access to the scene"
          },
          "404": {
            "description": "No scene with this id"
          },
          "500": {
            "description": "The export failed"
          },
          "503": {
            "description": "Too many exports are running; retry after the `Retry-After` seconds"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/derived": {
      "post": {
        "summary": "Publish a version of a scene for AR",
        "tags": [
          "Scenes"
        ],
        "description": "Makes a GLB file (Android) and a USDZ file (iOS) of a saved version of the scene, for each of its variants, to show in AR. Answers at once; poll `GET /d/{sceneId}/manifest.json` until `publishing` is null. The files are those of the version, and never change: publish another version to show it. The version published last is the one the scene's page at `/d/{sceneId}` shows, to anyone when the scene is shared with anyone with the link. A version that fails to be made leaves what was published as it was. Needs edit access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "The id of the scene"
            },
            "required": true,
            "description": "The id of the scene"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bake": {
                    "default": true,
                    "description": "Bake procedural materials into image textures, which AR viewers need",
                    "type": "boolean"
                  },
                  "version": {
                    "description": "A version from the scene's history; the latest if left out",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Publishing has started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sceneId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991,
                              "description": "The scene's history version the files are made from"
                            },
                            "bake": {
                              "type": "boolean",
                              "description": "Whether procedural materials were baked into image textures"
                            },
                            "publishedAt": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "Milliseconds since the epoch"
                            },
                            "variants": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "variant": {
                                    "type": "string",
                                    "description": "A variant id, or `default` for a scene without variants"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "files": {
                                    "type": "object",
                                    "properties": {
                                      "glb": {
                                        "type": "object",
                                        "properties": {
                                          "url": {
                                            "type": "string",
                                            "description": "Immutable: the same URL always serves the same bytes"
                                          },
                                          "size": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "url",
                                          "size"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "usdz": {
                                        "type": "object",
                                        "properties": {
                                          "url": {
                                            "type": "string",
                                            "description": "Immutable: the same URL always serves the same bytes"
                                          },
                                          "size": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "url",
                                          "size"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "glb",
                                      "usdz"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "variant",
                                  "files"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "version",
                            "bake",
                            "publishedAt",
                            "variants"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The version published last; null when none is"
                    },
                    "versions": {
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "description": "Every published version, oldest first"
                    },
                    "publishing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "bake": {
                              "type": "boolean"
                            },
                            "done": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991,
                              "description": "Files made so far"
                            },
                            "total": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991,
                              "description": "Files to make: a pair for each variant"
                            },
                            "failed": {
                              "type": "boolean",
                              "description": "Making the files failed; the published version is as it was. Publish again to retry"
                            }
                          },
                          "required": [
                            "version",
                            "bake",
                            "done",
                            "total",
                            "failed"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "A version that is being made, or failed, or null"
                    }
                  },
                  "required": [
                    "sceneId",
                    "name",
                    "current",
                    "versions",
                    "publishing"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or more variants than can be published at once (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "No edit access to the scene, or a guest account (plain text)"
          },
          "404": {
            "description": "No such scene, or no such version (plain text)"
          },
          "409": {
            "description": "Another version of the scene is being published (plain text)"
          }
        }
      },
      "delete": {
        "summary": "Unpublish a scene for AR",
        "tags": [
          "Scenes"
        ],
        "description": "Deletes the published files of the scene, all versions, so its page and file URLs stop working. Needs edit access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "The id of the scene"
            },
            "required": true,
            "description": "The id of the scene"
          }
        ],
        "responses": {
          "204": {
            "description": "Nothing is published any more (empty body)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "No edit access to the scene, or a guest account (plain text)"
          },
          "404": {
            "description": "No such scene, or no such version (plain text)"
          },
          "409": {
            "description": "A version is being published (plain text)"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/derived/{version}": {
      "delete": {
        "summary": "Unpublish one version of a scene for AR",
        "tags": [
          "Scenes"
        ],
        "description": "Deletes the published files of one version, so its file URLs stop working. If it was the version the scene's page shows, the page shows the one published before it. Needs edit access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "The id of the scene"
            },
            "required": true,
            "description": "The id of the scene"
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string",
              "description": "A published version of the scene"
            },
            "required": true,
            "description": "A published version of the scene"
          }
        ],
        "responses": {
          "204": {
            "description": "The version is not published any more (empty body)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "No edit access to the scene, or a guest account (plain text)"
          },
          "404": {
            "description": "No such scene, or no such version (plain text)"
          },
          "409": {
            "description": "A version is being published (plain text)"
          }
        }
      }
    },
    "/d/{sceneId}/manifest.json": {
      "get": {
        "summary": "Files made from a scene",
        "tags": [
          "Scenes"
        ],
        "description": "The version of a scene, shared with anyone with the link, that was published last: a pair of GLB and USDZ files for each variant, with the URL of each. Also the versions published before, and how publishing a version goes while files are being made, so poll it until `publishing` is null. A file is made from the version by the export its URL spells; the URL never changes what it serves.",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "The id of a scene that is shared with anyone with the link"
            },
            "required": true,
            "description": "The id of a scene that is shared with anyone with the link"
          }
        ],
        "responses": {
          "200": {
            "description": "The manifest",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sceneId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991,
                              "description": "The scene's history version the files are made from"
                            },
                            "bake": {
                              "type": "boolean",
                              "description": "Whether procedural materials were baked into image textures"
                            },
                            "publishedAt": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "Milliseconds since the epoch"
                            },
                            "variants": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "variant": {
                                    "type": "string",
                                    "description": "A variant id, or `default` for a scene without variants"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "files": {
                                    "type": "object",
                                    "properties": {
                                      "glb": {
                                        "type": "object",
                                        "properties": {
                                          "url": {
                                            "type": "string",
                                            "description": "Immutable: the same URL always serves the same bytes"
                                          },
                                          "size": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "url",
                                          "size"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "usdz": {
                                        "type": "object",
                                        "properties": {
                                          "url": {
                                            "type": "string",
                                            "description": "Immutable: the same URL always serves the same bytes"
                                          },
                                          "size": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "url",
                                          "size"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "glb",
                                      "usdz"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "variant",
                                  "files"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "version",
                            "bake",
                            "publishedAt",
                            "variants"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The version published last; null when none is"
                    },
                    "versions": {
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "description": "Every published version, oldest first"
                    },
                    "publishing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "bake": {
                              "type": "boolean"
                            },
                            "done": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991,
                              "description": "Files made so far"
                            },
                            "total": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991,
                              "description": "Files to make: a pair for each variant"
                            },
                            "failed": {
                              "type": "boolean",
                              "description": "Making the files failed; the published version is as it was. Publish again to retry"
                            }
                          },
                          "required": [
                            "version",
                            "bake",
                            "done",
                            "total",
                            "failed"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "A version that is being made, or failed, or null"
                    }
                  },
                  "required": [
                    "sceneId",
                    "name",
                    "current",
                    "versions",
                    "publishing"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No such scene, or it is not shared with anyone with the link"
          }
        }
      }
    },
    "/d/{sceneId}/{version}/{recipe}/{file}": {
      "get": {
        "summary": "File made from a scene",
        "tags": [
          "Scenes"
        ],
        "description": "A file of a published version of a scene that is shared with anyone with the link: `scene.glb` or `scene.usdz`. `recipe` is the variant (`default` for a scene without variants), then `.baked` if the textures were baked. Take the URL from the manifest. The file never changes.",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "The id of a scene that is shared with anyone with the link"
            },
            "required": true,
            "description": "The id of a scene that is shared with anyone with the link"
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string",
              "description": "A version of the scene's history that was published"
            },
            "required": true,
            "description": "A version of the scene's history that was published"
          },
          {
            "in": "path",
            "name": "recipe",
            "schema": {
              "type": "string",
              "description": "A variant id or `default`, and `.baked` when baked: `cfab12cd34.baked`"
            },
            "required": true,
            "description": "A variant id or `default`, and `.baked` when baked: `cfab12cd34.baked`"
          },
          {
            "in": "path",
            "name": "file",
            "schema": {
              "type": "string",
              "enum": [
                "scene.glb",
                "scene.usdz"
              ]
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "content": {
              "application/octet-stream": {}
            }
          },
          "404": {
            "description": "No such file: the scene is not shared, or the version is not published"
          }
        }
      },
      "head": {
        "summary": "File made from a scene",
        "tags": [
          "Scenes"
        ],
        "description": "A file of a published version of a scene that is shared with anyone with the link: `scene.glb` or `scene.usdz`. `recipe` is the variant (`default` for a scene without variants), then `.baked` if the textures were baked. Take the URL from the manifest. The file never changes.",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "The id of a scene that is shared with anyone with the link"
            },
            "required": true,
            "description": "The id of a scene that is shared with anyone with the link"
          },
          {
            "in": "path",
            "name": "version",
            "schema": {
              "type": "string",
              "description": "A version of the scene's history that was published"
            },
            "required": true,
            "description": "A version of the scene's history that was published"
          },
          {
            "in": "path",
            "name": "recipe",
            "schema": {
              "type": "string",
              "description": "A variant id or `default`, and `.baked` when baked: `cfab12cd34.baked`"
            },
            "required": true,
            "description": "A variant id or `default`, and `.baked` when baked: `cfab12cd34.baked`"
          },
          {
            "in": "path",
            "name": "file",
            "schema": {
              "type": "string",
              "enum": [
                "scene.glb",
                "scene.usdz"
              ]
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The file",
            "content": {
              "application/octet-stream": {}
            }
          },
          "404": {
            "description": "No such file: the scene is not shared, or the version is not published"
          }
        }
      }
    },
    "/api/scenes/import": {
      "post": {
        "summary": "Import a 3D model as a new scene",
        "tags": [
          "Scenes"
        ],
        "description": "Uploads a 3D model file (GLB/GLTF/OBJ, or USD/USDA/USDC/USDZ) and creates a new scene from it. Returns the new scene ID. Counts against the user's scene quota.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "3D model file (GLB/GLTF/OBJ, or USD/USDA/USDC/USDZ). Sent as a binary file field. A USD file must hold everything it uses: upload a USDZ, or a .zip of its folder (the root file with the layers, payloads and textures it refers to, as in an NVIDIA SimReady asset)."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Scene created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Scene ID"
                    },
                    "name": {
                      "description": "Scene name (only set when a new scene was created)",
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "report": {
                      "description": "What the import changed (imports into an existing scene)",
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "add",
                            "update"
                          ]
                        },
                        "matched": {
                          "type": "number",
                          "description": "Parts of the model that matched a part already in the scene"
                        },
                        "updated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts whose geometry changed"
                        },
                        "moved": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts placed where the model now places them"
                        },
                        "keptAnimated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts the model places differently, left in place because they are animated"
                        },
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "New parts"
                        },
                        "missing": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, still in the scene"
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, deleted"
                        }
                      },
                      "required": [
                        "mode",
                        "matched",
                        "updated",
                        "moved",
                        "keptAnimated",
                        "added",
                        "missing",
                        "removed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid upload (missing file, wrong content-type, empty file)"
          },
          "401": {
            "description": "Not authenticated"
          },
          "403": {
            "description": "The plan's scene limit is reached (plain-text reason)"
          },
          "500": {
            "description": "Model import failed"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/import": {
      "get": {
        "summary": "Open the scene of a signed import link",
        "tags": [
          "Scenes"
        ],
        "description": "Redirects to the scene in Figurement, where the editor imports the file. Only for signed links from the MCP `import_model` tool; programs POST the file to the same link instead.",
        "security": [
          {
            "signedLink": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "Target scene ID"
            },
            "required": true,
            "description": "Target scene ID"
          },
          {
            "in": "query",
            "name": "mode",
            "schema": {
              "default": "add",
              "description": "add: new parts; update: update the matching parts",
              "type": "string",
              "enum": [
                "add",
                "update"
              ]
            },
            "description": "add: new parts; update: update the matching parts"
          },
          {
            "in": "query",
            "name": "removeMissing",
            "schema": {
              "description": "With update, 1 (or true) to delete the parts the model no longer has; otherwise they are only reported",
              "type": "string",
              "enum": [
                "0",
                "1",
                "false",
                "true"
              ]
            },
            "description": "With update, 1 (or true) to delete the parts the model no longer has; otherwise they are only reported"
          }
        ],
        "responses": {
          "303": {
            "description": "To the scene in the editor"
          },
          "401": {
            "description": "Not a valid, unexpired signed link for a scene the user can edit"
          }
        }
      },
      "post": {
        "summary": "Import a 3D model into a scene, or update the scene from a new CAD export",
        "tags": [
          "Scenes"
        ],
        "description": "Uploads a 3D model file (GLB/GLTF/OBJ, or USD/USDA/USDC/USDZ) into the scene identified by `:sceneId`. With `mode=add` the model is added as new parts. With `mode=update` it is matched to the parts already in the scene by name and hierarchy: matched parts get the new geometry and placement and keep their materials and everything else set in Figurement, new parts are added, and parts the model no longer has are reported, or deleted with `removeMissing=1`. Anyone with the scene open sees the change live. Sign in with the session or an API key, or use a signed link from the MCP `import_model` tool.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          },
          {
            "signedLink": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "Target scene ID"
            },
            "required": true,
            "description": "Target scene ID"
          },
          {
            "in": "query",
            "name": "mode",
            "schema": {
              "default": "add",
              "description": "add: new parts; update: update the matching parts",
              "type": "string",
              "enum": [
                "add",
                "update"
              ]
            },
            "description": "add: new parts; update: update the matching parts"
          },
          {
            "in": "query",
            "name": "removeMissing",
            "schema": {
              "description": "With update, 1 (or true) to delete the parts the model no longer has; otherwise they are only reported",
              "type": "string",
              "enum": [
                "0",
                "1",
                "false",
                "true"
              ]
            },
            "description": "With update, 1 (or true) to delete the parts the model no longer has; otherwise they are only reported"
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "3D model file (GLB/GLTF/OBJ, or USD/USDA/USDC/USDZ). Sent as a binary file field. A USD file must hold everything it uses: upload a USDZ, or a .zip of its folder (the root file with the layers, payloads and textures it refers to, as in an NVIDIA SimReady asset)."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Model imported into the scene",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Scene ID"
                    },
                    "name": {
                      "description": "Scene name (only set when a new scene was created)",
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "report": {
                      "description": "What the import changed (imports into an existing scene)",
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "add",
                            "update"
                          ]
                        },
                        "matched": {
                          "type": "number",
                          "description": "Parts of the model that matched a part already in the scene"
                        },
                        "updated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts whose geometry changed"
                        },
                        "moved": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts placed where the model now places them"
                        },
                        "keptAnimated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts the model places differently, left in place because they are animated"
                        },
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "New parts"
                        },
                        "missing": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, still in the scene"
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, deleted"
                        }
                      },
                      "required": [
                        "mode",
                        "matched",
                        "updated",
                        "moved",
                        "keptAnimated",
                        "added",
                        "missing",
                        "removed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or upload (missing file, wrong content-type, empty file)"
          },
          "401": {
            "description": "Not authenticated, no edit access to the scene, or an invalid or expired link"
          },
          "404": {
            "description": "Scene not found"
          },
          "409": {
            "description": "The scene is busy (being reverted or updated); try again shortly"
          },
          "500": {
            "description": "Model import failed"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/merge-scene/{sourceSceneId}": {
      "post": {
        "summary": "Merge a scene into an existing scene",
        "tags": [
          "Scenes"
        ],
        "description": "Loads a source scene from disk and merges its geometry, materials, textures, and cameras into the target scene. Anyone with the target scene open sees the merge live.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "Target scene ID"
            },
            "required": true,
            "description": "Target scene ID"
          },
          {
            "in": "path",
            "name": "sourceSceneId",
            "schema": {
              "type": "string",
              "description": "Source scene ID to merge from"
            },
            "required": true,
            "description": "Source scene ID to merge from"
          }
        ],
        "responses": {
          "200": {
            "description": "Scene merged successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Scene ID"
                    },
                    "name": {
                      "description": "Scene name (only set when a new scene was created)",
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "report": {
                      "description": "What the import changed (imports into an existing scene)",
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "add",
                            "update"
                          ]
                        },
                        "matched": {
                          "type": "number",
                          "description": "Parts of the model that matched a part already in the scene"
                        },
                        "updated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts whose geometry changed"
                        },
                        "moved": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts placed where the model now places them"
                        },
                        "keptAnimated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts the model places differently, left in place because they are animated"
                        },
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "New parts"
                        },
                        "missing": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, still in the scene"
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, deleted"
                        }
                      },
                      "required": [
                        "mode",
                        "matched",
                        "updated",
                        "moved",
                        "keptAnimated",
                        "added",
                        "missing",
                        "removed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Source scene has no data"
          },
          "401": {
            "description": "Not authenticated or insufficient access"
          },
          "404": {
            "description": "Scene not found"
          },
          "500": {
            "description": "Merge failed"
          }
        }
      }
    },
    "/api/scenes/{sceneId}/extractions/{libraryId}": {
      "post": {
        "summary": "Save parts of a scene as a scene of their own",
        "tags": [
          "Scenes"
        ],
        "description": "Creates a scene named `name` in the scene library `libraryId`, holding only the parts `nodeIds` (a group comes with everything in it) and the materials and textures they use, as the source scene is right now including changes made in an open editor. A part inside a group is moved to the top, staying where it is in the world. The new scene merges into other scenes like any scene. Counts against the possible scene limit.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sceneId",
            "schema": {
              "type": "string",
              "description": "Scene to take the parts from"
            },
            "required": true,
            "description": "Scene to take the parts from"
          },
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string",
              "description": "Scene library to put the new scene in"
            },
            "required": true,
            "description": "Scene library to put the new scene in"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Name of the new scene"
                  },
                  "nodeIds": {
                    "minItems": 1,
                    "maxItems": 10000,
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Ids of the parts (or groups, which come with everything in them) to take out of the scene"
                  }
                },
                "required": [
                  "name",
                  "nodeIds"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Scene created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Scene ID"
                    },
                    "name": {
                      "description": "Scene name (only set when a new scene was created)",
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "report": {
                      "description": "What the import changed (imports into an existing scene)",
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "add",
                            "update"
                          ]
                        },
                        "matched": {
                          "type": "number",
                          "description": "Parts of the model that matched a part already in the scene"
                        },
                        "updated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts whose geometry changed"
                        },
                        "moved": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts placed where the model now places them"
                        },
                        "keptAnimated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Matched parts the model places differently, left in place because they are animated"
                        },
                        "added": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "New parts"
                        },
                        "missing": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, still in the scene"
                        },
                        "removed": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "path": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Names of the enclosing nodes below the geometry root, outermost first"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "path"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Parts the model no longer has, deleted"
                        }
                      },
                      "required": [
                        "mode",
                        "matched",
                        "updated",
                        "moved",
                        "keptAnimated",
                        "added",
                        "missing",
                        "removed"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or the parts are not parts of the scene, or the library has no scenes"
          },
          "401": {
            "description": "Not authenticated or insufficient access"
          },
          "403": {
            "description": "The plan's scene limit is reached (plain-text reason)"
          },
          "404": {
            "description": "Scene or library not found"
          },
          "500": {
            "description": "The scene could not be made"
          }
        }
      }
    },
    "/api/mcp": {
      "get": {
        "summary": "Model Context Protocol endpoint",
        "tags": [
          "MCP"
        ],
        "description": "Streamable HTTP MCP server exposing Figurement scenes, libraries and renders to AI agents. Authenticate with an OAuth access token (discover the authorization server from /.well-known/oauth-protected-resource/api/mcp) or an API key, as a bearer token.",
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON-RPC response or event stream"
          },
          "401": {
            "description": "Missing or invalid token; the WWW-Authenticate header says how to get one"
          },
          "403": {
            "description": "The user's plan does not include MCP access; the body says how to upgrade"
          }
        }
      },
      "post": {
        "summary": "Model Context Protocol endpoint",
        "tags": [
          "MCP"
        ],
        "description": "Streamable HTTP MCP server exposing Figurement scenes, libraries and renders to AI agents. Authenticate with an OAuth access token (discover the authorization server from /.well-known/oauth-protected-resource/api/mcp) or an API key, as a bearer token.",
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON-RPC response or event stream"
          },
          "401": {
            "description": "Missing or invalid token; the WWW-Authenticate header says how to get one"
          },
          "403": {
            "description": "The user's plan does not include MCP access; the body says how to upgrade"
          }
        }
      },
      "delete": {
        "summary": "Model Context Protocol endpoint",
        "tags": [
          "MCP"
        ],
        "description": "Streamable HTTP MCP server exposing Figurement scenes, libraries and renders to AI agents. Authenticate with an OAuth access token (discover the authorization server from /.well-known/oauth-protected-resource/api/mcp) or an API key, as a bearer token.",
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "JSON-RPC response or event stream"
          },
          "401": {
            "description": "Missing or invalid token; the WWW-Authenticate header says how to get one"
          },
          "403": {
            "description": "The user's plan does not include MCP access; the body says how to upgrade"
          }
        }
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "summary": "OAuth authorization server metadata (RFC 8414)",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "200": {
            "description": "Metadata"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "summary": "Protected resource metadata for the MCP endpoint (RFC 9728)",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "200": {
            "description": "Metadata"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/api/mcp": {
      "get": {
        "summary": "Protected resource metadata for the MCP endpoint (RFC 9728)",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "200": {
            "description": "Metadata"
          }
        }
      }
    },
    "/api/oauth/register": {
      "post": {
        "summary": "Register an OAuth client (RFC 7591)",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "201": {
            "description": "Registered client"
          }
        }
      }
    },
    "/api/oauth/token": {
      "post": {
        "summary": "OAuth token endpoint",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "200": {
            "description": "Tokens"
          }
        }
      }
    },
    "/api/oauth/revoke": {
      "post": {
        "summary": "Revoke an OAuth token (RFC 7009)",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "200": {
            "description": "Revoked"
          }
        }
      }
    },
    "/api/oauth/authorize": {
      "get": {
        "summary": "Check an authorization request for the consent page",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "200": {
            "description": "What to show or where to go"
          }
        }
      },
      "post": {
        "summary": "Record the user's consent decision",
        "tags": [
          "OAuth"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "request": {
                    "type": "object",
                    "properties": {
                      "response_type": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "redirect_uri": {
                        "type": "string"
                      },
                      "code_challenge": {
                        "type": "string"
                      },
                      "code_challenge_method": {
                        "type": "string"
                      },
                      "scope": {
                        "type": "string"
                      },
                      "state": {
                        "type": "string"
                      },
                      "resource": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "response_type",
                      "client_id",
                      "redirect_uri",
                      "code_challenge",
                      "code_challenge_method"
                    ]
                  },
                  "approve": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "request",
                  "approve"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Where to send the browser"
          }
        }
      }
    },
    "/api/oauth/connections": {
      "get": {
        "summary": "List apps connected to your account",
        "tags": [
          "OAuth"
        ],
        "responses": {
          "200": {
            "description": "Connections"
          }
        }
      }
    },
    "/api/oauth/connections/{id}": {
      "delete": {
        "summary": "Disconnect an app from your account",
        "tags": [
          "OAuth"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "Disconnected"
          }
        }
      }
    },
    "/api/keys": {
      "post": {
        "summary": "Create API key",
        "tags": [
          "API Keys"
        ],
        "description": "Creates an API key named \"New API Key\". Send it as `Authorization: Bearer <token>`; `token` is shown only in this response.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expires_in_days": {
                    "description": "Days until the key expires; null for never. 30 if omitted.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string",
                      "description": "The key itself, shown only in this response"
                    },
                    "name": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "token",
                    "name",
                    "expires_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "`expires_in_days` is not a positive integer or null (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot have API keys (plain text)"
          }
        }
      },
      "get": {
        "summary": "List API keys",
        "tags": [
          "API Keys"
        ],
        "description": "Lists the caller's API keys that have not expired; the keys themselves are never shown again.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The API keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "abbr": {
                        "type": "string",
                        "description": "The first 4 characters of the key"
                      },
                      "expires_at": {
                        "description": "When the key expires; null if never",
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "abbr",
                      "expires_at"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot have API keys (plain text)"
          }
        }
      }
    },
    "/api/keys/{id}": {
      "patch": {
        "summary": "Rename API key",
        "tags": [
          "API Keys"
        ],
        "description": "Renames one of the caller's API keys.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Key renamed (empty body)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot have API keys (plain text)"
          },
          "404": {
            "description": "No API key with this id among the caller's"
          }
        }
      },
      "delete": {
        "summary": "Revoke API key",
        "tags": [
          "API Keys"
        ],
        "description": "Deletes one of the caller's API keys; requests that use it are refused from then on.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Key revoked (empty body)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot have API keys (plain text)"
          },
          "404": {
            "description": "No API key with this id among the caller's"
          }
        }
      }
    },
    "/api/data-connections/{id}/all-keys": {
      "get": {
        "summary": "Get all keys from data connection",
        "tags": [
          "Data Connections"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Key list"
          }
        }
      }
    },
    "/api/data-connections/all-keys": {
      "get": {
        "summary": "Get all keys from data connection",
        "tags": [
          "Data Connections"
        ],
        "responses": {
          "200": {
            "description": "Key list"
          }
        }
      }
    },
    "/api/data-connections/{id}/suggestions": {
      "post": {
        "summary": "Get column mapping suggestions",
        "tags": [
          "Data Connections"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Suggestions"
          }
        }
      }
    },
    "/api/data-connections/suggestions": {
      "post": {
        "summary": "Get column mapping suggestions",
        "tags": [
          "Data Connections"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Suggestions"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/data-connections": {
      "get": {
        "summary": "List data connections",
        "tags": [
          "Data Connections"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Connection list"
          }
        }
      },
      "post": {
        "summary": "Create data connection",
        "tags": [
          "Data Connections"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Connection created"
          }
        }
      }
    },
    "/api/data-connections/{id}/sync": {
      "post": {
        "summary": "Sync data connection",
        "tags": [
          "Data Connections"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Sync complete"
          }
        }
      }
    },
    "/api/data-connections/{id}": {
      "put": {
        "summary": "Update data connection",
        "tags": [
          "Data Connections"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "organization_id": {
                    "type": "string"
                  },
                  "destination": {
                    "type": "string",
                    "enum": [
                      "library",
                      "lookup"
                    ]
                  },
                  "library_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "tag": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "staged_table_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "committed_table_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "validation": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "message": {
                              "type": "string"
                            },
                            "level": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "message",
                            "level"
                          ]
                        }
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "unique_keys": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "fields": {
                    "anyOf": [
                      {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "composite_keys_state": {
                    "type": "string",
                    "enum": [
                      "undone",
                      "processing",
                      "done",
                      "failed"
                    ]
                  },
                  "source": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "google_sheet"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "google_sheet_id": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "google_sheet_tab_id": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "google_credential_id": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "google_channel_id": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "google_channel_resource_id": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "google_channel_expires_at": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "last_sync_error": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "created_at": {
                    "type": "string"
                  },
                  "updated_at": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "filename",
                  "organization_id",
                  "destination",
                  "library_id",
                  "tag",
                  "staged_table_id",
                  "committed_table_id",
                  "validation",
                  "unique_keys",
                  "fields",
                  "composite_keys_state",
                  "created_at",
                  "updated_at"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connection updated"
          }
        }
      },
      "delete": {
        "summary": "Delete data connection",
        "tags": [
          "Data Connections"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Connection deleted"
          }
        }
      }
    },
    "/api/data-connections": {
      "get": {
        "summary": "List data connections",
        "tags": [
          "Data Connections"
        ],
        "responses": {
          "200": {
            "description": "Connection list"
          }
        }
      },
      "post": {
        "summary": "Create data connection",
        "tags": [
          "Data Connections"
        ],
        "responses": {
          "201": {
            "description": "Connection created"
          }
        }
      }
    },
    "/api/reseller": {
      "get": {
        "summary": "The caller's reseller, its support contacts and the plans it can sell",
        "tags": [
          "Reseller"
        ],
        "description": "Answers 403 when the caller does not work for a reseller.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Reseller info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reseller": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "contactName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "contactEmail": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "contactPhone": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "contactWebsite": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "marketingEmails": {
                          "type": "boolean"
                        },
                        "billing": {
                          "type": "object",
                          "properties": {
                            "addressLine1": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "addressLine2": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "postalCode": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 20
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "city": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 100
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "country": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[A-Z]{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "vatNumber": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 30
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "email": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "email",
                                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "addressLine1",
                            "addressLine2",
                            "postalCode",
                            "city",
                            "country",
                            "vatNumber",
                            "email"
                          ],
                          "additionalProperties": false
                        },
                        "canSell": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "contactName",
                        "contactEmail",
                        "contactPhone",
                        "contactWebsite",
                        "marketingEmails",
                        "billing",
                        "canSell"
                      ],
                      "additionalProperties": false
                    },
                    "supportContacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "contactName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "contactEmail": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "contactPhone": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "contactWebsite": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "customerCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "contactName",
                          "contactEmail",
                          "contactPhone",
                          "contactWebsite",
                          "customerCount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "plans": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "enum": [
                              "starter",
                              "student",
                              "pro2_monthly",
                              "pro2_yearly",
                              "max_monthly",
                              "max_yearly",
                              "team_monthly",
                              "team_yearly",
                              "pro_monthly",
                              "pro_yearly",
                              "enterprise"
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "billingFrequency": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "monthly",
                                  "yearly"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "trialDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "price": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "currency": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sellable": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "billingFrequency",
                          "trialDays",
                          "price",
                          "sellable"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "discounts": {
                      "type": "object",
                      "properties": {
                        "renewalPercentOff": {
                          "anyOf": [
                            {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 100
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "firstSalePercentOff": {
                          "anyOf": [
                            {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "maximum": 100
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "renewalPercentOff",
                        "firstSalePercentOff"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "reseller",
                    "supportContacts",
                    "plans",
                    "discounts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Not reseller staff"
          }
        }
      }
    },
    "/api/reseller/settings": {
      "patch": {
        "summary": "Change the reseller's settings",
        "tags": [
          "Reseller"
        ],
        "description": "`marketingEmails` is whether the users the reseller creates from now on start subscribed to Figurement's marketing emails and product updates. Existing users keep their own choice. Onboarding and reminder emails are never sent to them.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "marketingEmails": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "marketingEmails"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated reseller",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "contactName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactPhone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactWebsite": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "marketingEmails": {
                      "type": "boolean"
                    },
                    "billing": {
                      "type": "object",
                      "properties": {
                        "addressLine1": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 200
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "addressLine2": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 200
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "postalCode": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 20
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "city": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 100
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "country": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^[A-Z]{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "vatNumber": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 30
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "email": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "email",
                              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "addressLine1",
                        "addressLine2",
                        "postalCode",
                        "city",
                        "country",
                        "vatNumber",
                        "email"
                      ],
                      "additionalProperties": false
                    },
                    "canSell": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "contactName",
                    "contactEmail",
                    "contactPhone",
                    "contactWebsite",
                    "marketingEmails",
                    "billing",
                    "canSell"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/reseller/invoices": {
      "get": {
        "summary": "The reseller's invoices from Figurement",
        "tags": [
          "Reseller"
        ],
        "description": "Its latest 100 invoices, newest first, each naming the customer it is for. A draft is one Stripe sends within about an hour.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Invoices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "number": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "dueDate": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "paidAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "draft",
                          "open",
                          "overdue",
                          "paid",
                          "void",
                          "uncollectible"
                        ]
                      },
                      "customer": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "total": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "amountRemaining": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "currency": {
                        "type": "string"
                      },
                      "hostedUrl": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "pdfUrl": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "number",
                      "createdAt",
                      "dueDate",
                      "paidAt",
                      "status",
                      "customer",
                      "total",
                      "amountRemaining",
                      "currency",
                      "hostedUrl",
                      "pdfUrl"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "502": {
            "description": "Stripe could not be reached"
          }
        }
      }
    },
    "/api/reseller/email-preview": {
      "post": {
        "summary": "Preview an email the portal sends",
        "tags": [
          "Reseller"
        ],
        "description": "The subject and HTML of the email a portal action would send: to a new customer, to a new seat holder, or to the customer about a plan. Sends nothing.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "account"
                      },
                      "email": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "company": {
                        "type": "string"
                      },
                      "supportContactId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "email"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "seat"
                      },
                      "customerId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "customerId"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "plan"
                      },
                      "customerId": {
                        "type": "string"
                      },
                      "sale": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "trial"
                              },
                              "planKey": {
                                "type": "string",
                                "enum": [
                                  "starter",
                                  "student",
                                  "pro2_monthly",
                                  "pro2_yearly",
                                  "max_monthly",
                                  "max_yearly",
                                  "team_monthly",
                                  "team_yearly",
                                  "pro_monthly",
                                  "pro_yearly",
                                  "enterprise"
                                ]
                              },
                              "seats": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 1000
                              },
                              "notifyCustomer": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind",
                              "planKey",
                              "seats"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "paid"
                              },
                              "planKey": {
                                "type": "string",
                                "enum": [
                                  "starter",
                                  "student",
                                  "pro2_monthly",
                                  "pro2_yearly",
                                  "max_monthly",
                                  "max_yearly",
                                  "team_monthly",
                                  "team_yearly",
                                  "pro_monthly",
                                  "pro_yearly",
                                  "enterprise"
                                ]
                              },
                              "seats": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 1000
                              },
                              "periodEnd": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "notifyCustomer": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "kind",
                              "planKey",
                              "seats"
                            ]
                          }
                        ],
                        "type": "object"
                      }
                    },
                    "required": [
                      "kind",
                      "customerId",
                      "sale"
                    ]
                  }
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The email",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "subject": {
                      "type": "string"
                    },
                    "html": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "subject",
                    "html"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/reseller/support-contacts": {
      "post": {
        "summary": "Add a support contact",
        "tags": [
          "Reseller"
        ],
        "description": "Someone the reseller's customers can contact for support instead of the reseller, such as a partner it sells through. Figurement shows it to the customers the reseller assigns it to.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactEmail": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactPhone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactWebsite": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The support contact",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "contactName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactPhone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactWebsite": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customerCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "contactName",
                    "contactEmail",
                    "contactPhone",
                    "contactWebsite",
                    "customerCount"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/reseller/support-contacts/{contactId}": {
      "patch": {
        "summary": "Change a support contact",
        "tags": [
          "Reseller"
        ],
        "description": "Replaces its name and contact details.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "contactId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactEmail": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactPhone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactWebsite": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The support contact",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "contactName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactPhone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "contactWebsite": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customerCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "contactName",
                    "contactEmail",
                    "contactPhone",
                    "contactWebsite",
                    "customerCount"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a support contact",
        "tags": [
          "Reseller"
        ],
        "description": "Its customers contact the reseller itself again.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "contactId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/api/reseller/customers": {
      "get": {
        "summary": "List the reseller's customers",
        "tags": [
          "Reseller"
        ],
        "description": "Newest first, each with the subscription it owns, if any. Users it added to the seats of a customer are not listed while they hold that seat.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Customers with their subscriptions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "company": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "supportContactId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "subscription": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "planKey": {
                                "type": "string",
                                "enum": [
                                  "starter",
                                  "student",
                                  "pro2_monthly",
                                  "pro2_yearly",
                                  "max_monthly",
                                  "max_yearly",
                                  "team_monthly",
                                  "team_yearly",
                                  "pro_monthly",
                                  "pro_yearly",
                                  "enterprise"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "active",
                                  "past_due",
                                  "canceled",
                                  "trialing",
                                  "incomplete",
                                  "incomplete_expired",
                                  "unpaid",
                                  "paused"
                                ]
                              },
                              "seats": {
                                "type": "number"
                              },
                              "assignedSeats": {
                                "type": "number"
                              },
                              "currentPeriodEnd": {
                                "type": "string"
                              },
                              "renews": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "planKey",
                              "status",
                              "seats",
                              "assignedSeats",
                              "currentPeriodEnd",
                              "renews"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "email",
                      "name",
                      "company",
                      "supportContactId",
                      "subscription"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a customer account",
        "tags": [
          "Reseller"
        ],
        "description": "Creates an account for a customer of the reseller and emails the customer a link to set a password. `supportContactId` picks whom its users contact for support; without it, they contact the reseller. An email that cannot be used gets the same generic answer whatever the reason.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "company": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "supportContactId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "boolean",
                          "const": true
                        },
                        "customer": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "company": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "supportContactId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "subscription": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "planKey": {
                                      "type": "string",
                                      "enum": [
                                        "starter",
                                        "student",
                                        "pro2_monthly",
                                        "pro2_yearly",
                                        "max_monthly",
                                        "max_yearly",
                                        "team_monthly",
                                        "team_yearly",
                                        "pro_monthly",
                                        "pro_yearly",
                                        "enterprise"
                                      ]
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": [
                                        "active",
                                        "past_due",
                                        "canceled",
                                        "trialing",
                                        "incomplete",
                                        "incomplete_expired",
                                        "unpaid",
                                        "paused"
                                      ]
                                    },
                                    "seats": {
                                      "type": "number"
                                    },
                                    "assignedSeats": {
                                      "type": "number"
                                    },
                                    "currentPeriodEnd": {
                                      "type": "string"
                                    },
                                    "renews": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "planKey",
                                    "status",
                                    "seats",
                                    "assignedSeats",
                                    "currentPeriodEnd",
                                    "renews"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "email",
                            "name",
                            "company",
                            "supportContactId",
                            "subscription"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "created",
                        "customer"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "boolean",
                          "const": false
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "created",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          },
          "202": {
            "description": "Not created; Figurement follows up",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "boolean",
                          "const": true
                        },
                        "customer": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "company": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "supportContactId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "subscription": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "planKey": {
                                      "type": "string",
                                      "enum": [
                                        "starter",
                                        "student",
                                        "pro2_monthly",
                                        "pro2_yearly",
                                        "max_monthly",
                                        "max_yearly",
                                        "team_monthly",
                                        "team_yearly",
                                        "pro_monthly",
                                        "pro_yearly",
                                        "enterprise"
                                      ]
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": [
                                        "active",
                                        "past_due",
                                        "canceled",
                                        "trialing",
                                        "incomplete",
                                        "incomplete_expired",
                                        "unpaid",
                                        "paused"
                                      ]
                                    },
                                    "seats": {
                                      "type": "number"
                                    },
                                    "assignedSeats": {
                                      "type": "number"
                                    },
                                    "currentPeriodEnd": {
                                      "type": "string"
                                    },
                                    "renews": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "planKey",
                                    "status",
                                    "seats",
                                    "assignedSeats",
                                    "currentPeriodEnd",
                                    "renews"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "email",
                            "name",
                            "company",
                            "supportContactId",
                            "subscription"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "created",
                        "customer"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "boolean",
                          "const": false
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "created",
                        "message"
                      ],
                      "additionalProperties": false
                    }
                  ],
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/reseller/customers/{userId}/subscription": {
      "put": {
        "summary": "Start a trial or set a paid subscription for a customer, or change its plan, seats or end date",
        "tags": [
          "Reseller"
        ],
        "description": "A trial lasts the tier's trial length, is free and a customer gets one. A paid subscription renews until the reseller ends it, or with `periodEnd` runs until then; Figurement invoices the reseller for it through Stripe. When it ends, the customer falls back to the free plan.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "trial"
                      },
                      "planKey": {
                        "type": "string",
                        "enum": [
                          "starter",
                          "student",
                          "pro2_monthly",
                          "pro2_yearly",
                          "max_monthly",
                          "max_yearly",
                          "team_monthly",
                          "team_yearly",
                          "pro_monthly",
                          "pro_yearly",
                          "enterprise"
                        ]
                      },
                      "seats": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000
                      },
                      "notifyCustomer": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "kind",
                      "planKey",
                      "seats"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "paid"
                      },
                      "planKey": {
                        "type": "string",
                        "enum": [
                          "starter",
                          "student",
                          "pro2_monthly",
                          "pro2_yearly",
                          "max_monthly",
                          "max_yearly",
                          "team_monthly",
                          "team_yearly",
                          "pro_monthly",
                          "pro_yearly",
                          "enterprise"
                        ]
                      },
                      "seats": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000
                      },
                      "periodEnd": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "notifyCustomer": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "kind",
                      "planKey",
                      "seats"
                    ]
                  }
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The customer with the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "company": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supportContactId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "subscription": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "planKey": {
                              "type": "string",
                              "enum": [
                                "starter",
                                "student",
                                "pro2_monthly",
                                "pro2_yearly",
                                "max_monthly",
                                "max_yearly",
                                "team_monthly",
                                "team_yearly",
                                "pro_monthly",
                                "pro_yearly",
                                "enterprise"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "past_due",
                                "canceled",
                                "trialing",
                                "incomplete",
                                "incomplete_expired",
                                "unpaid",
                                "paused"
                              ]
                            },
                            "seats": {
                              "type": "number"
                            },
                            "assignedSeats": {
                              "type": "number"
                            },
                            "currentPeriodEnd": {
                              "type": "string"
                            },
                            "renews": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "planKey",
                            "status",
                            "seats",
                            "assignedSeats",
                            "currentPeriodEnd",
                            "renews"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "name",
                    "company",
                    "supportContactId",
                    "subscription"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Trial already used, a trial asked for while a paid subscription runs, the customer has a subscription not sold by this reseller, or Figurement does not have the reseller's billing address and email yet"
          },
          "502": {
            "description": "Stripe refused the change"
          }
        }
      }
    },
    "/api/reseller/customers/{userId}/subscription/end": {
      "post": {
        "summary": "End a customer's renewing subscription",
        "tags": [
          "Reseller"
        ],
        "description": "It runs until the end of the period already invoiced and is then cancelled. Changing the plan without an end date makes it renew again.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The customer with the subscription",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "company": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supportContactId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "subscription": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "planKey": {
                              "type": "string",
                              "enum": [
                                "starter",
                                "student",
                                "pro2_monthly",
                                "pro2_yearly",
                                "max_monthly",
                                "max_yearly",
                                "team_monthly",
                                "team_yearly",
                                "pro_monthly",
                                "pro_yearly",
                                "enterprise"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "past_due",
                                "canceled",
                                "trialing",
                                "incomplete",
                                "incomplete_expired",
                                "unpaid",
                                "paused"
                              ]
                            },
                            "seats": {
                              "type": "number"
                            },
                            "assignedSeats": {
                              "type": "number"
                            },
                            "currentPeriodEnd": {
                              "type": "string"
                            },
                            "renews": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "planKey",
                            "status",
                            "seats",
                            "assignedSeats",
                            "currentPeriodEnd",
                            "renews"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "name",
                    "company",
                    "supportContactId",
                    "subscription"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "The subscription is a trial or already has an end date"
          },
          "502": {
            "description": "Stripe refused the change"
          }
        }
      }
    },
    "/api/reseller/customers/{userId}/next-invoice": {
      "get": {
        "summary": "Figurement's next invoice for a customer's plan",
        "tags": [
          "Reseller"
        ],
        "description": "What Stripe will invoice the reseller at the plan's next renewal, incl. VAT and changes not yet invoiced. Null for a trial or a plan that ends.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Next invoice",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "currency": {
                          "type": "string"
                        },
                        "renewsWith": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "planKey": {
                                  "type": "string",
                                  "enum": [
                                    "starter",
                                    "student",
                                    "pro2_monthly",
                                    "pro2_yearly",
                                    "max_monthly",
                                    "max_yearly",
                                    "team_monthly",
                                    "team_yearly",
                                    "pro_monthly",
                                    "pro_yearly",
                                    "enterprise"
                                  ]
                                },
                                "seats": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "planKey",
                                "seats"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "date",
                        "total",
                        "currency",
                        "renewsWith"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/reseller/customers/{userId}/seats": {
      "get": {
        "summary": "List the seats of a customer's subscription",
        "tags": [
          "Reseller"
        ],
        "description": "The email of each seat holder, and null for each unfilled seat.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Seats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Fill the seats of a customer's subscription",
        "tags": [
          "Reseller"
        ],
        "description": "Replaces the seat holders. Emails without an account get one and an invitation, and belong to the reseller from then on. `failed` lists emails that could not be added: an account the reseller did not create, or one that already holds a seat on another subscription.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seats": {
                    "type": "array",
                    "items": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                },
                "required": [
                  "seats"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Seats updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seats": {
                      "type": "array",
                      "items": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "failed": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "seats",
                    "failed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/reseller/customers/{userId}/support-contact": {
      "put": {
        "summary": "Choose whom a customer contacts for support",
        "tags": [
          "Reseller"
        ],
        "description": "One of the reseller's support contacts, or `null` for the reseller itself.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "supportContactId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "supportContactId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The customer",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "company": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supportContactId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "subscription": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "planKey": {
                              "type": "string",
                              "enum": [
                                "starter",
                                "student",
                                "pro2_monthly",
                                "pro2_yearly",
                                "max_monthly",
                                "max_yearly",
                                "team_monthly",
                                "team_yearly",
                                "pro_monthly",
                                "pro_yearly",
                                "enterprise"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "past_due",
                                "canceled",
                                "trialing",
                                "incomplete",
                                "incomplete_expired",
                                "unpaid",
                                "paused"
                              ]
                            },
                            "seats": {
                              "type": "number"
                            },
                            "assignedSeats": {
                              "type": "number"
                            },
                            "currentPeriodEnd": {
                              "type": "string"
                            },
                            "renews": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "planKey",
                            "status",
                            "seats",
                            "assignedSeats",
                            "currentPeriodEnd",
                            "renews"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "name",
                    "company",
                    "supportContactId",
                    "subscription"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/libraries/{library_id}/metadata/keys": {
      "get": {
        "summary": "List all metadata keys",
        "tags": [
          "Libraries"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata keys"
          }
        }
      }
    },
    "/api/libraries/{library_id}/tags/{tag_id}/assets/{asset_id}": {
      "put": {
        "summary": "Tag an asset",
        "tags": [
          "Libraries",
          "Tags"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "tag_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "asset_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Asset tagged"
          }
        }
      },
      "delete": {
        "summary": "Untag an asset",
        "tags": [
          "Libraries",
          "Tags"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "tag_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "asset_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Asset untagged"
          }
        }
      }
    },
    "/api/libraries/{library_id}/tags/move": {
      "post": {
        "summary": "Move tag(s) and/or loose asset(s) to another library",
        "tags": [
          "Libraries",
          "Tags"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tagIds": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "looseAssets": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "assetId": {
                          "type": "string"
                        },
                        "fromTagId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "assetId",
                        "fromTagId"
                      ]
                    }
                  },
                  "targetLibraryId": {
                    "type": "string"
                  },
                  "targetParentTagId": {
                    "type": "string"
                  }
                },
                "required": [
                  "targetLibraryId",
                  "targetParentTagId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Moved"
          }
        }
      }
    },
    "/api/libraries/{library_id}/tags/{tag_id}": {
      "post": {
        "summary": "Create tag",
        "tags": [
          "Libraries",
          "Tags"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "tag_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Tag created"
          }
        }
      },
      "delete": {
        "summary": "Delete tag",
        "tags": [
          "Libraries",
          "Tags"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "tag_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Tag deleted"
          }
        }
      },
      "patch": {
        "summary": "Rename tag",
        "tags": [
          "Libraries",
          "Tags"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "tag_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                },
                "required": [
                  "label"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tag renamed"
          }
        }
      }
    },
    "/api/libraries/by-type/{assetType}": {
      "get": {
        "summary": "List libraries by asset type",
        "tags": [
          "Libraries"
        ],
        "description": "Lists the libraries of `assetType` the caller can see, sorted by name: their own, shared ones and Figurement's system libraries. `access` tells which the caller can edit; `GET /api/libraries/by-type/scene` finds the libraries that hold your scenes.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "assetType",
            "schema": {
              "type": "string",
              "enum": [
                "material",
                "color",
                "environment",
                "scene",
                "render",
                "texture"
              ]
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The libraries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "asset_type": {
                        "type": "string",
                        "enum": [
                          "material",
                          "color",
                          "environment",
                          "scene",
                          "render",
                          "texture"
                        ]
                      },
                      "owner_user_id": {
                        "type": "string"
                      },
                      "tags": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "assets": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "children": {
                            "$ref": "#/components/schemas/__schema2"
                          },
                          "so": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "label",
                          "assets",
                          "children"
                        ],
                        "additionalProperties": false,
                        "description": "The library's tag tree; its root has the library's id"
                      },
                      "created_at": {
                        "type": "string"
                      },
                      "updated_at": {
                        "type": "string"
                      },
                      "access": {
                        "anyOf": [
                          {
                            "type": "string",
                            "const": "can view"
                          },
                          {
                            "type": "string",
                            "const": "can edit"
                          },
                          {
                            "type": "string",
                            "const": "no access"
                          }
                        ],
                        "description": "The caller's access to the library"
                      },
                      "owner_name": {
                        "description": "The owner's name, when the caller is not the owner",
                        "type": "string"
                      },
                      "has_shares": {
                        "type": "boolean"
                      },
                      "link_only": {
                        "type": "boolean",
                        "description": "Whether the caller sees the library only through a link share"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "asset_type",
                      "owner_user_id",
                      "tags",
                      "created_at",
                      "updated_at",
                      "access",
                      "has_shares",
                      "link_only"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "404": {
            "description": "Unknown asset type"
          }
        }
      }
    },
    "/api/libraries/{library_id}/shares/{id}": {
      "delete": {
        "summary": "Remove library share",
        "tags": [
          "Libraries",
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Share removed"
          }
        }
      },
      "patch": {
        "summary": "Update library share",
        "tags": [
          "Libraries",
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "access": {
                    "type": "string"
                  }
                },
                "required": [
                  "access"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Share updated"
          }
        }
      }
    },
    "/api/libraries/{library_id}/shares": {
      "get": {
        "summary": "List library shares",
        "tags": [
          "Libraries",
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Share list"
          }
        }
      },
      "post": {
        "summary": "Share library",
        "tags": [
          "Libraries",
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "library_id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "access": {
                    "type": "string"
                  },
                  "user_id": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "team_id": {
                    "type": "string"
                  },
                  "notify": {
                    "type": "boolean"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "access"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Share created"
          }
        }
      }
    },
    "/api/libraries/import": {
      "post": {
        "summary": "Import library",
        "tags": [
          "Libraries"
        ],
        "responses": {
          "201": {
            "description": "Library imported"
          }
        }
      }
    },
    "/api/libraries/{id}": {
      "get": {
        "summary": "Get library",
        "tags": [
          "Libraries"
        ],
        "description": "Returns a library with its tag tree and the caller's `access`. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The library",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "asset_type": {
                      "type": "string",
                      "enum": [
                        "material",
                        "color",
                        "environment",
                        "scene",
                        "render",
                        "texture"
                      ]
                    },
                    "owner_user_id": {
                      "type": "string"
                    },
                    "tags": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "assets": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "children": {
                          "$ref": "#/components/schemas/__schema2"
                        },
                        "so": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "assets",
                        "children"
                      ],
                      "additionalProperties": false,
                      "description": "The library's tag tree; its root has the library's id"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "access": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "can view"
                        },
                        {
                          "type": "string",
                          "const": "can edit"
                        },
                        {
                          "type": "string",
                          "const": "no access"
                        }
                      ],
                      "description": "The caller's access to the library"
                    },
                    "owner_name": {
                      "description": "The owner's name, when the caller is not the owner",
                      "type": "string"
                    },
                    "has_shares": {
                      "type": "boolean"
                    },
                    "link_only": {
                      "type": "boolean",
                      "description": "Whether the caller sees the library only through a link share"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "asset_type",
                    "owner_user_id",
                    "tags",
                    "created_at",
                    "updated_at",
                    "access",
                    "has_shares",
                    "link_only"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "No access to the library, or not signed in"
          },
          "404": {
            "description": "No library with this id"
          }
        }
      },
      "patch": {
        "summary": "Update library",
        "tags": [
          "Libraries"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "tags": {
                    "$ref": "#/components/schemas/__schema0"
                  },
                  "owner": {
                    "type": "string"
                  },
                  "keepEditAccess": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Library updated"
          }
        }
      },
      "delete": {
        "summary": "Delete library",
        "tags": [
          "Libraries"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "Library deleted"
          }
        }
      }
    },
    "/api/libraries/{id}/export": {
      "get": {
        "summary": "Export library",
        "tags": [
          "Libraries"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Library export"
          }
        }
      },
      "post": {
        "summary": "Export library",
        "tags": [
          "Libraries"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Library export"
          }
        }
      }
    },
    "/api/libraries": {
      "get": {
        "summary": "List libraries",
        "tags": [
          "Libraries"
        ],
        "description": "Lists the libraries the caller owns or that are shared with them, their team or their organization's domain, plus every library shared with everyone or with everyone with the link. Without sign-in it lists only the latter.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The libraries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "asset_type": {
                        "type": "string",
                        "enum": [
                          "material",
                          "color",
                          "environment",
                          "scene",
                          "render",
                          "texture"
                        ]
                      },
                      "owner_user_id": {
                        "type": "string"
                      },
                      "tags": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "assets": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "children": {
                            "$ref": "#/components/schemas/__schema2"
                          },
                          "so": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "label",
                          "assets",
                          "children"
                        ],
                        "additionalProperties": false,
                        "description": "The library's tag tree; its root has the library's id"
                      },
                      "created_at": {
                        "type": "string"
                      },
                      "updated_at": {
                        "type": "string"
                      },
                      "access": {
                        "anyOf": [
                          {
                            "type": "string",
                            "const": "can view"
                          },
                          {
                            "type": "string",
                            "const": "can edit"
                          },
                          {
                            "type": "string",
                            "const": "no access"
                          }
                        ],
                        "description": "The caller's access to the library"
                      },
                      "owner_name": {
                        "description": "The owner's name, when the caller is not the owner",
                        "type": "string"
                      },
                      "has_shares": {
                        "type": "boolean"
                      },
                      "link_only": {
                        "type": "boolean",
                        "description": "Whether the caller sees the library only through a link share"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "asset_type",
                      "owner_user_id",
                      "tags",
                      "created_at",
                      "updated_at",
                      "access",
                      "has_shares",
                      "link_only"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create library",
        "tags": [
          "Libraries"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "assetType": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "assetType"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Library created"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/{id}/metadata": {
      "get": {
        "summary": "Get asset metadata",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata"
          }
        }
      },
      "put": {
        "summary": "Set asset metadata",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Metadata saved"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/of-type/scene": {
      "post": {
        "summary": "Create scene",
        "tags": [
          "Scenes"
        ],
        "description": "Creates an empty scene named `name` and returns its descriptor. `POST /api/scenes` puts it in the first scene library the caller can edit, preferring one named \"Scenes\" and creating one if there is none; `POST /api/libraries/{libraryId}/assets/of-type/scene` puts it in that library. Counts against the plan's scene limit.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "blobDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "thumbnailVersion": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "isTemporary": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new scene",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "thumbnail": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "material",
                        "color",
                        "environment",
                        "scene",
                        "render",
                        "texture"
                      ]
                    },
                    "modified": {
                      "type": "number"
                    },
                    "metadata": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "access": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "can view"
                        },
                        {
                          "type": "string",
                          "const": "can edit"
                        },
                        {
                          "type": "string",
                          "const": "no access"
                        }
                      ]
                    },
                    "libraryId": {
                      "type": "string"
                    },
                    "ownerUserId": {
                      "type": "string"
                    },
                    "blobDigest": {
                      "type": "string"
                    },
                    "derivedFrom": {
                      "type": "string"
                    },
                    "distance": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "thumbnail",
                    "type",
                    "modified",
                    "metadata",
                    "access",
                    "libraryId",
                    "ownerUserId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "`name` is missing, or the library does not exist (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "No subscription, the scene limit is reached, or no edit access to the library"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/of-type/{type}": {
      "get": {
        "summary": "List assets by type",
        "tags": [
          "Assets"
        ],
        "description": "Lists the assets of `type` in library `libraryId`, without pagination; needs view access to the library. `q` ranks them by relevance to a search text and drops those that do not match, and every other query parameter keeps only assets whose metadata has exactly that value. `/api/assets/of-type/{type}` names no library and always responds 404: to list your scenes, find your scene libraries with `GET /api/libraries/by-type/scene` and list each one here.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "material",
                "color",
                "environment",
                "scene",
                "render",
                "texture"
              ]
            },
            "required": true
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "description": "Search text; results are ranked and may carry a `distance`",
              "type": "string"
            },
            "description": "Search text; results are ranked and may carry a `distance`"
          }
        ],
        "responses": {
          "200": {
            "description": "The assets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "const": "color"
                          },
                          "swatch": {
                            "type": "string"
                          },
                          "xyz": {
                            "type": "array",
                            "prefixItems": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              }
                            ],
                            "items": false,
                            "minItems": 3,
                            "maxItems": 3
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type",
                          "swatch",
                          "xyz"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "material",
                              "environment",
                              "scene",
                              "render",
                              "texture"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              }
            }
          },
          "403": {
            "description": "No access to the library"
          },
          "404": {
            "description": "No library with this id, or an unknown asset type"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/{id}/contents": {
      "get": {
        "summary": "Get asset contents",
        "tags": [
          "Assets"
        ],
        "description": "Returns the asset's data, as opposed to its descriptor: a material or environment with its `textures`, a color, or a texture. Scenes and renders return `{}`; read a scene with `GET /api/scenes/{sceneId}/json`. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The asset data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {},
                  "description": "The asset's data; its shape depends on the asset type. Materials and environments include their `textures`."
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the asset is not public (empty body)"
          },
          "403": {
            "description": "No access to the asset"
          },
          "404": {
            "description": "No asset with this id, it is in another library, or its data cannot be read"
          }
        }
      },
      "put": {
        "summary": "Upload asset contents",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contents stored"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/bulk": {
      "post": {
        "summary": "Bulk asset operation",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Bulk operation complete"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/{id}": {
      "get": {
        "summary": "Get asset",
        "tags": [
          "Assets"
        ],
        "description": "Returns an asset's descriptor: its name, type, thumbnail link, metadata, library and the caller's `access`; for a render it includes `blobDigest`, the finished image. Needs view access, which an asset shared with everyone with the link gives without signing in. Under `/api/libraries/{libraryId}/assets/{id}` the asset must be in that library.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The asset descriptor",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "thumbnail": {
                          "type": "string"
                        },
                        "modified": {
                          "type": "number"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "access": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "can view"
                            },
                            {
                              "type": "string",
                              "const": "can edit"
                            },
                            {
                              "type": "string",
                              "const": "no access"
                            }
                          ]
                        },
                        "libraryId": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "blobDigest": {
                          "type": "string"
                        },
                        "derivedFrom": {
                          "type": "string"
                        },
                        "distance": {
                          "type": "number"
                        },
                        "type": {
                          "type": "string",
                          "const": "color"
                        },
                        "swatch": {
                          "type": "string"
                        },
                        "xyz": {
                          "type": "array",
                          "prefixItems": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            }
                          ],
                          "items": false,
                          "minItems": 3,
                          "maxItems": 3
                        },
                        "canBrowseLibrary": {
                          "type": "boolean",
                          "description": "Whether the caller can open the library the asset is in"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "thumbnail",
                        "modified",
                        "metadata",
                        "access",
                        "libraryId",
                        "ownerUserId",
                        "type",
                        "swatch",
                        "xyz",
                        "canBrowseLibrary"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "thumbnail": {
                          "type": "string"
                        },
                        "modified": {
                          "type": "number"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "access": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "can view"
                            },
                            {
                              "type": "string",
                              "const": "can edit"
                            },
                            {
                              "type": "string",
                              "const": "no access"
                            }
                          ]
                        },
                        "libraryId": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "blobDigest": {
                          "type": "string"
                        },
                        "derivedFrom": {
                          "type": "string"
                        },
                        "distance": {
                          "type": "number"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "material",
                            "environment",
                            "scene",
                            "render",
                            "texture"
                          ]
                        },
                        "canBrowseLibrary": {
                          "type": "boolean",
                          "description": "Whether the caller can open the library the asset is in"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "thumbnail",
                        "modified",
                        "metadata",
                        "access",
                        "libraryId",
                        "ownerUserId",
                        "type",
                        "canBrowseLibrary"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the asset is not public (empty body)"
          },
          "403": {
            "description": "No access to the asset"
          },
          "404": {
            "description": "No asset with this id, or it is in another library"
          }
        }
      },
      "delete": {
        "summary": "Delete asset",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "Asset deleted"
          }
        }
      },
      "patch": {
        "summary": "Update asset",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "library_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Asset updated"
          }
        }
      },
      "put": {
        "summary": "Replace asset",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "blobDigest": {
                    "type": "string"
                  },
                  "derivedFrom": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Asset replaced"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/{id}/thumbnail": {
      "get": {
        "summary": "Get asset thumbnail",
        "tags": [
          "Assets"
        ],
        "description": "Returns the asset's thumbnail, usually as a 302 redirect to `/api/blobs/{digest}/thumbnail`; a scene or material without one gets a default image. While a render or a material thumbnail is still being made it responds 222 with the progress (0 to 1) in the `X-Progress` header. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The default thumbnail",
            "content": {
              "image/avif": {}
            }
          },
          "222": {
            "description": "Not ready yet; progress in the `X-Progress` header (plain text body)"
          },
          "302": {
            "description": "Redirect to the thumbnail's blob"
          },
          "401": {
            "description": "Not signed in, and the asset is not public (empty body)"
          },
          "403": {
            "description": "No access to the asset"
          },
          "404": {
            "description": "No asset with this id, it is in another library, or it has no thumbnail"
          }
        }
      },
      "put": {
        "summary": "Upload asset thumbnail",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Thumbnail stored"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/material-thumbnails/rerender": {
      "post": {
        "summary": "Re-render material thumbnails",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Thumbnails queued"
          }
        }
      }
    },
    "/api/libraries/{libraryId}/assets/": {
      "get": {
        "summary": "List assets",
        "tags": [
          "Assets"
        ],
        "description": "Lists every asset in library `libraryId` (of the library's asset type), least recently changed first, without pagination. Each query parameter keeps only assets whose metadata has exactly that value. Needs view access to the library; `/api/assets/` names no library and always responds 404.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The assets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "const": "color"
                          },
                          "swatch": {
                            "type": "string"
                          },
                          "xyz": {
                            "type": "array",
                            "prefixItems": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              }
                            ],
                            "items": false,
                            "minItems": 3,
                            "maxItems": 3
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type",
                          "swatch",
                          "xyz"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "material",
                              "environment",
                              "scene",
                              "render",
                              "texture"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              }
            }
          },
          "403": {
            "description": "No access to the library"
          },
          "404": {
            "description": "No library with this id"
          }
        }
      },
      "post": {
        "summary": "Create asset",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "libraryId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "blobDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "thumbnailVersion": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "isTemporary": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Asset created"
          }
        }
      }
    },
    "/api/assets/{id}/metadata": {
      "get": {
        "summary": "Get asset metadata",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata"
          }
        }
      },
      "put": {
        "summary": "Set asset metadata",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Metadata saved"
          }
        }
      }
    },
    "/api/assets/of-type/{type}": {
      "get": {
        "summary": "List assets by type",
        "tags": [
          "Assets"
        ],
        "description": "Lists the assets of `type` in library `libraryId`, without pagination; needs view access to the library. `q` ranks them by relevance to a search text and drops those that do not match, and every other query parameter keeps only assets whose metadata has exactly that value. `/api/assets/of-type/{type}` names no library and always responds 404: to list your scenes, find your scene libraries with `GET /api/libraries/by-type/scene` and list each one here.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "material",
                "color",
                "environment",
                "scene",
                "render",
                "texture"
              ]
            },
            "required": true
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "description": "Search text; results are ranked and may carry a `distance`",
              "type": "string"
            },
            "description": "Search text; results are ranked and may carry a `distance`"
          }
        ],
        "responses": {
          "200": {
            "description": "The assets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "const": "color"
                          },
                          "swatch": {
                            "type": "string"
                          },
                          "xyz": {
                            "type": "array",
                            "prefixItems": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              }
                            ],
                            "items": false,
                            "minItems": 3,
                            "maxItems": 3
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type",
                          "swatch",
                          "xyz"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "material",
                              "environment",
                              "scene",
                              "render",
                              "texture"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              }
            }
          },
          "403": {
            "description": "No access to the library"
          },
          "404": {
            "description": "No library with this id, or an unknown asset type"
          }
        }
      }
    },
    "/api/assets/update/{id}": {
      "post": {
        "summary": "Update asset from ZIP",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Asset updated"
          }
        }
      }
    },
    "/api/assets/{id}/contents": {
      "get": {
        "summary": "Get asset contents",
        "tags": [
          "Assets"
        ],
        "description": "Returns the asset's data, as opposed to its descriptor: a material or environment with its `textures`, a color, or a texture. Scenes and renders return `{}`; read a scene with `GET /api/scenes/{sceneId}/json`. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The asset data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {},
                  "description": "The asset's data; its shape depends on the asset type. Materials and environments include their `textures`."
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the asset is not public (empty body)"
          },
          "403": {
            "description": "No access to the asset"
          },
          "404": {
            "description": "No asset with this id, it is in another library, or its data cannot be read"
          }
        }
      },
      "put": {
        "summary": "Upload asset contents",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contents stored"
          }
        }
      }
    },
    "/api/assets/{id}": {
      "get": {
        "summary": "Get asset",
        "tags": [
          "Assets"
        ],
        "description": "Returns an asset's descriptor: its name, type, thumbnail link, metadata, library and the caller's `access`; for a render it includes `blobDigest`, the finished image. Needs view access, which an asset shared with everyone with the link gives without signing in. Under `/api/libraries/{libraryId}/assets/{id}` the asset must be in that library.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The asset descriptor",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "thumbnail": {
                          "type": "string"
                        },
                        "modified": {
                          "type": "number"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "access": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "can view"
                            },
                            {
                              "type": "string",
                              "const": "can edit"
                            },
                            {
                              "type": "string",
                              "const": "no access"
                            }
                          ]
                        },
                        "libraryId": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "blobDigest": {
                          "type": "string"
                        },
                        "derivedFrom": {
                          "type": "string"
                        },
                        "distance": {
                          "type": "number"
                        },
                        "type": {
                          "type": "string",
                          "const": "color"
                        },
                        "swatch": {
                          "type": "string"
                        },
                        "xyz": {
                          "type": "array",
                          "prefixItems": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "number"
                            }
                          ],
                          "items": false,
                          "minItems": 3,
                          "maxItems": 3
                        },
                        "canBrowseLibrary": {
                          "type": "boolean",
                          "description": "Whether the caller can open the library the asset is in"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "thumbnail",
                        "modified",
                        "metadata",
                        "access",
                        "libraryId",
                        "ownerUserId",
                        "type",
                        "swatch",
                        "xyz",
                        "canBrowseLibrary"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "thumbnail": {
                          "type": "string"
                        },
                        "modified": {
                          "type": "number"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "access": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "can view"
                            },
                            {
                              "type": "string",
                              "const": "can edit"
                            },
                            {
                              "type": "string",
                              "const": "no access"
                            }
                          ]
                        },
                        "libraryId": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "blobDigest": {
                          "type": "string"
                        },
                        "derivedFrom": {
                          "type": "string"
                        },
                        "distance": {
                          "type": "number"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "material",
                            "environment",
                            "scene",
                            "render",
                            "texture"
                          ]
                        },
                        "canBrowseLibrary": {
                          "type": "boolean",
                          "description": "Whether the caller can open the library the asset is in"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "thumbnail",
                        "modified",
                        "metadata",
                        "access",
                        "libraryId",
                        "ownerUserId",
                        "type",
                        "canBrowseLibrary"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, and the asset is not public (empty body)"
          },
          "403": {
            "description": "No access to the asset"
          },
          "404": {
            "description": "No asset with this id, or it is in another library"
          }
        }
      },
      "delete": {
        "summary": "Delete asset",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "Asset deleted"
          }
        }
      },
      "patch": {
        "summary": "Update asset",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "library_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Asset updated"
          }
        }
      }
    },
    "/api/assets/{id}/thumbnail": {
      "get": {
        "summary": "Get asset thumbnail",
        "tags": [
          "Assets"
        ],
        "description": "Returns the asset's thumbnail, usually as a 302 redirect to `/api/blobs/{digest}/thumbnail`; a scene or material without one gets a default image. While a render or a material thumbnail is still being made it responds 222 with the progress (0 to 1) in the `X-Progress` header. Needs view access.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The default thumbnail",
            "content": {
              "image/avif": {}
            }
          },
          "222": {
            "description": "Not ready yet; progress in the `X-Progress` header (plain text body)"
          },
          "302": {
            "description": "Redirect to the thumbnail's blob"
          },
          "401": {
            "description": "Not signed in, and the asset is not public (empty body)"
          },
          "403": {
            "description": "No access to the asset"
          },
          "404": {
            "description": "No asset with this id, it is in another library, or it has no thumbnail"
          }
        }
      },
      "put": {
        "summary": "Upload asset thumbnail",
        "tags": [
          "Assets"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Thumbnail stored"
          }
        }
      }
    },
    "/api/assets/": {
      "get": {
        "summary": "List assets",
        "tags": [
          "Assets"
        ],
        "description": "Lists every asset in library `libraryId` (of the library's asset type), least recently changed first, without pagination. Each query parameter keeps only assets whose metadata has exactly that value. Needs view access to the library; `/api/assets/` names no library and always responds 404.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The assets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "const": "color"
                          },
                          "swatch": {
                            "type": "string"
                          },
                          "xyz": {
                            "type": "array",
                            "prefixItems": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "number"
                              }
                            ],
                            "items": false,
                            "minItems": 3,
                            "maxItems": 3
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type",
                          "swatch",
                          "xyz"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "material",
                              "environment",
                              "scene",
                              "render",
                              "texture"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId",
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              }
            }
          },
          "403": {
            "description": "No access to the library"
          },
          "404": {
            "description": "No library with this id"
          }
        }
      }
    },
    "/api/shared-assets/sessions": {
      "get": {
        "summary": "Get sessions for shared assets",
        "tags": [
          "Sharing"
        ],
        "responses": {
          "200": {
            "description": "Active sessions"
          }
        }
      }
    },
    "/api/shared-assets/": {
      "get": {
        "summary": "List shared assets",
        "tags": [
          "Sharing"
        ],
        "responses": {
          "200": {
            "description": "Shared assets"
          }
        }
      }
    },
    "/api/assets/{assetId}/shares": {
      "get": {
        "summary": "List asset shares",
        "tags": [
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "assetId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Share list"
          }
        }
      },
      "post": {
        "summary": "Share asset",
        "tags": [
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "assetId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "access": {
                    "type": "string"
                  },
                  "user_id": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "team_id": {
                    "type": "string"
                  },
                  "notify": {
                    "type": "boolean"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "access"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Share created"
          }
        }
      }
    },
    "/api/assets/{assetId}/shares/{id}": {
      "patch": {
        "summary": "Update asset share",
        "tags": [
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "assetId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "access": {
                    "type": "string"
                  }
                },
                "required": [
                  "access"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Share updated"
          }
        }
      },
      "delete": {
        "summary": "Remove asset share",
        "tags": [
          "Sharing"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "assetId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Share removed"
          }
        }
      }
    },
    "/api/blobs/{digest}": {
      "get": {
        "summary": "Download a stored file, such as a render image",
        "tags": [
          "Blob Storage"
        ],
        "description": "Downloads the raw bytes of a stored blob by its `digest` (64 hex characters), such as a render's image (the `blobDigest` of its render asset) or an image from the AI endpoints. Needs no sign-in: the digest is the credential. Images get their own `Content-Type`, MP4 videos `video/mp4`, anything else `application/octet-stream`.",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "digest",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The raw blob bytes.",
            "content": {
              "application/octet-stream": {}
            }
          },
          "404": {
            "description": "No blob exists for that digest (empty body)."
          }
        }
      }
    },
    "/api/blobs/{digest}/head": {
      "get": {
        "summary": "Check blob existence / get metadata",
        "tags": [
          "Blob Storage"
        ],
        "description": "Returns metadata for a stored blob (size, kind, and — for images — mime type and dimensions) without downloading its bytes. Responds 404 if the digest is unknown, so it doubles as an existence check.",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "digest",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata for the stored blob.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "description": "High-level classification of the blob, e.g. \"image\"."
                    },
                    "sizeInBytes": {
                      "type": "number",
                      "description": "Size of the stored blob in bytes."
                    },
                    "mimeType": {
                      "description": "Detected MIME type, when the blob is an image.",
                      "type": "string"
                    },
                    "width": {
                      "description": "Image width in pixels, when applicable.",
                      "type": "number"
                    },
                    "height": {
                      "description": "Image height in pixels, when applicable.",
                      "type": "number"
                    }
                  },
                  "required": [
                    "kind",
                    "sizeInBytes"
                  ],
                  "additionalProperties": false,
                  "description": "Metadata about a stored blob. Extra fields may be present depending on the blob kind."
                }
              }
            }
          },
          "404": {
            "description": "No blob exists for that digest."
          }
        }
      }
    },
    "/api/blobs": {
      "post": {
        "summary": "Upload an image (auto-digest)",
        "tags": [
          "Blob Storage"
        ],
        "description": "Uploads raw bytes and returns the `digest` the server computed for them. **This is the recommended starting point for the AI endpoints:** upload your image here, then pass the returned `digest` to endpoints such as `POST /api/ai/img-to-img/{digest}` or in the JSON body of `POST /api/ai/mix-images`.\n\nSend the raw image bytes as the request body (e.g. `Content-Type: image/png`).\n\n**Example**\n\n```\nPOST /api/blobs\nContent-Type: image/png\n<binary image bytes>\n\n→ 201 { \"digest\": \"b3f1c2…\" }\n```",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "The blob was stored; the response contains its digest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "digest": {
                      "type": "string",
                      "description": "Content-addressable digest identifying the stored blob."
                    }
                  },
                  "required": [
                    "digest"
                  ],
                  "additionalProperties": false,
                  "description": "The digest under which the uploaded blob is now stored."
                }
              }
            }
          },
          "400": {
            "description": "Missing request body."
          },
          "401": {
            "description": "Not authenticated."
          }
        }
      }
    },
    "/api/blobs/{digest}/thumbnail": {
      "get": {
        "summary": "Get blob thumbnail",
        "tags": [
          "Blob Storage"
        ],
        "description": "Returns an AVIF thumbnail, at most 512 by 512 pixels, of an image blob; it is made on the first request and cached. Needs no sign-in.",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "digest",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The thumbnail",
            "content": {
              "image/avif": {}
            }
          },
          "404": {
            "description": "No blob exists for that digest"
          }
        }
      }
    },
    "/api/blobs/bundles": {
      "post": {
        "summary": "Upload blob bundle",
        "tags": [
          "Blob Storage"
        ],
        "responses": {
          "201": {
            "description": "Bundle stored"
          }
        }
      }
    },
    "/api/blobs/bundles/{digest}": {
      "get": {
        "summary": "Get blob bundle",
        "tags": [
          "Blob Storage"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "digest",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Bundle data"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/render-jobs/{id}/status": {
      "get": {
        "summary": "Check whether a render has finished",
        "tags": [
          "Rendering"
        ],
        "description": "Returns a render job's status (`pending`, `running`, or finished: `completed`, `failed` or `cancelled`) and its progress (0 to 1). It does not carry the image: once `completed`, `GET /api/assets/{id}` with the same id gives the render asset, whose `blobDigest` `GET /api/blobs/{digest}` downloads.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "include",
            "schema": {
              "description": "`origin` adds the camera, variant and environment the render was made from, for a render the caller can see. Left out by default because it costs database reads on every poll.",
              "type": "string",
              "enum": [
                "origin"
              ]
            },
            "description": "`origin` adds the camera, variant and environment the render was made from, for a render the caller can see. Left out by default because it costs database reads on every poll."
          }
        ],
        "responses": {
          "200": {
            "description": "The job status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "renderId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "running",
                        "completed",
                        "failed",
                        "cancelled"
                      ]
                    },
                    "progress": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "cameraId": {
                      "description": "The camera the render was made from.",
                      "type": "string"
                    },
                    "variantId": {
                      "description": "The variant the render shows.",
                      "type": "string"
                    },
                    "environmentId": {
                      "description": "The environment the render was made with.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "renderId",
                    "status",
                    "progress"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Not a render id, or `include` is not `origin` (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "404": {
            "description": "No render job with this id"
          }
        }
      }
    },
    "/api/render-jobs": {
      "post": {
        "summary": "Render images of a scene",
        "tags": [
          "Rendering"
        ],
        "description": "Queues one cloud render per entry in `images`, of saved version `version` of scene `sceneId` (see `GET /api/scenes/{sceneId}/history`), and adds each result as a render asset to `libraryId`, a render library the caller can edit (`GET /api/libraries/by-type/render`). Uses the plan's render credits; follow each render id with `GET /api/render-jobs/{id}/status`.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sceneId": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "libraryId": {
                    "type": "string"
                  },
                  "tag": {
                    "type": "string"
                  },
                  "images": {
                    "maxItems": 3000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "width": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "height": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "triangles": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "cameraId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "camera": {
                          "type": "object",
                          "properties": {
                            "origin": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                },
                                "z": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "x",
                                "y",
                                "z"
                              ]
                            },
                            "target": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                },
                                "z": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "x",
                                "y",
                                "z"
                              ]
                            },
                            "fieldOfView": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                },
                                "z": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "x",
                                "y",
                                "z"
                              ]
                            }
                          },
                          "required": [
                            "origin",
                            "target",
                            "fieldOfView"
                          ]
                        },
                        "sceneTime": {
                          "type": "number",
                          "minimum": 0
                        },
                        "environmentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "configurationId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "max_samples": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "tolerance": {
                          "type": "number"
                        },
                        "backgroundType": {
                          "type": "string",
                          "enum": [
                            "color",
                            "environment",
                            "transparent",
                            "image"
                          ]
                        },
                        "backgroundColor": {
                          "type": "string",
                          "pattern": "^#?([0-9a-fA-F]{6})$"
                        },
                        "backgroundImage": {
                          "type": "string"
                        },
                        "groundShadow": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "enum": [
                                "environment",
                                "ambient"
                              ]
                            },
                            "color": {
                              "type": "string",
                              "pattern": "^#?([0-9a-fA-F]{6})$"
                            },
                            "intensity": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "spread": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            }
                          },
                          "required": [
                            "mode",
                            "color",
                            "intensity",
                            "spread"
                          ]
                        },
                        "style": {
                          "type": "string",
                          "enum": [
                            "photo",
                            "flat",
                            "raster",
                            "wireframe"
                          ]
                        },
                        "denoiseStrength": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "bloom": {
                          "type": "number",
                          "minimum": 0
                        },
                        "bloomSpread": {
                          "type": "number",
                          "minimum": 0.5,
                          "maximum": 8
                        },
                        "viewTransform": {
                          "type": "string",
                          "enum": [
                            "none",
                            "pbrNeutral",
                            "agx"
                          ]
                        },
                        "viewExposure": {
                          "type": "number",
                          "minimum": -8,
                          "maximum": 8
                        },
                        "imageAdjustments": {
                          "type": "object",
                          "properties": {
                            "contrast": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "highlights": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "shadows": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "whites": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "blacks": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "temperature": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "tint": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "vibrance": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "saturation": {
                              "type": "number",
                              "minimum": -1,
                              "maximum": 1
                            },
                            "vignette": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "vignetteColor": {
                              "type": "array",
                              "prefixItems": [
                                {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 100
                                },
                                {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 100
                                },
                                {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 100
                                }
                              ],
                              "items": false,
                              "minItems": 3,
                              "maxItems": 3
                            },
                            "vignetteSize": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "vignetteSoftness": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "bloomThreshold": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 10
                            }
                          }
                        },
                        "subtreeNodeId": {
                          "type": "string"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "name",
                        "width",
                        "height",
                        "cameraId",
                        "environmentId",
                        "configurationId",
                        "max_samples",
                        "backgroundType",
                        "style",
                        "metadata"
                      ]
                    }
                  },
                  "outputMode": {
                    "type": "string",
                    "enum": [
                      "frames",
                      "video"
                    ]
                  }
                },
                "required": [
                  "sceneId",
                  "version",
                  "libraryId",
                  "images"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The renders were queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "renderIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "One per queued image; each is also the id of its render asset"
                    },
                    "assets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "thumbnail": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "material",
                              "color",
                              "environment",
                              "scene",
                              "render",
                              "texture"
                            ]
                          },
                          "modified": {
                            "type": "number"
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "access": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "can view"
                              },
                              {
                                "type": "string",
                                "const": "can edit"
                              },
                              {
                                "type": "string",
                                "const": "no access"
                              }
                            ]
                          },
                          "libraryId": {
                            "type": "string"
                          },
                          "ownerUserId": {
                            "type": "string"
                          },
                          "blobDigest": {
                            "type": "string"
                          },
                          "derivedFrom": {
                            "type": "string"
                          },
                          "distance": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "thumbnail",
                          "type",
                          "modified",
                          "metadata",
                          "access",
                          "libraryId",
                          "ownerUserId"
                        ],
                        "additionalProperties": false
                      },
                      "description": "The render assets, which get `blobDigest` once rendered"
                    },
                    "videoAsset": {
                      "description": "With `outputMode: \"video\"`: the asset that gets the MP4",
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "thumbnail": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "material",
                            "color",
                            "environment",
                            "scene",
                            "render",
                            "texture"
                          ]
                        },
                        "modified": {
                          "type": "number"
                        },
                        "metadata": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "access": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "can view"
                            },
                            {
                              "type": "string",
                              "const": "can edit"
                            },
                            {
                              "type": "string",
                              "const": "no access"
                            }
                          ]
                        },
                        "libraryId": {
                          "type": "string"
                        },
                        "ownerUserId": {
                          "type": "string"
                        },
                        "blobDigest": {
                          "type": "string"
                        },
                        "derivedFrom": {
                          "type": "string"
                        },
                        "distance": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "thumbnail",
                        "type",
                        "modified",
                        "metadata",
                        "access",
                        "libraryId",
                        "ownerUserId"
                      ],
                      "additionalProperties": false
                    },
                    "videoGroupId": {
                      "description": "With `outputMode: \"video\"`: the group tracking the frames",
                      "type": "string"
                    }
                  },
                  "required": [
                    "renderIds",
                    "assets"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or the library does not exist or is not a render library (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "No subscription, render limit reached, no access to the scene or no edit access to the library"
          },
          "404": {
            "description": "No scene with this id"
          },
          "429": {
            "description": "More than 25 still-image renders would be running at once"
          },
          "502": {
            "description": "With `outputMode: \"video\"`, some frames could not be queued; no video is made"
          }
        }
      }
    },
    "/api/video-render-groups/{id}/status": {
      "get": {
        "summary": "Get video render group status",
        "tags": [
          "Rendering"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Group status"
          }
        }
      }
    },
    "/api/video-encode": {
      "post": {
        "summary": "Encode pre-rendered frames into MP4 video",
        "tags": [
          "Rendering"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "frameDigests": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "fps": {
                    "type": "number",
                    "minimum": 1,
                    "maximum": 120
                  },
                  "name": {
                    "type": "string"
                  },
                  "libraryId": {
                    "type": "string"
                  },
                  "tagId": {
                    "type": "string"
                  },
                  "sceneId": {
                    "type": "string"
                  }
                },
                "required": [
                  "frameDigests",
                  "fps",
                  "libraryId",
                  "tagId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Video encoding started"
          }
        }
      }
    },
    "/api/contact-sales": {
      "post": {
        "summary": "Contact Figurement",
        "tags": [
          "Support"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {
                    "default": "sales",
                    "type": "string",
                    "enum": [
                      "sales",
                      "feedback"
                    ]
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1
                  },
                  "company": {
                    "type": "string",
                    "minLength": 1
                  },
                  "phone": {
                    "type": "string",
                    "minLength": 1
                  },
                  "userId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sceneId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sceneUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "screenshotUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "pageUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "userAgent": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "email",
                  "message"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message sent",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "success"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/api/student-applications": {
      "post": {
        "summary": "Submit a student plan application",
        "tags": [
          "Student"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fullName": {
                    "type": "string",
                    "minLength": 1
                  },
                  "eduEmail": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "school": {
                    "type": "string",
                    "minLength": 1
                  },
                  "schoolWebsite": {
                    "type": "string",
                    "format": "uri"
                  },
                  "country": {
                    "type": "string",
                    "minLength": 1
                  },
                  "courseName": {
                    "type": "string",
                    "minLength": 1
                  },
                  "courseLink": {
                    "type": "string",
                    "format": "uri"
                  },
                  "professorName": {
                    "type": "string",
                    "minLength": 1
                  },
                  "linkedinUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "graduationYear": {
                    "type": "string",
                    "pattern": "^\\d{4}$"
                  },
                  "message": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8
                  }
                },
                "required": [
                  "fullName",
                  "eduEmail",
                  "school",
                  "schoolWebsite",
                  "country",
                  "courseName",
                  "courseLink",
                  "professorName",
                  "linkedinUrl",
                  "graduationYear"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Application submitted"
          }
        }
      }
    },
    "/api/webhooks": {
      "get": {
        "summary": "List webhooks for current user",
        "tags": [
          "Webhooks"
        ],
        "description": "Lists the caller's webhooks, oldest first.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "user_id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      },
                      "trigger": {
                        "type": "string",
                        "enum": [
                          "manual",
                          "user.login",
                          "user.logout"
                        ]
                      },
                      "created_at": {
                        "type": "string"
                      },
                      "updated_at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "user_id",
                      "name",
                      "url",
                      "trigger",
                      "created_at",
                      "updated_at"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot use webhooks (plain text)"
          }
        }
      },
      "post": {
        "summary": "Create webhook",
        "tags": [
          "Webhooks"
        ],
        "description": "Registers a URL that Figurement POSTs a JSON payload (`event`, `webhookName`, `userId`, `timestamp`, and `sceneId` and `version` when given) to when `trigger` happens: `user.login` or `user.logout` of the caller, or `manual`, only through `POST /api/webhooks/{id}/trigger`.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "trigger": {
                    "default": "manual",
                    "type": "string",
                    "enum": [
                      "manual",
                      "user.login",
                      "user.logout"
                    ]
                  }
                },
                "required": [
                  "name",
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "format": "uri"
                    },
                    "trigger": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "user.login",
                        "user.logout"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "user_id",
                    "name",
                    "url",
                    "trigger",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot use webhooks (plain text)"
          }
        }
      }
    },
    "/api/webhooks/{id}": {
      "patch": {
        "summary": "Update webhook",
        "tags": [
          "Webhooks"
        ],
        "description": "Changes a webhook's name, URL or trigger; fields left out keep their value.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "trigger": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "user.login",
                      "user.logout"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "format": "uri"
                    },
                    "trigger": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "user.login",
                        "user.logout"
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "user_id",
                    "name",
                    "url",
                    "trigger",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot use webhooks (plain text)"
          },
          "404": {
            "description": "No webhook with this id among the caller's"
          }
        }
      },
      "delete": {
        "summary": "Delete webhook",
        "tags": [
          "Webhooks"
        ],
        "description": "Deletes one of the caller's webhooks. Responds 200 also when there is no such webhook.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook deleted (empty body)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot use webhooks (plain text)"
          }
        }
      }
    },
    "/api/webhooks/{id}/trigger": {
      "post": {
        "summary": "Trigger a webhook manually",
        "tags": [
          "Webhooks"
        ],
        "description": "Calls the webhook now with event `manual` and the given `sceneId` and `version`, whatever its trigger, and reports how its URL answered.",
        "security": [
          {
            "cookieAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sceneId": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "sceneId",
                  "version"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "How the webhook URL answered",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "Whether the webhook URL answered with a 2xx status"
                    },
                    "status": {
                      "description": "The status the webhook URL answered with",
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "error": {
                      "description": "Why the call failed, when the URL could not be reached",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (plain text)"
          },
          "401": {
            "description": "Not signed in (empty body)"
          },
          "403": {
            "description": "Guest accounts cannot use webhooks (plain text)"
          },
          "404": {
            "description": "No webhook with this id among the caller's"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "__schema0": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "assets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/__schema0"
            }
          },
          "so": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "label",
          "assets",
          "children"
        ]
      },
      "JsonValue": {
        "$ref": "#/components/schemas/__schema1"
      },
      "__schema1": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/__schema1"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema1"
            }
          }
        ]
      },
      "__schema2": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "label": {
              "type": "string"
            },
            "assets": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "children": {
              "$ref": "#/components/schemas/__schema2"
            },
            "so": {
              "type": "number"
            }
          },
          "required": [
            "id",
            "label",
            "assets",
            "children"
          ],
          "additionalProperties": false
        }
      }
    },
    "securitySchemes": {
      "cookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "token"
      },
      "apiKeyAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "signedLink": {
        "type": "apiKey",
        "in": "query",
        "name": "sig",
        "description": "A signed link from an MCP tool such as export_scene or import_model: the URL carries `uid`, `exp` and `sig`, works for a few minutes, and needs no other credentials."
      }
    }
  }
}