Quick start
Three lines get every Dio request into the in-app inspector, with secrets redacted:
await ApiStudio.initialize(); dio.interceptors.add(ApiStudioDioInterceptor()); // anywhere: ApiStudio.showNavigation(context);
In release builds API Studio is off by default and costs nothing.
Install
Add the core package and the adapter for the HTTP client you use:
dependencies: api_studio: ^1.3.0 api_studio_dio: ^1.0.0 # if you use Dio # api_studio_http: ^1.0.0 # if you use package:http
Initialize before runApp:
import 'package:api_studio/api_studio.dart'; import 'package:api_studio_dio/api_studio_dio.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await ApiStudio.initialize(); runApp(const MyApp()); }
api_studio would force dio on every app, so each client gets a small companion package.HTTP clients
Dio
dio.interceptors.add(ApiStudioDioInterceptor());
package:http
final client = ApiStudioHttpClient(inner: http.Client());
Any other client
Chopper, GraphQL, gRPC-web or your own wrapper — call ApiStudio.log wherever you see the response. It runs through the same redaction, truncation, storage and upload pipeline, and never throws.
await ApiStudio.log( url: 'https://api.example.com/users', method: 'GET', statusCode: 200, durationMs: 145, requestHeaders: {'Accept': 'application/json'}, responseBody: response.body, );
Opening the inspector
ApiStudio.showNavigation(context); // Logs + Performance + Files ApiStudio.show(context); // Logs only ApiStudio.showPerformanceInspector(context); // Without a BuildContext: MaterialApp(navigatorKey: ApiStudio.navigatorKey, ...); ApiStudio.open(); // Draggable floating debug button: WidgetsBinding.instance.addPostFrameCallback( (_) => ApiStudio.showFloatingButton(context), );
Cloud dashboard
Forward captured logs to apistudio.cloud so QA and developers see the same requests:
- Create a free account and sign in.
- Create a project for your app.
- Open the project and generate an API key for an environment (for example Development or Staging).
- Pass the key to
initialize:
await ApiStudio.initialize( enabled: true, // needed for QA / release builds apiKey: const String.fromEnvironment('API_STUDIO_KEY'), ); await ApiStudio.flush(); // optional: push pending logs now
- Uploads only already-redacted logs and is fire-and-forget: it never blocks, delays or throws into your app.
- Near-real-time sync, immediate on errors, with auto-flush when the app goes to the background.
- Requests to the API Studio backend itself are never captured.
--dart-define=API_STUDIO_KEY=… and revoke any leaked key from the project page.Projects & environments
A project is usually one app. Environments (Development, Staging, Production…) keep logs separate, and each API key belongs to exactly one environment — so a log always lands in the right place. On the Logs page you can filter by project, environment, method, status range and date.
Sharing logs
From the Logs page, select the requests that reproduce a bug and choose Share. You get a read-only link a teammate can open without access to your account. Log sharing is available on Pro plans.
Redaction & privacy
Redaction runs on the device before local storage, before upload, and in cURL and every export. Matched values become ***REDACTED***.
| Redacted by default | Values |
|---|---|
| Headers (case-insensitive) | Authorization, Cookie, Set-Cookie, X-API-Key, Proxy-Authorization |
| JSON body keys, form fields, query params | password, token, access_token, refresh_token, secret, api_key, authorization, card_number, cvv |
Add your own keys or a custom hook:
await ApiStudio.initialize( redaction: RedactionConfig( redactHeaders: ['X-Session-Id'], redactBodyKeys: ['ssn', 'pin'], redactor: (log) => log.copyWith( url: log.url.replaceAll(RegExp(r'/users/\d+'), '/users/:id'), ), ), );
Redaction is key-based: secrets inside free-form text, URL path segments or error messages are not detected — use the redactor hook for those. See the privacy policy for what the dashboard stores.
Release & QA builds
API Studio is disabled outside debug builds by default (enabled: kDebugMode). When disabled there is no storage, no timers, no frame callbacks, no network and no UI, and the interceptors pass requests straight through. For QA or internal builds, opt in explicitly:
await ApiStudio.initialize(enabled: const bool.fromEnvironment('QA_BUILD'));
Performance inspector
Opt-in, on-device monitoring of FPS, frame times, jank rate, UI/raster thread time, memory and startup phases, with per-screen tracking and a health score. With an API key, aggregated metrics appear on the dashboard's Performance page.
await ApiStudio.initialize(enablePerformanceMonitoring: true);
Configuration reference
| Option | Default | Description |
|---|---|---|
enabled | kDebugMode | Master switch. Everything is a no-op when false. |
apiKey | null | Cloud dashboard key. null means nothing is uploaded. |
maxStoredLogs | 500 | Logs kept on the device. |
logRetention | 7 days | Older local logs are pruned automatically. |
maxBodyBytes | 1 MB | Per-body cap; larger bodies are truncated and flagged. |
redaction | defaults | See Redaction. |
enablePerformanceMonitoring | false | Turns on the performance inspector. |
notificationConfig | null | Slack webhook or callback for failed requests. |
Troubleshooting
Nothing shows up in the inspector
Make sure initialize completed before the first request and that you're on a debug build or passed enabled: true.
Logs don't reach the dashboard
- Check the API key is active on the project page and belongs to the environment you're filtering by.
- Call
ApiStudio.flush()to push pending logs immediately. - Check you haven't reached your plan's log limit on the overview.
Name clashes with Dio or dart:async
import 'package:api_studio/api_studio.dart' hide CancelToken, ProgressCallback, TimeoutException;
Still stuck? Open an issue on GitHub or contact us.