VRChat.API 1.17.2

dotnet add package VRChat.API --version 1.17.2
NuGet\Install-Package VRChat.API -Version 1.17.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VRChat.API" Version="1.17.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VRChat.API --version 1.17.2
#r "nuget: VRChat.API, 1.17.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VRChat.API as a Cake Addin
#addin nuget:?package=VRChat.API&version=1.17.2

// Install VRChat.API as a Cake Tool
#tool nuget:?package=VRChat.API&version=1.17.2

alternate text is missing from this package README image

VRChat API Library for C#

A C# client to interact with the unofficial VRChat API. Supports all REST calls specified in https://github.com/vrchatapi/specification.

Disclaimer

This is the official response of the VRChat Team (from Tupper more specifically) on the usage of the VRChat API.

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:

  • We do not provide documentation or support for the API.
  • Do not make queries to the API more than once per 60 seconds.
  • Abuse of the API may result in account termination.
  • Access to API endpoints may break at any given time, with no warning.

As 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.

Installation

Install with NuGet:

# With .NET CLI
dotnet add package VRChat.API --version <LATEST_VERSION>

# Or with Package Manager
Install-Package VRChat.API -Version <LATEST_VERSION>

Getting Started

The following example code authenticates you with the API, fetches your join-date, and prints the name of a world.

using System;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

// Create a configuration for us to log in
Configuration config = new Configuration();
config.Username = "Username";
config.Password = "Password";

// We have to identify ourselves according to the vrchat tos,
// We can't use emails here bc http header parser complains
config.UserAgent = "ExampleProgram/0.0.1 mydiscordusername"; 

// Create a client to hold all our cookies :D
ApiClient client = new ApiClient();

// Create an instance of the auth api so we can verify and log in
AuthenticationApi authApi = new AuthenticationApi(client, client, config);

// We also need to create instances of the other APIs we'll need
UsersApi userApi = new UsersApi(client, client, config);
WorldsApi worldApi = new WorldsApi(client, client, config);

try
{
    // Our first request we get the ApiResponse instead of just the user object,
    // so we can see what the API expects from us
    ApiResponse<CurrentUser> currentUserResp = authApi.GetCurrentUserWithHttpInfo();

    if (requiresEmail2FA(currentUserResp)) // If the API wants us to send an Email OTP code
    {
        authApi.Verify2FAEmailCode(new TwoFactorEmailCode("123456"));
    }
    else
    {
        // requiresEmail2FA returned false, so we use secret-based 2fa verification
        // authApi.VerifyRecoveryCode(new TwoFactorAuthCode("12345678")); // To Use a Recovery Code
        authApi.Verify2FA(new TwoFactorAuthCode("123456"));
    }

    // We can now get our CurrentUser :D
    CurrentUser currentUser = authApi.GetCurrentUser();
    Console.WriteLine("Logged in as {0}", currentUser.DisplayName);

    User user = userApi.GetUser("usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469");
    Console.WriteLine("Found user {0}, joined {1}", user.DisplayName, user.DateJoined);

    World world = worldApi.GetWorld("wrld_ba913a96-fac4-4048-a062-9aa5db092812");
    Console.WriteLine("Found world {0}, visits: {1}", world.Name, world.Visits);
} 
catch (ApiException ex)
{
    // Catch any exceptions write to console, helps w debugging :D
    Console.WriteLine("Exception when calling API: {0}", ex.Message);
    Console.WriteLine("Status Code: {0}", ex.ErrorCode);
    Console.WriteLine(ex.ToString());
}

// Function that determines if the api expects email2FA from an ApiResponse
static bool requiresEmail2FA(ApiResponse<CurrentUser> resp)
{
    // We can just use a super simple string.Contains() check
    if (resp.RawContent.Contains("emailOtp"))
    {
        return true;
    }

    return false;
}

Documentation

Contributing

Contributions are welcome, but do not add features that should be handled by the OpenAPI specification.

Join the Discord server to get in touch with us.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on VRChat.API:

Package Downloads
VRChat.API.Client

Fluent interface API around VRChat.API, allowing for fluent usage of the library in enterprise-grade environments.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.17.2 94 4/23/2024
1.17.1 101 4/21/2024
1.17.0 97 4/15/2024
1.16.8 99 4/14/2024
1.16.7 135 3/22/2024
1.16.6 132 2/24/2024
1.16.5 119 2/11/2024
1.16.4 90 2/2/2024
1.16.3 84 1/26/2024
1.16.2 125 1/5/2024
1.16.0 10,173 12/30/2023
1.15.0 198 10/4/2023
1.14.0 136 9/21/2023
1.13.0 119 9/19/2023
1.12.0 21,338 5/31/2023
1.11.1 436 2/19/2023
1.11.0 259 2/11/2023
1.9.1 554 11/17/2022
1.9.0 296 11/17/2022
1.8.0 330 11/4/2022
1.7.7 406 10/16/2022
1.7.6 357 10/16/2022
1.7.4 470 9/8/2022
1.7.3 402 9/3/2022
1.7.2 491 7/6/2022
1.7.1 571 4/27/2022
1.7.0 441 4/15/2022
1.6.10 433 4/9/2022
1.6.9 526 1/27/2022
1.6.8 444 1/22/2022
1.6.7 432 1/20/2022
1.6.6 439 1/16/2022
1.6.5 336 12/19/2021
1.6.4-rc1 531 12/5/2021
1.6.3 3,309 11/26/2021
1.6.2 2,376 11/26/2021
1.6.1 2,224 11/25/2021
1.6.0 3,175 11/25/2021
1.5.3 298 11/23/2021
1.5.3-rc01 169 11/23/2021
1.0.0 297 11/23/2021

Automated deployment