{"id":13546668,"url":"https://github.com/ZekeSnider/NintendoSwitchRESTAPI","last_synced_at":"2025-04-02T18:31:24.475Z","repository":{"id":38350493,"uuid":"98816959","full_name":"ZekeSnider/NintendoSwitchRESTAPI","owner":"ZekeSnider","description":"Reverse engineered REST API used in the Nintendo Switch app for iOS. Includes documentation on Splatoon 2's API.","archived":false,"fork":false,"pushed_at":"2019-01-05T18:46:19.000Z","size":252,"stargazers_count":638,"open_issues_count":10,"forks_count":43,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-08-02T12:22:41.345Z","etag":null,"topics":["mitmproxy","nintendo-switch","rest-api","reverse-engineering","splatoon"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZekeSnider.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-30T18:27:37.000Z","updated_at":"2024-07-28T08:34:04.000Z","dependencies_parsed_at":"2022-09-08T18:30:40.979Z","dependency_job_id":null,"html_url":"https://github.com/ZekeSnider/NintendoSwitchRESTAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZekeSnider%2FNintendoSwitchRESTAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZekeSnider%2FNintendoSwitchRESTAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZekeSnider%2FNintendoSwitchRESTAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZekeSnider%2FNintendoSwitchRESTAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZekeSnider","download_url":"https://codeload.github.com/ZekeSnider/NintendoSwitchRESTAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222856345,"owners_count":17048305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mitmproxy","nintendo-switch","rest-api","reverse-engineering","splatoon"],"created_at":"2024-08-01T12:00:42.529Z","updated_at":"2024-11-03T14:31:59.281Z","avatar_url":"https://github.com/ZekeSnider.png","language":null,"readme":"# Reverse Engineered Nintendo Switch App REST API\n\n## Introduction\n\nThis is documentation of the REST APIs used for the Nintendo Switch app, and embedded Splatoon 2 web app. \n\nAll testing was done on an iPhone 7 running iOS 10.3.3 using version 1.0.4 of the Nintendo Switch app on 07/30/17. I reverse-engineered using [mitmproxy](https://mitmproxy.org). It was quite easy as the app does not use cert-pinning at all. I have not tested using the Android app at all, but I would assume that everything is identical (besides obvious user-agent differences). I am using a US account with the language set to English. There may be small differences for other regions.\n\nA [Paw](https://paw.cloud) project is included for macOS users which should help tinkering with the API. I highly recommend trying this out first to figure out how the API works. Take a look at the environment variables to see what you need to fill in. Once you fill in `Client ID`, `Login Page Token Code`, `Login Page Token Code Verifier`, and `Birthday` you can execute the auth requests in order and you should be good to go.\n\nNote: I recommend setting the `User-Agent` on all requests to the Splatoon 2 API to the following string to blend in. There doesn't appear to be any checking for this but better safe than sorry. `Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60`\n\n## Blueprints\n* [Nintendo Account](NintendoAccountBlueprint.md)\n* [Nintendo Switch](SwitchBlueprint.md)\n* [Splatoon 2](Splatoon2Blueprint.md)\n\n## Open Source Components\n\nIf you are curious about the open source components used in the app, I have compiled them [here](OpenSource.md).\n\n## Authentication Steps\n\n1. Visit authorization link in browser\n\nThis page is an HTML page which loads the auth flow which you would normally see first when logging into the app. Follow through the flow by logging in with an account.\n\nhttps://accounts.nintendo.com/connect/1.0.0/authorize?state=[state here]\u0026redirect_uri=[... continues]\n\nI currently have no idea how this URL is generated. I recommend signing out of the Switch app, then sign back in and open the sign flow link in Safari. You can then open it on your computer and follow from there.\n\nOnce you sign in, you will be redirected to a page like `npf71b963c1b7b6d119://auth#session_state=[SessionStateReturnedHere]\u0026session_token_code=[codehere]\u0026state=[StateReturnedHere]` \n\n2. Get a session token\n\nExtract the session_state and state from that url, and request from [POST /connect/1.0.0/api/session_token](NintendoAccountBlueprint.md#GetSessionToken)\n\n3. Get a service access token\n\nMake a request to [POST /connect/1.0.0/api/token](NintendoAccountBlueprint.md#GetServiceToken) using `session_token` from 2.\n\n4. Login to account\n\nMake a request to [POST /v1/Account/Login](SwitchBlueprint.md#LoginAccount). Use `id_token` from 3.\n\n5. Get game list\n\nUse your access token to retrieve the game list from [GET /v1/Game/ListWebServices](SwitchBlueprint.md#GetGameList). Use `webApiServerCredential[\"accesstoken\"]` from 4. \n\n6. Get access token for Splatoon\n\nMake a request to [GET /v1/Game/GetWebServiceToken](SwitchBlueprint.md#GetGameWebServiceToken). Use the ID of Splatoon 2 from 5 and `webApiServerCredential[\"accesstoken\"]` from 4.\n\n7. Get cookie to use for splatoon requests\n\nMake a request to [GET /](Splatoon2Blueprint.md#GetHomepage). Use the `accessToken` from 6.\n\n8. Play with the Splatoon 2 API\n\nYou can now make any request from the [Splatoon 2 API](Splatoon2Blueprint.md) using the cookie retrieved from 7. Have fun!\n","funding_links":[],"categories":["Table of Contents","Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZekeSnider%2FNintendoSwitchRESTAPI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FZekeSnider%2FNintendoSwitchRESTAPI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZekeSnider%2FNintendoSwitchRESTAPI/lists"}