Dasha API - Swift Example

Dasha request example, documented inputs, server-side authentication and integration checks.

Dasha: request contract

Keep the birth inputs with the returned periods. The depth field controls the documented request detail; follow the endpoint schema rather than assuming every dasha system has the same fields.

POST /v2/astrology/dasha · 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.

Inputs documented for this operation
FieldLocationTypeSchema requirement
datetimebodystringOptional in the request schema; provide it when your calculation needs it
latitudebodynumberOptional in the request schema; provide it when your calculation needs it
longitudebodynumberOptional in the request schema; provide it when your calculation needs it
timezonebodystringOptional in the request schema; provide it when your calculation needs it
depthbodyintegerOptional 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. The example runs in a trusted process; a mobile or browser application can call your own backend to keep the production credential private.

Swift server or command-line request

import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

guard let key = ProcessInfo.processInfo.environment["VEDIKA_API_KEY"], !key.isEmpty else {
    fatalError("Set VEDIKA_API_KEY on the server")
}
var request = URLRequest(url: URL(string: "https://api.vedika.io/v2/astrology/dasha")!)
request.httpMethod = "POST"
request.timeoutInterval = 20
request.setValue("Bearer \(key)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = "{\"datetime\":\"1990-05-15T10:30:00\",\"latitude\":19.07,\"longitude\":72.87,\"timezone\":\"+05:30\",\"depth\":3}".data(using: .utf8)
let (data, response) = try await URLSession.shared.data(for: request)
guard let http = response as? HTTPURLResponse, (200..<300).contains(http.statusCode) else {
    fatalError("Calculation request failed")
}
print(String(decoding: data, as: UTF8.self))

Check the result before displaying it

  1. Validate the selected date, location and relevant calculation settings before making a production request.
  2. Check HTTP status and the operation-specific JSON schema. Keep errors and timeouts visible instead of displaying a previous or invented result.
  3. 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.
  4. 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 →
⚡
Simple Integration
REST API with JSON responses
🔒
Credential handling
Keep production keys on your server
📊
Service Status
Live service status: vedika.io/status

Related Documentation