Verified SDK and CLI Examples
Source-checked TypeScript, Python, CLI, and cURL examples that default to the Lawie sandbox.
Use sandbox credentials and non-sensitive test records. The selected SDK version and the Public API Reference are authoritative for supported operations; do not infer an endpoint from an internal package or repository path.
TypeScript
import { createLawieAPIClient } from "@lawie/sdk";
const lawie = createLawieAPIClient({
baseUrl: "https://api.sandbox.lawielabs.com",
token: process.env.LAWIE_API_KEY,
tenantId: process.env.LAWIE_TENANT_ID,
});
const documents = await lawie.documents.list({ limit: 20 });
console.log(documents);The SDK expects token, not apiKey, in its configuration. Keep the token in a server-side secret store and create separate credentials for sandbox and production.
Python
import os
from lawie import Lawie
lawie = Lawie(
api_key=os.environ["LAWIE_API_KEY"],
tenant_id=os.environ.get("LAWIE_TENANT_ID"),
base_url="https://api.sandbox.lawielabs.com",
)
documents = lawie.documents.list(limit=20)
print(documents)CLI
lawie login \
--api-key "$LAWIE_API_KEY" \
--base-url https://api.sandbox.lawielabs.com
lawie documents list --limit 20
lawie doctor --base-url https://api.sandbox.lawielabs.comThe CLI stores the API key in the operating-system keychain. If no usable keychain backend is available, login fails instead of writing the key to a plaintext configuration file.
Direct HTTP
Use only a method and path shown in the Public API Reference. The example below uses the published document-list operation.
curl --fail-with-body --silent --show-error \
https://api.sandbox.lawielabs.com/documents \
-H "Authorization: Bearer $LAWIE_API_KEY" \
-H "Accept: application/json"Production readiness
- Apply request timeouts, bounded retries with backoff, and idempotency only where documented.
- Redact tokens, personal data, document content, and privileged material from logs and support messages.
- Record request identifiers and relevant rate-limit headers rather than copying example limits into code.
- Complete tenant security, privacy, monitoring, ownership, rollback, and capacity review before switching the base URL to production.