{"id":18780022,"url":"https://github.com/vrchatapi/vrchatapi-csharp","last_synced_at":"2025-04-13T11:30:42.100Z","repository":{"id":39825681,"uuid":"393992000","full_name":"vrchatapi/vrchatapi-csharp","owner":"vrchatapi","description":"🟣VRChat API Library for C#","archived":false,"fork":false,"pushed_at":"2024-04-29T22:00:49.000Z","size":4374,"stargazers_count":45,"open_issues_count":5,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T11:26:19.990Z","etag":null,"topics":["api","dart","vrchat","vrchatapi"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/VRChat.API","language":"C#","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/vrchatapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-08T15:03:46.000Z","updated_at":"2024-05-21T17:02:02.354Z","dependencies_parsed_at":"2024-05-21T17:01:52.480Z","dependency_job_id":"8c4f1bfd-6c57-418d-8a7d-1a5fd7316425","html_url":"https://github.com/vrchatapi/vrchatapi-csharp","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrchatapi%2Fvrchatapi-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrchatapi%2Fvrchatapi-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrchatapi%2Fvrchatapi-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrchatapi%2Fvrchatapi-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vrchatapi","download_url":"https://codeload.github.com/vrchatapi/vrchatapi-csharp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705481,"owners_count":21148545,"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":["api","dart","vrchat","vrchatapi"],"created_at":"2024-11-07T20:24:18.365Z","updated_at":"2025-04-13T11:30:42.093Z","avatar_url":"https://github.com/vrchatapi.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://raw.githubusercontent.com/vrchatapi/vrchatapi.github.io/main/static/assets/img/lang/lang_csharp_banner_1500x300.png)\n\n# VRChat API Library for C#\n\nA C# client to interact with the unofficial VRChat API. Supports all REST calls specified in https://github.com/vrchatapi/specification.\n\n## Disclaimer\n\nThis is the official response of the VRChat Team (from Tupper more specifically) on the usage of the VRChat API.\n\n\u003e Use of the API using applications other than the approved methods (website, VRChat application) are not officially supported. You may use the API for your own application, but keep these guidelines in mind:\n\u003e * We do not provide documentation or support for the API.\n\u003e * Do not make queries to the API more than once per 60 seconds.\n\u003e * Abuse of the API may result in account termination.\n\u003e * Access to API endpoints may break at any given time, with no warning.\n\nAs stated, this documentation was not created with the help of the official VRChat team. Therefore this documentation is not an official documentation of the VRChat API and may not be always up to date with the latest versions. If you find that a page or endpoint is not longer valid please create an issue and tell us so we can fix it.\n\n## Installation\n\nInstall with NuGet:\n\n```bash\n# With .NET CLI\ndotnet add package VRChat.API --version \u003cLATEST_VERSION\u003e\n\n# Or with Package Manager\nInstall-Package VRChat.API -Version \u003cLATEST_VERSION\u003e\n```\n\n## Getting Started\n\nThe following example code authenticates you with the API, fetches your join-date, and prints the name of a world.\n\n```csharp\nusing System;\nusing VRChat.API.Api;\nusing VRChat.API.Client;\nusing VRChat.API.Model;\n\n// Create a configuration for us to log in\nConfiguration config = new Configuration();\nconfig.Username = \"Username\";\nconfig.Password = \"Password\";\n\n// We have to identify ourselves according to the vrchat tos,\n// We can't use emails here bc http header parser complains\nconfig.UserAgent = \"ExampleProgram/0.0.1 mydiscordusername\"; \n\n// Create a client to hold all our cookies :D\nApiClient client = new ApiClient();\n\n// Create an instance of the auth api so we can verify and log in\nAuthenticationApi authApi = new AuthenticationApi(client, client, config);\n\n// We also need to create instances of the other APIs we'll need\nUsersApi userApi = new UsersApi(client, client, config);\nWorldsApi worldApi = new WorldsApi(client, client, config);\n\ntry\n{\n    // Our first request we get the ApiResponse instead of just the user object,\n    // so we can see what the API expects from us\n    ApiResponse\u003cCurrentUser\u003e currentUserResp = authApi.GetCurrentUserWithHttpInfo();\n\n    if (requiresEmail2FA(currentUserResp)) // If the API wants us to send an Email OTP code\n    {\n        authApi.Verify2FAEmailCode(new TwoFactorEmailCode(\"123456\"));\n    }\n    else\n    {\n        // requiresEmail2FA returned false, so we use secret-based 2fa verification\n        // authApi.VerifyRecoveryCode(new TwoFactorAuthCode(\"12345678\")); // To Use a Recovery Code\n        authApi.Verify2FA(new TwoFactorAuthCode(\"123456\"));\n    }\n\n    // We can now get our CurrentUser :D\n    CurrentUser currentUser = authApi.GetCurrentUser();\n    Console.WriteLine(\"Logged in as {0}\", currentUser.DisplayName);\n\n    User user = userApi.GetUser(\"usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469\");\n    Console.WriteLine(\"Found user {0}, joined {1}\", user.DisplayName, user.DateJoined);\n\n    World world = worldApi.GetWorld(\"wrld_ba913a96-fac4-4048-a062-9aa5db092812\");\n    Console.WriteLine(\"Found world {0}, visits: {1}\", world.Name, world.Visits);\n} \ncatch (ApiException ex)\n{\n    // Catch any exceptions write to console, helps w debugging :D\n    Console.WriteLine(\"Exception when calling API: {0}\", ex.Message);\n    Console.WriteLine(\"Status Code: {0}\", ex.ErrorCode);\n    Console.WriteLine(ex.ToString());\n}\n\n// Function that determines if the api expects email2FA from an ApiResponse\nstatic bool requiresEmail2FA(ApiResponse\u003cCurrentUser\u003e resp)\n{\n    // We can just use a super simple string.Contains() check\n    if (resp.RawContent.Contains(\"emailOtp\"))\n    {\n        return true;\n    }\n\n    return false;\n}\n```\n\n## Cookies\nCookies can be displayed after logging in using:\n```csharp\nApiClient.CookieContainer.GetAllCookies().ToList().ForEach(x =\u003e Console.WriteLine($\"{x.Name}={x.Value}\"));\n```\n\nAnd they can be used by editing the config at the start of your program like this:\n```csharp\nconfig.DefaultHeaders.Add(\"Cookie\", \"auth=[AUTH_COOKIE_HERE]; twoFactorAuth=[TWO_FACTOR_AUTH_COOKIE_HERE]\");\n```\n\n## Documentation\n\n - [docs](docs/)\n\n## Contributing\n\nContributions are welcome, but do not add features that should be handled by the OpenAPI specification.\n\nJoin the [Discord server](https://discord.gg/Ge2APMhPfD) to get in touch with us.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvrchatapi%2Fvrchatapi-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvrchatapi%2Fvrchatapi-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvrchatapi%2Fvrchatapi-csharp/lists"}