{
  "openapi": "3.1.1",
  "info": {
    "title": "SVG Motion Builder API",
    "version": "1.0.0",
    "summary": "Turn solid SVG artwork into an editable vector animation.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://fliplinesvgmotion.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Turn solid SVG artwork into an editable vector animation.",
        "description": "Animate solid SVG shapes with pulse, reveal, slide or spin presets. Download Lottie JSON, sampled animated SVG and an editable Flipline Motion Desk project with vector layers and keyframes.\n\nMethodology:\n- SVG paths, arcs, rectangles, ellipses, lines, polygons and presentation transforms become cubic vector contours. Artwork and curve handles must fit the viewBox. Solid fill and stroke colors, alpha, compound paths and fill rules are preserved. Unsupported content rejects the whole import.\n- Artwork fits within 80% of the stage and shares a common transform origin. Presets create transform keys, leaving geometry editable. Frames = round(duration × FPS), from 2 to 360. The actual duration is frames / FPS; stages allow 2 million pixels and 24 layers.\n- Lottie exports conventional 2D shape layers and cubic easing. The end frame is exclusive and Lottie layer order is top-first. Animated SVG samples transforms at composition frames using discrete SMIL steps. Preview backgrounds are excluded from exports; author a rectangle layer to include a background.\n- The same bounded engine runs in the editor, API and MCP. Imported SVG is parsed as data; scripts, references and remote assets are never executed or loaded. Project files are the fallback when a generated editor link exceeds 1 million characters.\n\nSupports solid paths and basic shapes. Text, gradients, masks, clipping, effects and external references are rejected. This is an independent workflow inspired by Lottielab.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "flipline_svg_motion",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FliplineSvgMotionInput"
              },
              "examples": {
                "example1": {
                  "summary": "A checkmark with a gentle pulse",
                  "value": {}
                },
                "example2": {
                  "summary": "A rotating blue square",
                  "value": {
                    "svg": "<svg viewBox=\"0 0 200 200\"><rect x=\"30\" y=\"30\" width=\"140\" height=\"140\" rx=\"20\" fill=\"#304f57\"/></svg>",
                    "preset": "spin",
                    "duration": 2,
                    "fps": 24
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FliplineSvgMotionResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "FliplineSvgMotionInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "svg": {
            "title": "SVG source",
            "type": "string",
            "maxLength": 300000,
            "default": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 240 240\"><rect x=\"24\" y=\"24\" width=\"192\" height=\"192\" rx=\"42\" fill=\"#304f57\"/><path d=\"M70 124 L106 158 L174 84\" fill=\"none\" stroke=\"#e9bc75\" stroke-width=\"18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>"
          },
          "preset": {
            "title": "Motion preset",
            "type": "string",
            "enum": [
              "pulse",
              "reveal",
              "slide",
              "spin"
            ],
            "default": "pulse"
          },
          "name": {
            "title": "Motion name",
            "type": "string",
            "maxLength": 120,
            "default": "A moving mark"
          },
          "width": {
            "title": "Stage width (px)",
            "type": "integer",
            "minimum": 16,
            "maximum": 1600,
            "default": 480
          },
          "height": {
            "title": "Stage height (px)",
            "type": "integer",
            "minimum": 16,
            "maximum": 1600,
            "default": 360
          },
          "fps": {
            "title": "Frame rate (FPS)",
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "default": 30
          },
          "duration": {
            "title": "Duration (seconds)",
            "type": "number",
            "minimum": 0.1,
            "maximum": 60,
            "default": 3
          }
        },
        "required": []
      },
      "FliplineSvgMotionResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "project",
              "report",
              "lottie",
              "animatedSvg",
              "frameSvg",
              "projectFile",
              "openInApp"
            ],
            "properties": {
              "project": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "format",
                  "version",
                  "name",
                  "width",
                  "height",
                  "fps",
                  "frames",
                  "loop",
                  "background",
                  "layers"
                ],
                "properties": {
                  "format": {
                    "const": "flipline-motion"
                  },
                  "version": {
                    "const": 1
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "width": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 1600
                  },
                  "height": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 1600
                  },
                  "fps": {
                    "type": "number",
                    "minimum": 1,
                    "maximum": 60
                  },
                  "frames": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 360
                  },
                  "loop": {
                    "type": "boolean"
                  },
                  "background": {
                    "type": "string",
                    "pattern": "^#[a-fA-F0-9]{6}$"
                  },
                  "layers": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 24,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "name",
                        "kind",
                        "width",
                        "height",
                        "radius",
                        "paths",
                        "fill",
                        "stroke",
                        "strokeWidth",
                        "fillOpacity",
                        "strokeOpacity",
                        "fillRule",
                        "cap",
                        "join",
                        "visible",
                        "locked",
                        "start",
                        "end",
                        "keys"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[-A-Za-z0-9_]{1,64}$"
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "kind": {
                          "enum": [
                            "rect",
                            "ellipse",
                            "path"
                          ]
                        },
                        "width": {
                          "type": "number"
                        },
                        "height": {
                          "type": "number"
                        },
                        "radius": {
                          "type": "number"
                        },
                        "paths": {
                          "type": "array",
                          "maxItems": 64,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "v",
                              "i",
                              "o",
                              "closed"
                            ],
                            "properties": {
                              "v": {
                                "type": "array",
                                "minItems": 2,
                                "maxItems": 512,
                                "items": {
                                  "type": "array",
                                  "minItems": 2,
                                  "maxItems": 2,
                                  "items": {
                                    "type": "number"
                                  }
                                }
                              },
                              "i": {
                                "type": "array",
                                "minItems": 2,
                                "maxItems": 512,
                                "items": {
                                  "type": "array",
                                  "minItems": 2,
                                  "maxItems": 2,
                                  "items": {
                                    "type": "number"
                                  }
                                }
                              },
                              "o": {
                                "type": "array",
                                "minItems": 2,
                                "maxItems": 512,
                                "items": {
                                  "type": "array",
                                  "minItems": 2,
                                  "maxItems": 2,
                                  "items": {
                                    "type": "number"
                                  }
                                }
                              },
                              "closed": {
                                "type": "boolean"
                              }
                            }
                          }
                        },
                        "fill": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "stroke": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "strokeWidth": {
                          "type": "number"
                        },
                        "fillOpacity": {
                          "type": "number"
                        },
                        "strokeOpacity": {
                          "type": "number"
                        },
                        "fillRule": {
                          "enum": [
                            "nonzero",
                            "evenodd"
                          ]
                        },
                        "cap": {
                          "enum": [
                            "butt",
                            "round",
                            "square"
                          ]
                        },
                        "join": {
                          "enum": [
                            "miter",
                            "round",
                            "bevel"
                          ]
                        },
                        "visible": {
                          "type": "boolean"
                        },
                        "locked": {
                          "type": "boolean"
                        },
                        "start": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "end": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "keys": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 360,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "frame",
                              "x",
                              "y",
                              "scaleX",
                              "scaleY",
                              "rotation",
                              "opacity",
                              "ease"
                            ],
                            "properties": {
                              "frame": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 359
                              },
                              "x": {
                                "type": "number"
                              },
                              "y": {
                                "type": "number"
                              },
                              "scaleX": {
                                "type": "number"
                              },
                              "scaleY": {
                                "type": "number"
                              },
                              "rotation": {
                                "type": "number"
                              },
                              "opacity": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100
                              },
                              "ease": {
                                "oneOf": [
                                  {
                                    "enum": [
                                      "linear",
                                      "ease-in",
                                      "ease-out",
                                      "ease-in-out",
                                      "hold"
                                    ]
                                  },
                                  {
                                    "type": "array",
                                    "minItems": 4,
                                    "maxItems": 4,
                                    "items": {
                                      "type": "number"
                                    }
                                  }
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "report": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "layers",
                  "keys",
                  "points",
                  "frames",
                  "fps",
                  "durationSeconds",
                  "lottieBytes"
                ],
                "properties": {
                  "layers": {
                    "type": "integer"
                  },
                  "keys": {
                    "type": "integer"
                  },
                  "points": {
                    "type": "integer"
                  },
                  "frames": {
                    "type": "integer"
                  },
                  "fps": {
                    "type": "number"
                  },
                  "durationSeconds": {
                    "type": "number"
                  },
                  "lottieBytes": {
                    "type": "integer"
                  }
                }
              },
              "lottie": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "animatedSvg": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "frameSvg": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "projectFile": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "openInApp": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}