{
  "openapi": "3.1.0",
  "info": {
    "title": "movedemos API",
    "version": "1.0.0",
    "description": "Search a library of AI-generated exercise demo videos and get short-lived clip links. Stream clips in your own app; do not republish them or train models on them. Show that the videos are AI-generated."
  },
  "servers": [
    {
      "url": "https://api.movedemos.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/moves": {
      "get": {
        "operationId": "searchMoves",
        "summary": "Search moves",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 60
            },
            "description": "Words from the move name, English or Spanish"
          },
          {
            "name": "muscle",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 30
            }
          },
          {
            "name": "equipment",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 30
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching moves",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/moves/{id}": {
      "get": {
        "operationId": "getMove",
        "summary": "Get a move and a clip link (counts against the monthly quota)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,79}$"
            }
          },
          {
            "name": "aspect",
            "in": "query",
            "required": false,
            "description": "The shape of the clip. 9:16 is the portrait original (the default); 4:5 is a centred crop that fits a near-square player. A move with no file in that shape answers 404 aspect_unavailable and uses no quota; any other value answers 400 invalid_aspect.",
            "schema": {
              "type": "string",
              "enum": [
                "9:16",
                "4:5"
              ],
              "default": "9:16"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The move, with a clip link if the clip is published",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MoveResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "405": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/clips/{token}": {
      "get": {
        "operationId": "getClip",
        "summary": "Stream a clip. The link from getMove is the credential; no key is sent.",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The clip",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "A byte range of the clip"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "416": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "security": [],
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP server (streamable HTTP, JSON responses). Tools: search_moves, get_move.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON-RPC 2.0 message, at most 8192 bytes; batches are not accepted."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A JSON-RPC response"
          },
          "202": {
            "description": "A notification was accepted"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key starting mdk_"
      }
    },
    "responses": {
      "Error": {
        "description": "An error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "error"
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "Move": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "object",
            "properties": {
              "en": {
                "type": "string"
              },
              "es": {
                "type": "string"
              }
            }
          },
          "muscle": {
            "type": "string"
          },
          "equipment": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "reps",
              "time"
            ]
          },
          "difficulty": {
            "type": "string"
          },
          "available": {
            "type": "boolean",
            "description": "true when the clip is published"
          }
        }
      },
      "SearchResult": {
        "type": "object",
        "properties": {
          "moves": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Move"
            }
          },
          "ai_generated": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "moves",
          "ai_generated"
        ]
      },
      "MoveResult": {
        "type": "object",
        "properties": {
          "move": {
            "$ref": "#/components/schemas/Move"
          },
          "clip": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "expires_in": {
                "type": "integer",
                "const": 600
              },
              "type": {
                "type": "string",
                "const": "video/mp4"
              }
            }
          },
          "ai_generated": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "move",
          "clip",
          "ai_generated"
        ]
      }
    }
  }
}
