Skip to main content

Getting Started

Beta

This library is currently in beta. API implementation is complete, but test coverage is minimal. Response models and method signatures may change based on test findings.

If you encounter any issues such as incorrect response models or unexpected behavior, please report them via GitHub Issues or submit a Pull Request.

misskey_client is a pure Dart Misskey API client library. It works in any environment where Dart runs: Flutter, server-side Dart, CLI tools, and more.

Installation

Add the dependency to your pubspec.yaml:

dependencies:
misskey_client: ^1.0.0-beta.1

Then fetch it:

dart pub get

Basic Usage

Initializing the client

import 'package:misskey_client/misskey_client.dart';

final client = MisskeyClient(
config: MisskeyClientConfig(
baseUrl: Uri.parse('https://misskey.example.com'),
),
tokenProvider: () => 'your_access_token',
);

baseUrl must be a Uri including the scheme (e.g. https://). tokenProvider is a callback returning FutureOr<String?>. It can be omitted when only using endpoints that do not require authentication.

Your first API call

Fetching server information (no authentication required):

final serverInfo = await client.meta.fetch();
print(serverInfo.name); // Server name
print(serverInfo.description); // Server description

Fetching the authenticated user's own account:

final me = await client.account.i();
print(me.name); // Display name
print(me.username); // Username (without @)

API structure

Every API domain is exposed as a property on MisskeyClient:

client.account       // Account and profile management (/api/i/*)
client.announcements // Server announcements
client.antennas // Antenna (keyword monitoring) management
client.ap // ActivityPub endpoints
client.blocking // User blocking
client.channels // Channel management
client.charts // Statistics charts
client.chat // Direct messaging
client.clips // Note clip management
client.drive // File storage (drive.files, drive.folders, drive.stats)
client.federation // Federated instance information
client.flash // Play (Flash) management
client.following // Follow / unfollow operations
client.gallery // Gallery post management
client.hashtags // Hashtag information
client.invite // Invite code management
client.meta // Server metadata
client.mute // User muting
client.notes // Note operations (timelines, create, react, etc.)
client.notifications // Notification retrieval and management
client.pages // Pages management
client.renoteMute // Renote mute management
client.roles // Role management
client.sw // Service Worker push notification registration
client.users // User search, follow lists, user lists

Controlling log output

HTTP request/response logs are disabled by default. Enable them via MisskeyClientConfig:

final client = MisskeyClient(
config: MisskeyClientConfig(
baseUrl: Uri.parse('https://misskey.example.com'),
enableLog: true,
),
tokenProvider: () => 'token',
);

To route logs to your own sink, pass a Logger implementation to the constructor:

final client = MisskeyClient(
config: MisskeyClientConfig(
baseUrl: Uri.parse('https://misskey.example.com'),
),
tokenProvider: () => 'token',
logger: FunctionLogger((level, message) {
// level is one of: 'debug', 'info', 'warn', 'error'
myLogger.log(level, message);
}),
);

See Logging for details.

Next steps