{"openapi":"3.1.0","info":{"title":"Falling Nikochan","description":"API for Falling Nikochan, a simple and cute rhythm game where anyone can create and share charts.","version":"18.15.0","license":{"name":"MIT","identifier":"MIT","url":"https://opensource.org/licenses/MIT"}},"components":{"schemas":{"Chart17":{"type":"object","properties":{"falling":{"const":"nikochan"},"ver":{"anyOf":[{"const":17},{"const":18}]},"offset":{"$ref":"#/components/schemas/Offset15"},"ytId":{"type":"string"},"title":{"type":"string"},"composer":{"type":"string"},"chartCreator":{"type":"string"},"locale":{"type":"string","description":"Locale where this chart was created, e.g. 'jp', 'en', though this field is currently not used for anything."},"levelsMeta":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/LevelMeta15"}},{"$ref":"#/components/schemas/EmptyObj"}]},"lua":{"type":"array","items":{"type":"array","items":{"type":"string"}},"description":"Lua source code split by line. Only used for editing in the chart editor, and is ignored in server side."},"zoom":{"type":"integer","description":"Editor zoom level, where the zoom ratio is 1.5^x"},"copyBuffer":{"$ref":"#/components/schemas/CopyBuffer"},"levelsFreeze":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/LevelFreeze15"}},{"$ref":"#/components/schemas/EmptyObj"}]},"changePasswd":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"default":null,"description":"When this field is not null on POST/PUT request, the server changes the chart passwd to this value."},"published":{"type":"boolean"}},"required":["falling","ver","offset","ytId","title","composer","chartCreator","locale","levelsMeta","lua","zoom","copyBuffer","levelsFreeze","published"]},"LevelMeta15":{"type":"object","properties":{"name":{"type":"string"},"type":{"enum":["Single","Double","Maniac"],"type":"string"},"unlisted":{"type":"boolean"},"ytBegin":{"$ref":"#/components/schemas/YTBegin15"},"ytEnd":{"$ref":"#/components/schemas/YTEnd15"},"ytEndSec":{"$ref":"#/components/schemas/YTEndSec15"},"snapDivider":{"type":"number","description":"The step unit in chart editor is set to 1/(4*snapDivider)"}},"required":["name","type","unlisted","ytBegin","ytEnd","ytEndSec","snapDivider"]},"LevelFreeze15":{"type":"object","properties":{"notes":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/NoteCommand15"}},{"$ref":"#/components/schemas/EmptyObj"}]},"rest":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Rest15"}},{"$ref":"#/components/schemas/EmptyObj"}]},"bpmChanges":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BPMChange15"}},{"$ref":"#/components/schemas/EmptyObj"}]},"speedChanges":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/SpeedChange15"}},{"$ref":"#/components/schemas/EmptyObj"}]},"signature":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Signature15"}},{"$ref":"#/components/schemas/EmptyObj"}]}},"required":["notes","rest","bpmChanges","speedChanges","signature"]},"ChartBrief":{"type":"object","properties":{"ytId":{"type":"string","pattern":"^[a-zA-Z0-9_-]{11}$"},"title":{"type":"string"},"composer":{"type":"string"},"chartCreator":{"type":"string"},"updatedAt":{"type":"number","description":"value from Date.getTime()"},"published":{"type":"boolean"},"locale":{"type":"string","description":"Locale where this chart was created, e.g. 'jp', 'en', though this field is currently not used for anything."},"levels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"hash":{"type":"string","pattern":"^[a-f0-9]{64}$"},"type":{"enum":["Single","Double","Maniac"],"type":"string"},"difficulty":{"type":"integer","minimum":1,"maximum":20},"noteCount":{"type":"integer","minimum":0},"bpmMin":{"type":"number","exclusiveMinimum":0},"bpmMax":{"type":"number","exclusiveMinimum":0},"length":{"type":"number","minimum":0,"description":"The length of chart in seconds"},"unlisted":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"required":["name","hash","type","difficulty","noteCount","bpmMin","bpmMax","length","unlisted"]}}},"required":["ytId","title","composer","chartCreator","updatedAt","published","locale","levels"]},"EmptyObj":{"type":"object","properties":{},"required":[],"additionalProperties":false,"description":"In request schema, the server also accepts empty object instead of empty array for Lua compatibility. You can ignore this schema when specified as the response type in OpenAPI Spec, as the server will always normalize this to an empty array."},"Step":{"type":"object","properties":{"fourth":{"type":"integer","minimum":0},"numerator":{"type":"integer","minimum":0},"denominator":{"type":"integer","minimum":1}},"required":["fourth","numerator","denominator"],"description":"Represents the time duration of (fourth + numerator / denominator) quarter notes. All parameters are positive integers greater than or equal to 0, with numerator < denominator. However, they are not necessarily indecomposable fractions.\nAlways counts the number of quarter notes, regardless of the signature.\nConfusingly, the increment used to move the cursor on the edit screen (1 / snapDivider) is also called a step, but it's a different thing. "},"LuaLine":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}],"default":null,"description":"A line number corresponding to the Lua code, or null if not editable. The first line is 0."},"NoteCommand15":{"type":"object","properties":{"step":{"$ref":"#/components/schemas/Step"},"big":{"type":"boolean","description":"Whether the note is a big note or not"},"hitX":{"type":"number","description":"The x coordinate of the note when hit. left edge: -5.0 - right edge: +5.0"},"hitVX":{"type":"number","description":"The x velocity of the note when hit"},"hitVY":{"type":"number","description":"The y velocity of the note when hit"},"fall":{"type":"boolean","description":"Whether the note falls from the top of the screen, or thrown up from the bottom"},"luaLine":{"$ref":"#/components/schemas/LuaLine"}},"required":["step","big","hitX","hitVX","hitVY","fall"],"description":"A note command described by hit position and velocity."},"Rest15":{"type":"object","properties":{"begin":{"$ref":"#/components/schemas/Step"},"duration":{"$ref":"#/components/schemas/Step"},"luaLine":{"$ref":"#/components/schemas/LuaLine"}},"required":["begin","duration"],"description":"A rest command that specifies a rest period between notes. Only used by chart editor for inserting other commands to lua code, and is ignored when playing."},"BPMChange15":{"type":"object","properties":{"step":{"$ref":"#/components/schemas/Step"},"bpm":{"type":"number","exclusiveMinimum":0},"luaLine":{"$ref":"#/components/schemas/LuaLine"}},"required":["step","bpm"],"description":"BPM change command."},"SpeedChange15":{"type":"object","properties":{"step":{"$ref":"#/components/schemas/Step"},"bpm":{"type":"number"},"interp":{"type":"boolean","description":"whether the speed change is gradual between the previous and this speed change command."},"luaLine":{"$ref":"#/components/schemas/LuaLine"}},"required":["step","bpm","interp"],"description":"Speed change command, where bpm is the speed multiplier. 0 and negative values can also be used."},"SignatureBar":{"type":"array","items":{"type":"array","items":{"enum":[4,8,16],"type":"number"}},"description":"The time signature pattern. For instance, [[4, 4, 4, 4]] is 4/4 beat, [[4, 4, 4, 8]] is 7/8 beat, [[4, 4, 4, 4], [4, 4, 4]] is 4/4 + 3/4 beat."},"Signature15":{"type":"object","properties":{"step":{"$ref":"#/components/schemas/Step"},"offset":{"$ref":"#/components/schemas/Step"},"bars":{"$ref":"#/components/schemas/SignatureBar"},"luaLine":{"$ref":"#/components/schemas/LuaLine"}},"required":["step","offset","bars"],"description":"Time signature change command. Only beats that can be expressed as the sum of 4th, 8th, and 16th notes are supported. If offset is not zero, the count start from the middle of the time signature. (step - offset is the time of the first beat of this signature) \nThis only affects the display of slime-chans at the bottom right of the screen during play, and does not affect the timing of notes or other commands."},"YTBegin15":{"type":"number","minimum":0,"description":"The time in seconds (timestamp of the video) to start the video"},"YTEnd15":{"anyOf":[{"const":"note"},{"const":"yt"},{"type":"number"}],"description":"The time to end the video. 'note': the end time is determined by the last note, rest or bpm/speed change command. 'yt': the end time is determined by ytEndSec. a number value: the end time in seconds (timestamp of the video). This is only used by the chart editor and is ignored when playing."},"YTEndSec15":{"type":"number","minimum":0,"description":"The time in seconds (timestamp of the video) to end the video."},"Offset15":{"type":"number","minimum":0,"description":"The time in seconds (timestamp of the video) to start the chart. This is independent of the `ytBegin` value; for example, if `ytBegin=1` and `offset=2`, playback of the video starts at the 0:01 mark, and the chart begins one second later (at 0:02)."},"CopyBufferEntry":{"type":"array","items":[{"type":"number","description":"hitX value"},{"type":"number","description":"hitVX value"},{"type":"number","description":"hitVY value"},{"type":"boolean","description":"big value"},{"type":"boolean","description":"fall value"}],"minItems":5},"CopyBuffer":{"type":"object","properties":{"0":{"$ref":"#/components/schemas/CopyBufferEntry"},"1":{"$ref":"#/components/schemas/CopyBufferEntry"},"2":{"$ref":"#/components/schemas/CopyBufferEntry"},"3":{"$ref":"#/components/schemas/CopyBufferEntry"},"4":{"$ref":"#/components/schemas/CopyBufferEntry"},"5":{"$ref":"#/components/schemas/CopyBufferEntry"},"6":{"$ref":"#/components/schemas/CopyBufferEntry"},"7":{"$ref":"#/components/schemas/CopyBufferEntry"},"8":{"$ref":"#/components/schemas/CopyBufferEntry"},"9":{"$ref":"#/components/schemas/CopyBufferEntry"}},"required":[]},"ChartSeqData":{"type":"object","properties":{"ver":{"anyOf":[{"const":6},{"const":15},{"const":16},{"const":17},{"const":18}],"description":"Chart version"},"notes":{"$ref":"#/components/schemas/NoteSeq"},"bpmChanges":{"$ref":"#/components/schemas/BPMChangeSeq"},"speedChanges":{"$ref":"#/components/schemas/SpeedChangeSeq"},"signature":{"$ref":"#/components/schemas/SignatureSeq"},"offset":{"$ref":"#/components/schemas/Offset15"},"ytBegin":{"$ref":"#/components/schemas/YTBegin15"},"ytEndSec":{"$ref":"#/components/schemas/YTEndSec15"}},"required":["ver","notes","bpmChanges","speedChanges","signature","offset","ytBegin","ytEndSec"]},"NoteSeq":{"type":"object","properties":{"id":{"type":"number","description":"unique number of note, always equals to index in array"},"hitTimeSec":{"type":"number","description":"hit judgement time in seconds (from chart start)"},"appearTimeSec":{"type":"number","description":"when note starts appearing"},"targetX":{"type":"number","description":"left edge: 0.0 - right edge: 1.0  (1 / 10 of hitX)"},"vx":{"type":"number","description":"1 / 4 of hitVX"},"vy":{"type":"number","description":"1 / 4 of hitVY"},"ay":{"type":"number","description":"always 1 / 4"},"uRange":{"anyOf":[{"type":"array","items":[{"type":"number"},{"type":"number"}],"minItems":2},{"type":"null"}],"description":"When parameter u (in the description in `display`) is outside of this range [min, max], hide this note. On ver <= 16, this is null and the note shoule be always visible."},"display":{"type":"array","items":{"type":"object","properties":{"timeSecBefore":{"type":"number","description":"hitTimeSec - (the time to start to apply this param)"},"u0":{"type":"number"},"du":{"type":"number"},"ddu":{"type":"number"}},"required":["timeSecBefore","u0","du","ddu"]},"description":"Parameter u for each time.\nThe note position between \n  display[i].timeSecBefore < (hitTimeSec - current time) < display[i+1].timeSecBefore \nis calculated as follows:\nt = hitTimeSec - current time - display[i].timeSecBefore,\nu = u0 + du * t + ddu * t^2 / 2,\nx = targetX + vx * u,\ny = vy * u - ay * u^2 / 2.\n(Exceptionally, if hitTimeSec - current time < 0, use display[0] with t = hitTimeSec - current time - 0.)"},"step":{"$ref":"#/components/schemas/Step"},"big":{"type":"boolean","description":"Whether the note is a big note or not"},"hitX":{"type":"number","description":"The x coordinate of the note when hit. left edge: -5.0 - right edge: +5.0"},"hitVX":{"type":"number","description":"The x velocity of the note when hit"},"hitVY":{"type":"number","description":"The y velocity of the note when hit"},"fall":{"type":"boolean","description":"Whether the note falls from the top of the screen, or thrown up from the bottom"}},"required":["id","hitTimeSec","appearTimeSec","targetX","vx","vy","ay","display","step","big","hitX","hitVX","hitVY","fall"],"description":"Note data used for judgement and display during play.\nThe `step`, `big`, `hitX`, `hitVX`, `hitVY`, and `fall` parameters are original values defined in the chart data, identical to those in `NoteCommand15`.\nThe remaining parameters are calculated based on these values along with BPM and speed changes, via the internal `loadChart` function and the `/api/seqFile` and `/api/seqPreview` APIs, and are used for rendering during gameplay."},"BPMChangeSeq":{"type":"object","properties":{"step":{"$ref":"#/components/schemas/Step"},"timeSec":{"type":"number","description":"the time in second (from chart start) when the bpm change happens."},"bpm":{"type":"number"}},"required":["step","timeSec","bpm"],"description":"BPM change command data with timestamp. This is already applied to the NoteSeq properties, so there is no need to take this into account when displaying the notes."},"SpeedChangeSeq":{"type":"object","properties":{"step":{"$ref":"#/components/schemas/Step"},"bpm":{"type":"number","description":"the time in seconds (from chart start) when the speed change happens"},"interp":{"type":"boolean","description":"whether the speed change is gradual between the previous and this speed change command."},"timeSec":{"type":"number","minimum":0}},"required":["step","bpm","interp","timeSec"],"description":"Speed change command with timestamp, where bpm is the speed multiplier. This is already applied to the NoteSeq properties, so there is no need to take this into account when displaying the notes."},"SignatureSeq":{"type":"object","properties":{"step":{"$ref":"#/components/schemas/Step"},"offset":{"$ref":"#/components/schemas/Step"},"bars":{"$ref":"#/components/schemas/SignatureBar"}},"required":["step","offset","bars"],"description":"Time signature change command. Only beats that can be expressed as the sum of 4th, 8th, and 16th notes are supported. If offset is not zero, the count start from the middle of the time signature. (step - offset is the time of the first beat of this signature) \nThis only affects the display of slime-chans at the bottom right of the screen during play, and does not affect the timing of notes or other commands."}}},"servers":[{"url":"https://nikochan.utcode.net/api","description":"Primary Server"}],"paths":{"/brief/{cid}":{"get":{"operationId":"getBriefByCid","description":"Get brief information about the chart.","parameters":[{"name":"If-None-Match","in":"header","description":"If ETag of chart data is given and matches, it returns 304.","schema":{"type":"string"}},{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChartBrief"}}},"headers":{"Cache-Control":{"description":"max-age=600","schema":{"type":"string"}},"ETag":{"description":"\"18-(hash of chart data)\"","schema":{"type":"string"}}}},"304":{"description":"No content if If-None-Match header matches"},"400":{"description":"invalid chart id","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}}}}},"/briefs":{"get":{"operationId":"getBriefs","description":"Get brief information about multiple charts.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"cid":{"type":"string","pattern":"^[0-9]{6}$"},"status":{"const":200},"response":{"$ref":"#/components/schemas/ChartBrief"},"etag":{"type":"string"}},"required":["cid","status","response","etag"]}}}},"headers":{"Cache-Control":{"description":"max-age=600","schema":{"type":"string"}}}},"207":{"description":"One or multiple chart ids not found","content":{"application/json":{"schema":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"cid":{"type":"string","pattern":"^[0-9]{6}$"},"status":{"const":200},"response":{"$ref":"#/components/schemas/ChartBrief"},"etag":{"type":"string"}},"required":["cid","status","response","etag"]},{"type":"object","properties":{"cid":{"type":"string","pattern":"^[0-9]{6}$"},"status":{"const":404}},"required":["cid","status"]}]}}}},"headers":{"Cache-Control":{"description":"no-cache","schema":{"type":"string"}}}},"308":{"description":"Chart ids are duplicated or not sorted","headers":{"Location":{"description":"/api/briefs?c=(sorted cids)","schema":{"type":"string"}}}},"400":{"description":"invalid chart id","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}}},"parameters":[{"in":"query","name":"c","schema":{"anyOf":[{"type":"string","pattern":"^[0-9]{6}$"},{"type":"array","items":{"type":"string","pattern":"^[0-9]{6}$"}}],"maxLength":100},"required":true,"description":"Up to 100 chart IDs can be specified. To retrieve more, split into multiple requests."}]}},"/ytMeta/{cid}":{"get":{"operationId":"getYtMetaByCid","description":"Get YouTube metadata about the chart.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"channelTitle":{"type":"string"}},"required":["title","channelTitle"]}}},"headers":{"Cache-Control":{"description":"max-age=86400","schema":{"type":"string"}}}},"400":{"description":"invalid chart id","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}},"424":{"description":"Failed to get metadata from YouTube","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"ytMetaNotFound"}]}},"required":["message"]}}}}},"parameters":[{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true},{"in":"query","name":"lang","schema":{"type":"string"},"required":true}]}},"/chartFile/{cid}":{"get":{"operationId":"getChartFileByCid","parameters":[{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true},{"in":"query","name":"p","schema":{"type":"string","minLength":1},"description":"plain password"},{"in":"query","name":"ph","schema":{"type":"string","pattern":"^[a-f0-9]{64}$"},"description":"Hashed password generated by /api/hashPasswd. pUserSalt cookie must be set."},{"in":"query","name":"pbypass","schema":{"type":"string"}},{"in":"cookie","name":"pUserSalt","schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Either `Nikochan-Basic (base64 encode of plain password)`, `Nikochan-Hash (hashed password)` or `Nikochan-Bypass (any string)`.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","description":"If ETag of chart data is given and matches, it returns 304.","schema":{"type":"string"}},{"name":"X-If-Match","in":"header","description":"If ETag of chart data is given and does not match, it returns 412. (Standard If-Match header has constraints requiring a strong etag and can interfere with CDN/proxy, so a custom header is used.)","schema":{"type":"string"}}],"description":"Get a raw chart file in MessagePack format. Requires a password (either p/ph query or Authorization header). The chart data format can be either Chart4, Chart5, Chart6, Chart7, Chart8Edit, Chart9Edit, Chart11Edit, Chart13Edit, Chart14Edit, Chart15 or Chart17, while this documentation only describes the latest format. The chart editor can import chart data from the API.","responses":{"200":{"description":"Successful response","content":{"application/vnd.msgpack":{"schema":{"$ref":"#/components/schemas/Chart17"}}},"headers":{"Content-Disposition":{"description":"Filename with extension of .fn{ver}.mpk","schema":{"type":"string"}},"Cache-Control":{"description":"private, no-cache","schema":{"type":"string"}},"ETag":{"description":"\"18-(hash of chart data)\"","schema":{"type":"string"}}}},"304":{"description":"No content if If-None-Match header matches"},"400":{"description":"invalid chart id or parameter","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]}},"required":["message"]}]}}}},"401":{"description":"wrong password","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badPassword"}]}},"required":["message"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}},"412":{"description":"ETag does not match with given If-Match header","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"etagMismatch"}]}},"required":["message"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"tooManyRequest"}]}},"required":["message"]}}},"headers":{"Retry-After":{"description":"Number of seconds to wait before retrying","schema":{"type":"integer"}}}}}},"put":{"operationId":"putChartFileByCid","parameters":[{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true},{"in":"query","name":"p","schema":{"type":"string","minLength":1},"description":"plain password"},{"in":"query","name":"ph","schema":{"type":"string","pattern":"^[a-f0-9]{64}$"},"description":"Hashed password generated by /api/hashPasswd. pUserSalt cookie must be set."},{"in":"query","name":"pbypass","schema":{"type":"string"}},{"in":"cookie","name":"pUserSalt","schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Either `Nikochan-Basic (base64 encode of plain password)`, `Nikochan-Hash (hashed password)` or `Nikochan-Bypass (any string)`.","schema":{"type":"string"}},{"name":"X-If-Match","in":"header","description":"If ETag of chart data is given and does not match, it returns 412. (Standard If-Match header has constraints requiring a strong etag and can interfere with CDN/proxy, so a custom header is used.)","schema":{"type":"string"}},{"name":"Content-Encoding","in":"header","description":"Encoding applied to the request body","schema":{"type":"string"}}],"description":"Update a chart file with new data in MessagePack format. The chart data format must be the latest format (ver.18) or one version earlier (ver.17). The chart data may be compressed using gzip (in that case Content-Encoding header must be set.) The previous password is required (either p/ph query or Authorization header). If the posted chart data has a different password, it will be used next time. POST is also allowed for backward compatibility.","requestBody":{"description":"Chart data in MessagePack format.","required":true,"content":{"application/vnd.msgpack":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Chart17"}]}}}},"responses":{"204":{"description":"No content, chart updated successfully","headers":{"ETag":{"description":"\"18-(hash of chart data)\"","schema":{"type":"string"}}}},"400":{"description":"invalid chart id or parameter, or password not specified in the chart data","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"},{"const":"noPasswd"}]}},"required":["message"]}]}}}},"401":{"description":"wrong password","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badPassword"}]}},"required":["message"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}},"409":{"description":"chart version is older than 17","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"oldChartVersion"}]}},"required":["message"]}}}},"412":{"description":"ETag does not match with given If-Match header","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"etagMismatch"}]}},"required":["message"]}}}},"413":{"description":"Chart file too large","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"tooLargeFile"},{"const":"tooManyEvent"}]}},"required":["message"]}}}},"415":{"description":"Invalid chart format, or given Content-Encoding is unsupported","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"invalidChart"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"invalidChart"},{"const":"unsupportedContentEncoding"},{"const":"invalidContentEncoding"}]}},"required":["message"]}]}}},"headers":{"Accept-Encoding":{"description":"Supported encoding type (gzip)","schema":{"type":"string"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"tooManyRequest"}]}},"required":["message"]}}},"headers":{"Retry-After":{"description":"Number of seconds to wait before retrying","schema":{"type":"integer"}}}}}},"delete":{"operationId":"deleteChartFileByCid","parameters":[{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true},{"in":"query","name":"p","schema":{"type":"string","minLength":1},"description":"plain password"},{"in":"query","name":"ph","schema":{"type":"string","pattern":"^[a-f0-9]{64}$"},"description":"Hashed password generated by /api/hashPasswd. pUserSalt cookie must be set."},{"in":"query","name":"pbypass","schema":{"type":"string"}},{"in":"cookie","name":"pUserSalt","schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Either `Nikochan-Basic (base64 encode of plain password)`, `Nikochan-Hash (hashed password)` or `Nikochan-Bypass (any string)`.","schema":{"type":"string"}},{"name":"X-If-Match","in":"header","description":"If ETag of chart data is given and does not match, it returns 412. (Standard If-Match header has constraints requiring a strong etag and can interfere with CDN/proxy, so a custom header is used.)","schema":{"type":"string"}}],"description":"Soft delete a chart. The chart will be marked as deleted and won't appear in searches or latest/popular lists. Requires a password (either p/ph query or Authorization header).","responses":{"204":{"description":"No content, chart deleted successfully"},"400":{"description":"invalid chart id or parameter","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]}},"required":["message"]}]}}}},"401":{"description":"wrong password","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badPassword"}]}},"required":["message"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}},"412":{"description":"ETag does not match with given If-Match header","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"etagMismatch"}]}},"required":["message"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"tooManyRequest"}]}},"required":["message"]}}},"headers":{"Retry-After":{"description":"Number of seconds to wait before retrying","schema":{"type":"integer"}}}}}}},"/chartFile":{"post":{"operationId":"postChartFile","description":"Create a new chart. The chart data should be in MessagePack format, and must be the latest format (ver.18) or one version earlier (ver.17). The chart data may be compressed using gzip (in that case Content-Encoding header must be set.) Returns the chart ID (cid) of the newly created chart. This endpoint is rate limited to one request per 10 minutes. ","requestBody":{"description":"Chart data in MessagePack format. See also response type of GET /api/chartFile.","required":true,"content":{"application/vnd.msgpack":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Chart17"}]}}}},"parameters":[{"name":"Content-Encoding","in":"header","description":"Encoding applied to the request body","schema":{"type":"string"}}],"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"cid":{"type":"string","pattern":"^[0-9]{6}$"}},"required":["cid"]}}},"headers":{"ETag":{"description":"\"18-(hash of chart data)\"","schema":{"type":"string"}}}},"400":{"description":"password not specified in the chart data","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"noPasswd"}]}},"required":["message"]}}}},"409":{"description":"chart version is older than 17","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"oldChartVersion"}]}},"required":["message"]}}}},"413":{"description":"Chart file too large","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"tooLargeFile"},{"const":"tooManyEvent"}]}},"required":["message"]}}}},"415":{"description":"Invalid chart format, or given Content-Encoding is unsupported","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"invalidChart"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"invalidChart"},{"const":"unsupportedContentEncoding"},{"const":"invalidContentEncoding"}]}},"required":["message"]}]}}},"headers":{"Accept-Encoding":{"description":"Supported encoding type (gzip)","schema":{"type":"string"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"tooManyRequest"}]}},"required":["message"]}}},"headers":{"Retry-After":{"description":"Number of seconds to wait before retrying","schema":{"type":"integer"}}}}}}},"/seqFile/{cid}/{lvIndex}":{"get":{"operationId":"getSeqFileByCidByLvIndex","description":"Gets chart sequence data in MessagePack format, which is used for playing the chart.","parameters":[{"name":"If-None-Match","in":"header","description":"If ETag of chart data is given and matches, it returns 304.","schema":{"type":"string"}},{"name":"X-If-Match","in":"header","description":"If ETag of chart data is given and does not match, it returns 412. (Standard If-Match header has constraints requiring a strong etag and can interfere with CDN/proxy, so a custom header is used.)","schema":{"type":"string"}},{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true},{"in":"path","name":"lvIndex","schema":{"type":"string","pattern":"^[0-9]+$"},"required":true}],"responses":{"200":{"description":"chart sequence data in MessagePack format.","content":{"application/vnd.msgpack":{"schema":{"$ref":"#/components/schemas/ChartSeqData"}}},"headers":{"Content-Disposition":{"description":"Filename with extension of .fnseq.mpk","schema":{"type":"string"}},"Cache-Control":{"description":"no-cache","schema":{"type":"string"}},"ETag":{"description":"\"18-(hash of chart data)\"","schema":{"type":"string"}}}},"304":{"description":"No content if If-None-Match header matches"},"400":{"description":"invalid chart id","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}},"404":{"description":"chart id not found or level index out of range","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"},{"const":"levelNotFound"}]}},"required":["message"]}}}},"412":{"description":"ETag does not match with given If-Match header","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"etagMismatch"}]}},"required":["message"]}}}}}}},"/seqPreview":{"post":{"operationId":"postSeqPreview","description":"Accepts MessagePack-encoded Chart17 data and returns chart sequence data in MessagePack format for preview purposes.","requestBody":{"description":"MessagePack-encoded Chart17 data","required":true,"content":{"application/vnd.msgpack":{"schema":{"$ref":"#/components/schemas/Chart17"}}}},"parameters":[{"name":"Content-Encoding","in":"header","description":"Encoding applied to the request body","schema":{"type":"string"}},{"in":"query","name":"lvIndex","schema":{"type":"string","pattern":"^[0-9]+$"},"required":true,"description":"Index of the level in the chart"}],"responses":{"200":{"description":"chart sequence data in MessagePack format for preview.","content":{"application/vnd.msgpack":{"schema":{"$ref":"#/components/schemas/ChartSeqData"}}},"headers":{"Content-Disposition":{"description":"Filename with extension of .fnseq.mpk","schema":{"type":"string"}}}},"400":{"description":"invalid query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}},"409":{"description":"chart version is older than 17","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"oldChartVersion"}]}},"required":["message"]}}}},"415":{"description":"Invalid chart format, or given Content-Encoding is unsupported","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"invalidChart"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"invalidChart"},{"const":"unsupportedContentEncoding"},{"const":"invalidContentEncoding"}]}},"required":["message"]}]}}},"headers":{"Accept-Encoding":{"description":"Supported encoding type (gzip)","schema":{"type":"string"}}}},"422":{"description":"level index out of range","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"levelNotFound"}]}},"required":["message"]}}}}}}},"/search":{"get":{"operationId":"getSearch","description":"Search charts by text or get charts sorted by latest or popularity.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"cid":{"type":"string"},"count":{"type":"number","description":"The total number of play record weighted by each record's `factor`. only present when sorted by popularity"},"weightedCount":{"type":"number","description":"The final popularity score, the total number of play record weighted based on each record's `factor` and the chart's duration. only present when sorted by popularity"},"updatedAt":{"type":"number","description":"Timestamp of the latest update, only present when sorted by latest"}},"required":["cid"]}}}},"headers":{"Cache-Control":{"description":"max-age=600","schema":{"type":"string"}}}},"400":{"description":"invalid parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}}},"parameters":[{"in":"query","name":"q","schema":{"type":"string","default":""},"description":"If provided, searches by title, artist, tags, author name, or exact match of chart id. Multiple entries separated by spaces will perform an AND search. If not specified, returns all charts."},{"in":"query","name":"c","schema":{"anyOf":[{"type":"string","pattern":"^[0-9]{6}$"},{"type":"array","items":{"type":"string","pattern":"^[0-9]{6}$"}}],"default":[],"maxLength":100},"description":"If chart ids are provided, the results will be filtered and returned in the specified order. Up to 100 chart IDs can be specified. To retrieve more, split into multiple requests."},{"in":"query","name":"sort","schema":{"enum":["relevance","popular","latest"],"type":"string"},"description":"The results will be sorted by relevance to the search keyword, number of views, or update date. If not specified, it will default to \"relevance\". Cannot be used in conjunction with the c parameter."},{"in":"query","name":"difficultyMin","schema":{"type":"integer","default":"1","minimum":1,"maximum":20},"description":"filter charts by difficulty range"},{"in":"query","name":"difficultyMax","schema":{"type":"integer","default":"20","minimum":1,"maximum":20},"description":"filter charts by difficulty range"}]}},"/hashPasswd/{cid}":{"get":{"operationId":"getHashPasswdByCid","description":"Generate a unique hash of the password to be used when accessing the chart. The correct password for the chart is required (query p or Authorization header). The hashed password will be different for each client and each chart (due to the pUserSalt cookie).","parameters":[{"name":"Authorization","in":"header","description":"`Nikochan-Basic (base64 encode of plain password)`","schema":{"type":"string"}},{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true},{"in":"query","name":"p","schema":{"type":"string","minLength":1},"description":"plain password"},{"in":"cookie","name":"pUserSalt","schema":{"type":"string"}}],"responses":{"200":{"description":"sha256(sha256(cid + passwd + secretSalt + pRandomSalt) + pUserSalt)","content":{"text/plain":{"schema":{"type":"string"}}},"headers":{"Set-Cookie":{"description":"Sets the pUserSalt cookie if it was not present in the request.","schema":{"type":"string"}},"Cache-Control":{"description":"no-store","schema":{"type":"string"}}}},"400":{"description":"invalid chart id or parameter, or password not specified in the chart data","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"},{"const":"noPasswd"}]}},"required":["message"]}]}}}},"401":{"description":"wrong password","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badPassword"}]}},"required":["message"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}}}}},"/record/{cid}":{"get":{"operationId":"getRecordByCid","description":"Get play record summary for the chart.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"lvHash":{"type":"string","pattern":"^[a-f0-9]{64}$"},"countAuto":{"type":"number","description":"The total number of autoplay record weighted by each record's `factor`"},"count":{"type":"number","description":"The total number of non-autoplay record weighted by each record's `factor`"},"countFC":{"type":"number"},"countFB":{"type":"number"},"histogram":{"type":"array","items":{"type":"number"}}},"required":["lvHash","countAuto","count","countFC","countFB","histogram"]}}}},"headers":{"Cache-Control":{"description":"max-age=600","schema":{"type":"string"}}}},"400":{"description":"invalid chart id","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}}},"parameters":[{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true}]},"post":{"operationId":"postRecordByCid","description":"Post a play record for a single play of the chart.","requestBody":{"description":"A payload signed with SessionKey as a JWT","required":true,"content":{"application/jwt":{"schema":{"type":"object","properties":{"lvHash":{"type":"string","pattern":"^[a-f0-9]{64}$"},"auto":{"type":"boolean"},"score":{"type":"number","minimum":0,"maximum":120},"baseScore":{"type":"number","minimum":0,"maximum":80},"chainScore":{"type":"number","minimum":0,"maximum":20},"bigScore":{"type":"number","minimum":0,"maximum":20},"fc":{"type":"boolean"},"fb":{"type":"boolean"},"editing":{"type":"boolean"},"factor":{"type":"number","minimum":0,"maximum":1,"description":"adjust the weight of the record. reduce if one player has too many records in a short time."},"date":{"type":"integer","minimum":0}},"required":["lvHash","auto","score","fc","fb","date"]}}}},"parameters":[{"name":"Authorization","in":"header","description":"`Bearer (JWT returned from /api/resultSigning/init)`.","schema":{"type":"string"}},{"in":"path","name":"cid","schema":{"type":"string","pattern":"^[0-9]{6}$"},"required":true}],"responses":{"204":{"description":"No content for successful response"},"400":{"description":"invalid chart id, body or token payload","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"},{"const":"invalidResultParam"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}},"401":{"description":"Verification of token failed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"unauthorizedSessionToken"}]},"cause":{"type":"string"}},"required":["message"]}}}},"404":{"description":"chart id not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"chartIdNotFound"}]}},"required":["message"]}}}},"409":{"description":"Same record already posted or clock is out of sync","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"recordAlreadyPosted"},{"const":"timeMismatch"}]}},"required":["message"]}}}},"422":{"description":"Verification of record data failed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"unauthorizedSessionData"}]},"cause":{"type":"string"}},"required":["message"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"tooManyRequest"}]}},"required":["message"]}}}}}}},"/resultSigning/init":{"post":{"operationId":"postResultSigningInit","description":"Authentication flow for chart result verification:\n1. Secret key ResultSecret is configured in server.\n2. Build generates ephemeral ResultBuildKey pair; private key in frontend env, public key at /resultBuildKey.json.\n3. Client generates ephemeral ResultSessionKey pair at /[locale]/play, signs ResultSessionKey public key and cid as a JWT with ResultBuildKey, and sends it to POST /api/resultSigning/init.\n4. Server verifies the JWT with BuildKey, adds 3-hour expiration (exp), signs it as a JWT with ResultSecret, and returns it.\n5. Client sends POST /api/record and POST /api/resultSigning/sign with `Authorization: Bearer <token>` and result data signed with ResultSessionKey.\n6. Server verifies the signature of token and record/result, verifies cid and timestamp, and stores the record anonymously / returns ResultSecret signature of result.\n7. Client saves and shares ResultParam with ResultSecret signature.\n8. /og/result, /share, and /api/resultSigning/verify/:cid verify ResultParam.\n\nThis API performs the step 4.","requestBody":{"description":"A payload of `key`, `cid`, and `date` signed with ResultBuildKey as a JWT","required":true,"content":{"application/jwt":{"schema":{"type":"object","properties":{"key":{"type":"object","properties":{},"required":[],"description":"JsonWebKey"},"cid":{"type":"string","pattern":"^[0-9]{6}$"},"date":{"type":"integer","description":"Epoch milliseconds"}},"required":["key","cid","date"]}}}},"responses":{"200":{"description":"A payload with 3-hour expiration (exp) signed with ResultSecret key as a JWT","content":{"application/jwt":{"schema":{"type":"object","properties":{"key":{"type":"object","properties":{},"required":[],"description":"JsonWebKey"},"cid":{"type":"string","pattern":"^[0-9]{6}$"},"date":{"type":"integer","description":"Epoch milliseconds"}},"required":["key","cid","date"]}}}},"400":{"description":"invalid payload","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]}}}},"401":{"description":"Verification of request body with ResultBuildKey failed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"unauthorizedResultBuildKey"}]},"cause":{"type":"string"}},"required":["message"]}}}},"409":{"description":"Client clock is out of sync with server","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"timeMismatch"}]}},"required":["message"]}}}}}}},"/resultSigning/sign":{"post":{"operationId":"postResultSigningSign","description":"Sign the play result data to share.","parameters":[{"name":"Authorization","in":"header","description":"`Bearer (JWT returned from /api/resultSigning/init)`.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response with signature","content":{"application/json":{"schema":{"type":"object","properties":{"sign":{"type":"string","description":"Base64Url encoded signature of result with ResultSecret Key"}},"required":["sign"]}}}},"400":{"description":"invalid token payload or result data","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"},{"const":"invalidResultParam"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"verificationNotApplicable"}]}},"required":["message"]}]}}}},"401":{"description":"Verification of token failed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"unauthorizedSessionToken"}]},"cause":{"type":"string"}},"required":["message"]}}}},"409":{"description":"Client clock is out of sync with server","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"timeMismatch"}]}},"required":["message"]}}}},"422":{"description":"Verification of result data failed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"unauthorizedSessionData"}]},"cause":{"type":"string"}},"required":["message"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"string","description":"ResultParam serialized with msgpack and encoded as Base64Url"},"clientSign":{"type":"string","description":"Base64Url encoded signature of result with ResultSessionKey"}},"required":["result","clientSign"]}}}}}},"/resultSigning/verify/{cid}":{"get":{"operationId":"getResultSigningVerifyByCid","description":"Verify the shared play result data.","responses":{"200":{"description":"Successful verification","headers":{"Cache-Control":{"description":"max-age=3600","schema":{"type":"string"}}}},"400":{"description":"invalid parameter or verification not applicable for this result","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"message":{"anyOf":[{"const":"badRequest"},{"const":"invalidResultParam"}]},"flattened":{"type":"object","properties":{"root":{},"nested":{},"other":{}},"required":[],"description":"Flattened error messages of issues"},"issues":{"type":"array","items":{},"description":"raw issues from Valibot"}},"required":["message","flattened","issues"]},{"type":"object","properties":{"message":{"anyOf":[{"const":"verificationNotApplicable"}]}},"required":["message"]}]}}}},"422":{"description":"Failed verification","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"anyOf":[{"const":"unauthorizedResultParam"}]}},"required":["message"]}}},"headers":{"Cache-Control":{"description":"max-age=3600","schema":{"type":"string"}}}}},"parameters":[{"in":"query","name":"result","schema":{"type":"string"},"required":true,"description":"ResultParam and signature encoded as Base64Url and concatenated with '.'"},{"schema":{"type":"string"},"in":"path","name":"cid","required":true}]}},"/stats":{"get":{"operationId":"getStats","description":"Get overall statistics including total chart count and total play count.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"chartCount":{"type":"number","description":"Total number of charts (excluding deleted, including unpublished)"},"playCount":{"type":"number","description":"Total number of play records"}},"required":["chartCount","playCount"]}}},"headers":{"Cache-Control":{"description":"max-age=3600","schema":{"type":"string"}}}}}}}}}