# InfisicalClient API

HTTP client for the Infisical API used by `InfisicalSecretStore`.

---
Canonical: /handbook/api/classes/_purista_infisical-secret-store.InfisicalClient/
Source: infisical-secret-store/src/InfisicalClient/InfisicalClient.impl.ts
Format: Markdown for agents
---

HTTP client for the Infisical API used by `InfisicalSecretStore`.

Package: `@purista/infisical-secret-store`

## Signature

```typescript
class InfisicalClient
```

## Members

### Constructors

- `new constructor(conf: { baseUrl: string; basicAuth: { password: string; username: string }; bearerToken: string; defaultHeaders: Record<string, string>; defaultTimeout: number; enableOpentelemetry: boolean; ... })` — Creates an Infisical API client.

### Properties

- `auth: AuthCredentials`
- `baseUrl: URL | undefined` — Parsed base URL, when configured.
- `config: { baseUrl: string; basicAuth: { password: string; username: string }; bearerToken: string; defaultHeaders: Record<string, string>; defaultTimeout: number; enableOpentelemetry: boolean; ... }` — Resolved client configuration.
- `logger: Logger` — Logger scoped to this client.
- `name: string` — Client name used in logs, spans, and metrics.
- `spanProcessor: SpanProcessor | undefined` — Optional OpenTelemetry span processor configured for this client.
- `timeout: number` — Default request timeout in milliseconds.
- `traceProvider: NodeTracerProvider` — Node tracer provider owned by this client instance.

### Methods

- `delete<T>(path: string, options?: HttpClientRequestOptions, payload?: unknown): Promise<T>` — DELETE request.
- `execute(method: string, path: string, options?: HttpClientRequestOptions, payload?: unknown): Promise<any>` — Helper method
- `get<T>(path: string, options?: HttpClientRequestOptions): Promise<T>` — GET request.
- `getSecret(name: string): Promise<string | undefined>` — Reads and decrypts a single shared Infisical secret.
- `getServiceTokenData(): Promise<TokenData>` — Fetches service-token metadata and decrypts the project key for later calls.
- `getTracer(): Tracer` — Returns OpenTelemetry tracer of this client.
- `getUrlAndHeader(path: string, options?: HttpClientRequestOptions): { headers: Record<string, string>; url: URL }`
- `patch<T>(path: string, payload: unknown, options?: HttpClientRequestOptions): Promise<T>` — PATCH request with an optional JSON payload.
- `post<T>(path: string, payload: unknown, options?: HttpClientRequestOptions): Promise<T>` — POST request with an optional JSON payload.
- `put<T>(path: string, payload: unknown, options?: HttpClientRequestOptions): Promise<T>` — PUT request with an optional JSON payload.
- `removeSecret(name: string): Promise<void>` — Removes a shared Infisical secret from the token's first environment scope.
- `setBearerToken(token: string | undefined): void` — Set the bearer token for all following requests.
- `setSecret(name: string, value: string): Promise<void>` — Creates or updates a shared Infisical secret.
- `startActiveSpan<F>(name: string, opts: SpanOptions, context: Context | undefined, fn: (span: Span) => Promise<F>): Promise<F>` — Start a child span for OpenTelemetry tracking.
