{"openapi":"3.1.0","info":{"title":"SpriteStack 共有サイト API","version":"1.0.0","description":"焼いたモデルの検索・取得・投稿。投稿・直す・非公開にするには、会員登録して /account で発行した鍵（spst_ で始まる値）を Bearer で送ります。"},"servers":[{"url":"https://spritestack.dev"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"ModelSummary":{"type":"object","required":["id","title","titleJa","titleEn","author","license","licenseLabel","tags","hasSource","size","thumbnailUrl","pageUrl","apiUrl","publishedAt"],"properties":{"id":{"type":"string","pattern":"^[0-9a-z]{26}$"},"title":{"type":"string","description":"ファイルの name。識別のための名前。"},"titleJa":{"type":["string","null"],"description":"日本語名。titleJa と titleEn の少なくとも一方は null でない。"},"titleEn":{"type":["string","null"],"description":"英語名。画面の言語に合う名前が無いときは他方を、それも無いときは title を出す。"},"author":{"type":"string"},"license":{"type":"string","enum":["CC0-1.0","CC-BY-4.0"]},"licenseLabel":{"type":"string"},"tags":{"type":"array","maxItems":20,"items":{"type":"string","maxLength":40}},"hasSource":{"type":"boolean"},"size":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"integer","minimum":1}},"thumbnailUrl":{"type":"string","format":"uri"},"pageUrl":{"type":"string","format":"uri"},"apiUrl":{"type":"string","format":"uri"},"publishedAt":{"type":"string","format":"date-time"}}},"ModelDetail":{"type":"object","required":["id","title","titleJa","titleEn","author","license","licenseLabel","tags","hasSource","size","thumbnailUrl","pageUrl","apiUrl","publishedAt","description","format","formatVersion","files","derivedFrom","derivatives"],"properties":{"id":{"type":"string","pattern":"^[0-9a-z]{26}$"},"title":{"type":"string","description":"ファイルの name。識別のための名前。"},"titleJa":{"type":["string","null"],"description":"日本語名。titleJa と titleEn の少なくとも一方は null でない。"},"titleEn":{"type":["string","null"],"description":"英語名。画面の言語に合う名前が無いときは他方を、それも無いときは title を出す。"},"author":{"type":"string"},"license":{"type":"string","enum":["CC0-1.0","CC-BY-4.0"]},"licenseLabel":{"type":"string"},"tags":{"type":"array","maxItems":20,"items":{"type":"string","maxLength":40}},"hasSource":{"type":"boolean"},"size":{"type":"array","minItems":3,"maxItems":3,"items":{"type":"integer","minimum":1}},"thumbnailUrl":{"type":"string","format":"uri"},"pageUrl":{"type":"string","format":"uri"},"apiUrl":{"type":"string","format":"uri"},"publishedAt":{"type":"string","format":"date-time"},"description":{"type":"string","maxLength":2000},"format":{"type":"string","enum":["ss"],"description":"ファイルの中の印。"},"formatVersion":{"type":"integer","const":1},"files":{"type":"object","required":["original","preview","thumbnail","source"],"properties":{"original":{"type":"string","format":"uri"},"preview":{"type":"string","format":"uri"},"thumbnail":{"type":"string","format":"uri"},"source":{"type":["string","null"],"format":"uri","description":"作り直しの元がない場合は null。"}}},"derivedFrom":{"type":["object","null"],"description":"元のモデルの帰属情報。派生でなければ null。元が非公開なら pageUrl は null。","required":["id","title","titleJa","titleEn","author","license","licenseLabel","pageUrl"],"properties":{"id":{"type":"string","pattern":"^[0-9a-z]{26}$"},"title":{"type":"string","description":"元のモデルを上げたときのファイルの name。"},"titleJa":{"type":["string","null"],"description":"元のモデルの日本語名。元が非公開なら null。"},"titleEn":{"type":["string","null"],"description":"元のモデルの英語名。元が非公開なら null。"},"author":{"type":"string"},"license":{"type":"string","enum":["CC0-1.0","CC-BY-4.0"]},"licenseLabel":{"type":"string"},"pageUrl":{"type":["string","null"],"format":"uri"}}},"derivatives":{"type":"array","items":{"$ref":"#/components/schemas/ModelSummary"}}}}}},"paths":{"/api/v1/models":{"get":{"summary":"公開モデルを検索する","parameters":[{"name":"q","in":"query","description":"名前（title・日本語名・英語名）・説明文・タグを検索。最大 5 語。","schema":{"type":"string","maxLength":100}},{"name":"license","in":"query","schema":{"type":"string","enum":["CC0-1.0","CC-BY-4.0"]}},{"name":"hasSource","in":"query","schema":{"type":"boolean"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"モデルの一覧と次の開始位置","content":{"application/json":{"schema":{"type":"object","required":["items","nextOffset"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ModelSummary"}},"nextOffset":{"type":["integer","null"]}}}}}},"400":{"description":"入力の形が不正","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"createModel","summary":"焼いたモデルを投稿する","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"焼いたモデル。最大 16777216 バイト。ファイル内の作者名と使用許諾が必要。"},"titleJa":{"type":"string","maxLength":100,"description":"日本語名。titleJa と titleEn が両方空なら、ファイルの name にひらがな・カタカナ・漢字があれば日本語名、無ければ英語名にする。"},"titleEn":{"type":"string","maxLength":100,"description":"英語名。"},"description":{"type":"string","maxLength":2000},"tags":{"type":"string","description":"JSON 配列を文字列にしたもの。最大 20 個、各 40 字。","example":"[\"car\",\"coach\"]"},"derivedFrom":{"type":"string","pattern":"^[0-9a-z]{26}$"}}}}}},"responses":{"201":{"description":"投稿したモデル","content":{"application/json":{"schema":{"type":"object","required":["id","pageUrl","apiUrl"],"properties":{"id":{"type":"string","pattern":"^[0-9a-z]{26}$"},"pageUrl":{"type":"string","format":"uri"},"apiUrl":{"type":"string","format":"uri"}}}}}},"400":{"description":"入力の形が不正","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"認証が必要（鍵が無い・正しくない・取り消された）","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"所有者ではない、または運営者に止められた会員","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"公開モデルが見つからない","content":{"application/json":{"schema":{"type":"object"}}}},"413":{"description":"容量の上限を超えた","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"description":"モデルまたは参照先が不正","content":{"application/json":{"schema":{"type":"object"}}}},"429":{"description":"1 人が 24 時間に上げられる数を超えた（upload_limit）","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/models/{id}":{"get":{"summary":"モデルの情報・作り直しの元の有無・系譜・ファイルの URL を取る","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9a-z]{26}$"}}],"responses":{"200":{"description":"モデルの詳細","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelDetail"}}}},"404":{"description":"公開モデルが見つからない","content":{"application/json":{"schema":{"type":"object"}}}}}},"patch":{"operationId":"updateModel","summary":"所有するモデルの日本語名・英語名・説明文・タグを直す（title・作者・使用許諾・ファイル・系譜は変更不可）","description":"titleJa・titleEn に空文字か null を送ると、その名前を消す。2 つとも無くなる直しは 400（title_required）。","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9a-z]{26}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"titleJa":{"type":["string","null"],"maxLength":100,"description":"日本語名。前後の空白は除く。空なら名前なし。"},"titleEn":{"type":["string","null"],"maxLength":100,"description":"英語名。前後の空白は除く。空なら名前なし。"},"description":{"type":"string","maxLength":2000},"tags":{"type":"array","maxItems":20,"items":{"type":"string","maxLength":40}}}}}}},"responses":{"200":{"description":"更新後のモデルの詳細","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"入力の形が不正","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"認証が必要（鍵が無い・正しくない・取り消された）","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"所有者ではない、または運営者に止められた会員","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"公開モデルが見つからない","content":{"application/json":{"schema":{"type":"object"}}}}}},"delete":{"operationId":"unpublishModel","summary":"所有するモデルを非公開にする","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9a-z]{26}$"}}],"responses":{"200":{"description":"非公開にしたモデル","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","pattern":"^[0-9a-z]{26}$"},"public":{"const":false}}}}}},"400":{"description":"入力の形が不正","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"認証が必要（鍵が無い・正しくない・取り消された）","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"所有者ではない、または運営者に止められた会員","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"公開モデルが見つからない","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/models/{id}/files/{name}":{"get":{"summary":"公開モデルのファイルを取る","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9a-z]{26}$"}},{"name":"name","in":"path","required":true,"schema":{"type":"string","enum":["original.ss","preview.ss","source.parts.json","thumbnail.png"]}}],"responses":{"200":{"description":"モデル・作り直しの元・サムネイルのバイナリ","content":{"application/zip":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"type":"object"}},"image/png":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"公開モデルが見つからない","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}