vrchat_dart.A Dart client to interact with the unofficial VRChat API. Supports all REST calls specified in https://github.com/vrchatapi/specification. Also supports websocket streaming for status updates.
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.
See the example for getting started in Dart.
See example_flutter for help getting started in Flutter.
Contributions to vrchat_dart_generated should only be done to keep it up to date with the specification. Clone the specification into the same parent folder as vrchatapi-dart and run generate.sh to generate the code.
Contributions to vrchat_dart 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.
Run this command:
With Dart:
$ dart pub add vrchat_dart
With Flutter:
$ flutter pub add vrchat_dart
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
vrchat_dart: ^1.1.1
Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:vrchat_dart/vrchat_dart.dart';
import 'package:vrchat_dart/vrchat_dart.dart';
void main() async {
final api = VrchatDart(userAgent: 'vrchat_dart_example').api;
final loginResponse = await api.auth.login(
username: 'example',
password: 'hunter2',
);
if (loginResponse.error != null) {
print('authError');
print(loginResponse.error);
} else if (loginResponse.requiresTwoFactorAuth) {
print('requiresTwoFactorAuth');
final twoFactorResponse = await api.auth.verify2fa('123456');
if (twoFactorResponse.error == null) {
print('2fa verification success');
} else {
print('2fa verification failure');
print(twoFactorResponse.error);
}
}
if (api.auth.currentUser != null) {
print('logged in');
print(api.auth.currentUser?.username);
}
// API key fetching is automatically handled on successful authentication
final friendsResponse = await api.rawApi.getFriendsApi().getFriends();
print(friendsResponse.data?.first.username);
final worldsResponse = await api.rawApi.getWorldsApi().searchWorlds();
print(worldsResponse.data!.first.name);
// Listen for updates
api.streaming.vrcEventStream.listen(print);
await api.streaming.start();
}