Skip to content

TimeLogic API SDK usage guide

Install the TimeLogic API SDKs for TypeScript, Python, Rust, Go, Java, .NET, PHP, Ruby, Kotlin and Swift, then make your first current-time call.

Updated

Short answer: pick your language on the SDK page, install the package, read the key from TIMELOGIC_API_KEY, and call current time with an explicit tz. For JavaScript and TypeScript that is npm install @timelogic/direct-api.

How do I use a TimeLogic API SDK?

Choose your language on the SDK page, install the published package, and keep TIMELOGIC_API_KEY in an environment variable or secret manager. The page covers the time API JavaScript SDK, time API TypeScript SDK, time API Python SDK, and the time API npm package alongside the other supported languages. The generated clients use the same direct OpenAPI contract as the HTTP examples.

npm install @timelogic/direct-api
import { TimeApi, createConfiguration } from "@timelogic/direct-api";

const api = new TimeApi(createConfiguration({
  apiKey: process.env.TIMELOGIC_API_KEY!,
}));

const currentTime = await api.getCurrentTime({ tz: "America/New_York" });

How do I configure authentication and the base URL?

The direct SDKs target https://api.timelogicapi.com and use the direct API key as configured by each generated client. Keep the key outside source control:

export TIMELOGIC_API_KEY="your-key"

Do not put a direct key in browser JavaScript, a public repository, or a client-side mobile bundle. If you are using the RapidAPI marketplace instead, follow its package-specific option and supply the marketplace key and host headers through a server-side configuration.

Which package should I install for my language?

The SDK page is driven by the repository's SDK manifest. It shows the language, exact install command when the package publishes one, quick-start example, registry link, and the matching README. Use that page rather than copying an import name from a different language's generated client.

Each README is the source for language-specific method naming and configuration details. The website guide explains the shared flow; the README explains the package's generated API surface.

A repeatable SDK workflow

  1. Install the package with the command shown for your language.
  2. Read the key from TIMELOGIC_API_KEY or your platform secret manager.
  3. Create the generated client with the direct host and key configuration.
  4. Call a small endpoint such as current time with an explicit tz.
  5. Handle the SDK's HTTP error type and preserve the response body when you need signed-response verification.

The site checks the SDK manifest during the static build so stale install commands and published version metadata are surfaced before release.

Related guides and documentation

Frequently asked questions

Which languages have a TimeLogic API SDK?

TypeScript and JavaScript, Python, Rust, Go, Java, .NET, PHP, Ruby, Kotlin and Swift. The SDK page lists the install command, registry link and README for each one.

How do I install the JavaScript or TypeScript SDK?

Run npm install @timelogic/direct-api, create a client with createConfiguration({ apiKey: process.env.TIMELOGIC_API_KEY }), then call api.getCurrentTime({ tz: 'America/New_York' }).

Where should I keep the API key?

In a server environment variable such as TIMELOGIC_API_KEY or a secret manager. Do not put a direct key in browser JavaScript, a public repository, or a client-side mobile bundle.

Do the SDKs use the same API as the HTTP examples?

Yes. The generated clients use the same direct OpenAPI contract as the HTTP examples and target https://api.timelogicapi.com.

Is there a JavaScript time API client or a Python timezone API library?

Yes. Install @timelogic/direct-api from npm for JavaScript and TypeScript, or timelogic-api from PyPI for Python. Both are generated from the same OpenAPI contract as the HTTP API, so they follow the same endpoints and parameters.