Yoga Detection API - Dart/Flutter Example
Yoga checks request example, documented inputs, server-side authentication and integration checks.
Yoga checks: request contract
This request returns the documented yoga analysis for the supplied inputs. Keep named results and their explanations distinct instead of inferring a universal success score.
POST /v2/astrology/yoga · Operation guide · OpenAPI request and response schema
The values below are synthetic examples. They describe request wiring, rather than a measured result or an accuracy claim. Production requests use your account’s published billing terms; the sandbox provides fixed mock examples for development.
| Field | Location | Type | Schema requirement |
|---|---|---|---|
datetime | body | string | Optional in the request schema; provide it when your calculation needs it |
latitude | body | number | Optional in the request schema; provide it when your calculation needs it |
longitude | body | number | Optional in the request schema; provide it when your calculation needs it |
timezone | body | string | Optional in the request schema; provide it when your calculation needs it |
Make the request safely
Set VEDIKA_API_KEY in the trusted server or command-line environment. Keep that key out of browser bundles, mobile builds, URLs and shared logs. Your application exposes the sample backend route on its own origin. The browser and Flutter snippets use that route; the server supplies the production credential. For a deployed application, add your own user authentication, input validation and access limits around the feature.
For the Flutter request, add the public HTTP client with flutter pub add http. The Dart server example uses its standard library. See the Flutter SDK guide for the separate Vedika package installation.
Dart server or CLI; keep this key out of Flutter builds
import 'dart:convert';
import 'dart:io';
Future<void> main() async {
final key = Platform.environment['VEDIKA_API_KEY'];
if (key == null || key.isEmpty) throw StateError('Set VEDIKA_API_KEY');
final httpClient = HttpClient()..connectionTimeout = const Duration(seconds: 20);
try {
final request = await httpClient.openUrl('POST', Uri.parse("https://api.vedika.io/v2/astrology/yoga"));
request.headers.set('Authorization', 'Bearer $key');
request.headers.contentType = ContentType.json;
request.write("{\"datetime\":\"2026-03-23T12:00:00\",\"latitude\":28.6139,\"longitude\":77.209,\"timezone\":\"+05:30\"}");
final response = await request.close().timeout(const Duration(seconds: 20));
final text = await response.transform(utf8.decoder).join().timeout(const Duration(seconds: 20));
if (response.statusCode < 200 || response.statusCode >= 300) throw HttpException('HTTP ${response.statusCode}');
print(jsonDecode(text));
} finally {
httpClient.close(force: true);
}
}
Flutter application: call your own backend
// Supply the HTTPS origin of your own backend. This request has no Vedika key.
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<Object?> loadCalculation(Uri backendOrigin, String sessionToken) async {
final response = await http.get(backendOrigin.resolve('/api/vedika-example'),
headers: {'Authorization': 'Bearer $sessionToken'})
.timeout(const Duration(seconds: 20));
if (response.statusCode != 200) throw StateError('Calculation unavailable');
return jsonDecode(response.body);
}
Request function for your authenticated backend
// Import this function into your existing authenticated backend route.
export async function requestCalculation() {
const key = process.env.VEDIKA_API_KEY;
if (!key) throw new Error('Set VEDIKA_API_KEY on the server');
const response = await fetch("https://api.vedika.io/v2/astrology/yoga", {
method: 'POST',
headers: { 'Authorization': 'Bearer ' + key, 'Content-Type': 'application/json' },
body: "{\"datetime\":\"2026-03-23T12:00:00\",\"latitude\":28.6139,\"longitude\":77.209,\"timezone\":\"+05:30\"}",
cache: 'no-store', redirect: 'error', signal: AbortSignal.timeout(20000)
});
if (!response.ok) throw new Error('Calculation failed: HTTP ' + response.status);
return response.json();
}Check the result before displaying it
- Validate the selected date, location and relevant calculation settings before making a production request.
- Check HTTP status and the operation-specific JSON schema. Keep errors and timeouts visible instead of displaying a previous or invented result.
- Retain only the inputs and result fields your feature needs. Use synthetic cases in public bug reports and avoid copying private birth details into logs.
- When caching, include every input that affects this operation and keep private results scoped to the appropriate user.
Continue with the quickstart, supported SDKs, current billing units and published technical evidence. Create production access through API-key signup.
Try the FREE Sandbox
978 mock operations for development. Production plans from $12/month.
Explore Sandbox →