@azerothian/infisical 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,1038 @@
1
+ # @azerothian/infisical
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@azerothian/infisical.svg)](https://www.npmjs.com/package/@azerothian/infisical)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A TypeScript SDK for the [Infisical](https://infisical.com) API. Provides typed access to secrets management, identity authentication, PKI, KMS, and all other Infisical platform features.
7
+
8
+ - Zero dependencies (uses native `fetch`)
9
+ - Supports Node.js 18+
10
+ - Full TypeScript type definitions
11
+ - ESM and CommonJS builds
12
+ - Two-step authentication with auto-renewal
13
+
14
+ ## Table of Contents
15
+
16
+ - [Installation](#installation)
17
+ - [Quick Start](#quick-start)
18
+ - [Authentication](#authentication)
19
+ - [Login Methods](#login-methods)
20
+ - [Auth Modes & Permissions](#auth-modes--permissions)
21
+ - [Auto-Renewal](#auto-renewal)
22
+ - [Auth State Inspection](#auth-state-inspection)
23
+ - [Architecture](#architecture)
24
+ - [Login Flow](#login-flow)
25
+ - [Auto-Renewal Flow](#auto-renewal-flow)
26
+ - [Auth Mode Check Flow](#auth-mode-check-flow)
27
+ - [Configuration](#configuration)
28
+ - [Error Handling](#error-handling)
29
+ - [Releasing](#releasing)
30
+ - [API Reference](#api-reference)
31
+ - [MFA](#mfa)
32
+ - [MFA Sessions](#mfa-sessions)
33
+ - [Users](#users)
34
+ - [Password](#password)
35
+ - [Service Tokens](#service-tokens)
36
+ - [Organizations](#organizations)
37
+ - [Organization Identities](#organization-identities)
38
+ - [Identities](#identities)
39
+ - [Identity Access Tokens](#identity-access-tokens)
40
+ - [Identity Auth](#identity-auth)
41
+ - [Projects](#projects)
42
+ - [Secrets](#secrets)
43
+ - [Secret Folders](#secret-folders)
44
+ - [Secret Imports](#secret-imports)
45
+ - [Secret Sharing](#secret-sharing)
46
+ - [Secret Syncs](#secret-syncs)
47
+ - [Webhooks](#webhooks)
48
+ - [PKI Certificate Authorities](#pki-certificate-authorities)
49
+ - [PKI Certificate Templates](#pki-certificate-templates)
50
+ - [PKI Alerts](#pki-alerts)
51
+ - [PKI Certificates](#pki-certificates)
52
+ - [KMS](#kms)
53
+ - [Integration Auth](#integration-auth)
54
+ - [App Connections](#app-connections)
55
+ - [Admin](#admin)
56
+ - [Org Admin](#org-admin)
57
+
58
+ ---
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ npm install @azerothian/infisical
64
+ ```
65
+
66
+ ## Quick Start
67
+
68
+ ```typescript
69
+ import { InfisicalClient } from "@azerothian/infisical";
70
+
71
+ const client = new InfisicalClient();
72
+
73
+ await client.login({
74
+ universalAuth: { clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET" }
75
+ });
76
+
77
+ const secrets = await client.secrets.list({
78
+ projectId: "my-project-id",
79
+ environment: "production",
80
+ });
81
+
82
+ console.log(secrets);
83
+ ```
84
+
85
+ ## Authentication
86
+
87
+ The SDK uses a **two-step authentication** model. First, construct the client. Then, call `client.login()` with one of 12 identity auth methods. The returned access token is stored internally and sent automatically with every subsequent request.
88
+
89
+ ### Login Methods
90
+
91
+ Pass exactly one auth method key to `client.login()`:
92
+
93
+ ```typescript
94
+ // Universal Auth (client ID + secret)
95
+ await client.login({ universalAuth: { clientId: "...", clientSecret: "..." } });
96
+
97
+ // Token Auth
98
+ await client.login({ tokenAuth: { identityId: "..." } });
99
+
100
+ // AWS Auth
101
+ await client.login({ awsAuth: { identityId: "...", iamHttpRequestMethod: "...", iamRequestBody: "...", iamRequestHeaders: "..." } });
102
+
103
+ // GCP Auth
104
+ await client.login({ gcpAuth: { identityId: "...", jwt: "..." } });
105
+
106
+ // Azure Auth
107
+ await client.login({ azureAuth: { identityId: "...", jwt: "..." } });
108
+
109
+ // Kubernetes Auth
110
+ await client.login({ kubernetesAuth: { identityId: "...", jwt: "..." } });
111
+
112
+ // OIDC Auth
113
+ await client.login({ oidcAuth: { identityId: "...", jwt: "..." } });
114
+
115
+ // JWT Auth
116
+ await client.login({ jwtAuth: { identityId: "...", jwt: "..." } });
117
+
118
+ // LDAP Auth
119
+ await client.login({ ldapAuth: { identityId: "...", username: "...", password: "..." } });
120
+
121
+ // TLS Certificate Auth
122
+ await client.login({ tlsCertAuth: { identityId: "...", clientCertificate: "..." } });
123
+
124
+ // OCI Auth
125
+ await client.login({ ociAuth: { identityId: "...", userOcid: "...", requestHeaders: "..." } });
126
+
127
+ // AliCloud Auth
128
+ await client.login({ alicloudAuth: { identityId: "...", stsToken: "...", identityArn: "..." } });
129
+ ```
130
+
131
+ ### Auth Modes & Permissions
132
+
133
+ Each resource category in the SDK is restricted to a set of allowed auth modes. If you call a resource method with an incompatible mode, the SDK throws an `AuthenticationError` before making any network request.
134
+
135
+ | Resource Category | Allowed Auth Modes |
136
+ |---|---|
137
+ | `secrets`, `secretFolders`, `secretImports` | IAT, JWT, ST |
138
+ | `projects`, `organizations`, `organizationIdentities` | IAT, JWT |
139
+ | `identities`, `identityAuth`, `identityAccessTokens` | IAT, JWT |
140
+ | `pki`, `kms`, `secretTags` | IAT, JWT |
141
+ | `appConnections`, `secretSyncs`, `integrationAuth` | IAT, JWT |
142
+ | `admin`, `orgAdmin` | JWT only |
143
+ | `secretSharing`, `webhooks` | JWT only |
144
+ | `users`, `mfa`, `mfaSessions` | JWT only |
145
+ | `serviceTokens`, `password` | JWT only |
146
+
147
+ **IAT** = Identity Access Token (set by `client.login()`), **JWT** = User JWT, **ST** = Service Token (deprecated).
148
+
149
+ ```typescript
150
+ import { AuthenticationError } from "@azerothian/infisical";
151
+
152
+ try {
153
+ // login() sets mode to "identityAccessToken"
154
+ await client.login({ universalAuth: { clientId: "...", clientSecret: "..." } });
155
+ // admin requires JWT -- this will throw
156
+ await client.admin.getConfig();
157
+ } catch (error) {
158
+ if (error instanceof AuthenticationError) {
159
+ console.error(`Auth mode "${error.currentMode}" not allowed`);
160
+ console.error("Allowed modes:", error.allowedModes);
161
+ }
162
+ }
163
+ ```
164
+
165
+ ### Auto-Renewal
166
+
167
+ When you authenticate via `client.login()`, the SDK stores the credentials and the token's `expiresIn` value. If a request is made within **30 seconds** of the token's expiry, the SDK transparently re-authenticates using the same credentials that were originally passed to `login()`.
168
+
169
+ Concurrent requests that hit the renewal window share a single renewal promise, so only one re-authentication call is made regardless of how many requests are in flight.
170
+
171
+ ### Auth State Inspection
172
+
173
+ ```typescript
174
+ client.isAuthenticated // true if login() has been called and not yet logged out
175
+ client.authMode // "identityAccessToken" | "jwt" | "apiKey" | "serviceToken" | null
176
+ client.logout() // clears auth state, token, and renewal function
177
+ ```
178
+
179
+ ## Architecture
180
+
181
+ ### Login Flow
182
+
183
+ ```mermaid
184
+ sequenceDiagram
185
+ participant App
186
+ participant Client as InfisicalClient
187
+ participant AM as AuthManager
188
+ participant IAR as Identity Auth Resource
189
+ participant API as Infisical API
190
+ participant AS as AuthState
191
+
192
+ App->>Client: new InfisicalClient({ baseUrl })
193
+ App->>Client: login({ universalAuth: { clientId, clientSecret } })
194
+ Client->>AM: login(params)
195
+ AM->>IAR: universal.login({ clientId, clientSecret })
196
+ IAR->>API: POST /api/v1/auth/universal-auth/login
197
+ API-->>IAR: { accessToken, expiresIn }
198
+ IAR-->>AM: LoginResponse
199
+ AM->>AS: setAuth({ mode: "identityAccessToken", accessToken }, expiresIn)
200
+ AM->>AS: setRenewFn(loginFn)
201
+ AM-->>Client: LoginResponse
202
+ Client-->>App: LoginResponse
203
+ ```
204
+
205
+ ### Auto-Renewal Flow
206
+
207
+ ```mermaid
208
+ sequenceDiagram
209
+ participant App
210
+ participant Resource as SecretsResource
211
+ participant HTTP as HttpClient
212
+ participant AS as AuthState
213
+ participant IAR as Identity Auth Resource
214
+ participant API as Infisical API
215
+
216
+ App->>Resource: secrets.list({ projectId, environment })
217
+ Resource->>Resource: requireAuth()
218
+ Resource->>HTTP: get("/api/v4/secrets", query)
219
+ HTTP->>AS: ensureValid()
220
+
221
+ alt Token expired (within 30s of expiry)
222
+ AS->>IAR: loginFn() [re-authenticate]
223
+ IAR->>API: POST /api/v1/auth/.../login
224
+ API-->>IAR: { accessToken, expiresIn }
225
+ IAR-->>AS: LoginResponse
226
+ AS->>AS: setAuth(newToken, newExpiry)
227
+ end
228
+
229
+ AS-->>HTTP: valid
230
+ HTTP->>API: GET /api/v4/secrets (with Bearer token)
231
+ API-->>HTTP: secrets data
232
+ HTTP-->>Resource: typed response
233
+ Resource-->>App: ListSecretsResponse
234
+ ```
235
+
236
+ ### Auth Mode Check Flow
237
+
238
+ ```mermaid
239
+ flowchart TD
240
+ A[Client calls resource method] --> B{requireAuth}
241
+ B --> C{Is authenticated?}
242
+ C -->|No| D[Throw AuthenticationError<br/>'Not authenticated']
243
+ C -->|Yes| E{Auth mode allowed<br/>for this resource?}
244
+ E -->|No| F[Throw AuthenticationError<br/>'Mode X not allowed']
245
+ E -->|Yes| G[Proceed with request]
246
+ G --> H{ensureValid}
247
+ H --> I{Token near expiry?}
248
+ I -->|Yes| J[Auto-renew token]
249
+ J --> K[Execute HTTP request]
250
+ I -->|No| K
251
+ ```
252
+
253
+ ## Configuration
254
+
255
+ ```typescript
256
+ const client = new InfisicalClient({
257
+ // Optional: base URL (defaults to https://app.infisical.com)
258
+ baseUrl: "https://self-hosted.example.com",
259
+
260
+ // Optional: request timeout in milliseconds (defaults to 30000)
261
+ timeout: 60_000,
262
+
263
+ // Optional: additional headers sent with every request
264
+ headers: { "X-Custom-Header": "value" },
265
+
266
+ // Optional: custom fetch implementation
267
+ fetch: customFetchFn,
268
+ });
269
+ ```
270
+
271
+ ## Error Handling
272
+
273
+ All API errors are thrown as typed error classes. Network-level failures throw `InfisicalNetworkError`. Auth-mode violations throw `AuthenticationError` before any network call is made.
274
+
275
+ ```typescript
276
+ import {
277
+ InfisicalApiError,
278
+ InfisicalNetworkError,
279
+ AuthenticationError,
280
+ BadRequestError,
281
+ UnauthorizedError,
282
+ ForbiddenError,
283
+ NotFoundError,
284
+ ValidationError,
285
+ RateLimitError,
286
+ InternalServerError,
287
+ } from "@azerothian/infisical";
288
+
289
+ try {
290
+ await client.secretFolders.getById({ id: "non-existent" });
291
+ } catch (error) {
292
+ if (error instanceof AuthenticationError) {
293
+ console.error(`Auth mode "${error.currentMode}" not allowed`);
294
+ console.error("Allowed modes:", error.allowedModes);
295
+ } else if (error instanceof NotFoundError) {
296
+ console.error("Folder not found:", error.message);
297
+ console.error("Request ID:", error.requestId);
298
+ } else if (error instanceof UnauthorizedError) {
299
+ console.error("Invalid credentials");
300
+ } else if (error instanceof RateLimitError) {
301
+ console.error("Rate limited, retry later");
302
+ } else if (error instanceof InfisicalApiError) {
303
+ console.error(`API error ${error.statusCode}: ${error.message}`);
304
+ } else if (error instanceof InfisicalNetworkError) {
305
+ console.error("Network failure:", error.message, error.cause);
306
+ }
307
+ }
308
+ ```
309
+
310
+ | Error Class | HTTP Status | Description |
311
+ |---|---|---|
312
+ | `AuthenticationError` | N/A | Not authenticated, or auth mode not allowed for resource |
313
+ | `BadRequestError` | 400 | Malformed request |
314
+ | `UnauthorizedError` | 401 | Missing or invalid credentials |
315
+ | `ForbiddenError` | 403 | Insufficient permissions |
316
+ | `NotFoundError` | 404 | Resource not found |
317
+ | `ValidationError` | 422 | Request body validation failed |
318
+ | `RateLimitError` | 429 | Too many requests |
319
+ | `InternalServerError` | 500 | Server-side error |
320
+ | `InfisicalApiError` | Other | Catch-all for other HTTP error codes |
321
+ | `InfisicalNetworkError` | N/A | Connection failure, timeout, DNS error |
322
+
323
+ ## Releasing
324
+
325
+ Releases are handled by the release script which automates version bumping, git tagging, GitHub releases, and npm publishing.
326
+
327
+ ```bash
328
+ # Patch release (0.1.0 -> 0.1.1)
329
+ npm run release:patch
330
+
331
+ # Minor release (0.1.0 -> 0.2.0)
332
+ npm run release:minor
333
+
334
+ # Major release (0.1.0 -> 1.0.0)
335
+ npm run release:major
336
+ ```
337
+
338
+ The release script (`scripts/release.sh`) performs the following steps:
339
+
340
+ 1. Validates clean working tree on `master` branch
341
+ 2. Runs the full test suite
342
+ 3. Bumps the version in `package.json` and creates a git commit + tag (`vX.Y.Z`)
343
+ 4. Builds the dist output
344
+ 5. Pushes the commit and tag to `origin`
345
+ 6. Creates a GitHub release with auto-generated release notes
346
+ 7. Publishes the package to npm
347
+
348
+ **Prerequisites:**
349
+ - Authenticated with npm (`npm login`)
350
+ - Authenticated with GitHub CLI (`gh auth login`)
351
+ - On the `master` branch with no uncommitted changes
352
+
353
+ ---
354
+
355
+ ## API Reference
356
+
357
+ ### Auth Legend
358
+
359
+ The **Auth** column in the tables below uses these abbreviations:
360
+
361
+ | Abbreviation | Meaning |
362
+ |---|---|
363
+ | **IAT** | Identity Access Token (`identityAccessToken` mode) |
364
+ | **JWT** | User JWT (`jwt` mode) |
365
+ | **API** | User API Key (`apiKey` mode) |
366
+ | **ST** | Service Token (`serviceToken` mode) -- deprecated |
367
+ | **None** | No authentication required (login endpoints) |
368
+
369
+ ---
370
+
371
+ ### MFA
372
+
373
+ Multi-factor authentication management for user sessions.
374
+
375
+ **Accessor:** `client.mfa`
376
+
377
+ | Method | HTTP | Path | Auth | Description |
378
+ |---|---|---|---|---|
379
+ | `resendToken()` | POST | `/auth/mfa/send` | JWT | Resend MFA verification token |
380
+ | `checkTotp()` | GET | `/auth/mfa/check/totp` | JWT | Check TOTP MFA status |
381
+ | `checkWebAuthn()` | GET | `/auth/mfa/check/webauthn` | JWT | Check WebAuthn MFA status |
382
+ | `verify(params)` | POST | `/auth/mfa/verify` | JWT | Verify MFA token |
383
+ | `verifyRecoveryCode(params)` | POST | `/auth/mfa/verify/recovery-code` | JWT | Verify MFA recovery code |
384
+
385
+ ---
386
+
387
+ ### MFA Sessions
388
+
389
+ Manage MFA session verification.
390
+
391
+ **Accessor:** `client.mfaSessions`
392
+
393
+ | Method | HTTP | Path | Auth | Description |
394
+ |---|---|---|---|---|
395
+ | `verify(params)` | POST | `/api/v2/mfa-sessions/{mfaSessionId}/verify` | JWT | Verify an MFA session |
396
+ | `getStatus(params)` | GET | `/api/v2/mfa-sessions/{mfaSessionId}/status` | JWT | Get MFA session status |
397
+
398
+ ---
399
+
400
+ ### Users
401
+
402
+ Manage the authenticated user's profile, API keys, sessions, and settings.
403
+
404
+ **Accessor:** `client.users`
405
+
406
+ | Method | HTTP | Path | Auth | Description |
407
+ |---|---|---|---|---|
408
+ | `getMe()` | GET | `/api/v2/users/me` | JWT | Get current user profile |
409
+ | `deleteMe()` | DELETE | `/api/v2/users/me` | JWT | Delete current user account |
410
+ | `updateName(params)` | PATCH | `/api/v2/users/me/name` | JWT | Update display name |
411
+ | `updateMfa(params)` | PATCH | `/api/v2/users/me/mfa` | JWT | Update MFA settings |
412
+ | `updateAuthMethods(params)` | PUT | `/api/v2/users/me/auth-methods` | JWT | Set allowed auth methods |
413
+ | `updateEmail(params)` | PATCH | `/api/v2/users/me/email` | JWT | Change email address |
414
+ | `requestEmailChangeOtp(params)` | POST | `/api/v2/users/me/email-change/otp` | JWT | Request OTP for email change |
415
+ | `sendEmailVerificationCode(params)` | POST | `/api/v2/users/me/emails/code` | JWT | Send email verification code |
416
+ | `verifyEmailVerificationCode(params)` | POST | `/api/v2/users/me/emails/verify` | JWT | Verify email code |
417
+ | `listOrganizations()` | GET | `/api/v2/users/me/organizations` | JWT | List user's organizations |
418
+ | `listApiKeys()` | GET | `/api/v2/users/me/api-keys` | JWT | List user API keys |
419
+ | `createApiKey(params)` | POST | `/api/v2/users/me/api-keys` | JWT | Create a new API key |
420
+ | `deleteApiKey(apiKeyDataId)` | DELETE | `/api/v2/users/me/api-keys/{apiKeyDataId}` | JWT | Delete an API key |
421
+ | `listSessions()` | GET | `/api/v2/users/me/sessions` | JWT | List active sessions |
422
+ | `revokeAllSessions()` | DELETE | `/api/v2/users/me/sessions` | JWT | Revoke all sessions |
423
+ | `revokeSession(sessionId)` | DELETE | `/api/v2/users/me/sessions/{sessionId}` | JWT | Revoke a specific session |
424
+
425
+ ---
426
+
427
+ ### Password
428
+
429
+ Password reset operations.
430
+
431
+ **Accessor:** `client.password`
432
+
433
+ | Method | HTTP | Path | Auth | Description |
434
+ |---|---|---|---|---|
435
+ | `reset(params)` | POST | `/api/v2/password/password-reset` | None | Reset password (unauthenticated, via email token) |
436
+ | `resetAuthenticated(params)` | POST | `/api/v2/password/user/password-reset` | JWT | Reset password while logged in |
437
+
438
+ ---
439
+
440
+ ### Service Tokens
441
+
442
+ Manage service tokens (deprecated -- use machine identities instead).
443
+
444
+ **Accessor:** `client.serviceTokens`
445
+
446
+ | Method | HTTP | Path | Auth | Description |
447
+ |---|---|---|---|---|
448
+ | `get()` | GET | `/api/v2/service-token` | JWT, ST | Get current service token details |
449
+ | `create(params)` | POST | `/api/v2/service-token` | JWT | Create a new service token |
450
+ | `delete(serviceTokenId)` | DELETE | `/api/v2/service-token/{serviceTokenId}` | JWT | Delete a service token |
451
+
452
+ ---
453
+
454
+ ### Organizations
455
+
456
+ Manage organizations, memberships, and related resources.
457
+
458
+ **Accessor:** `client.organizations`
459
+
460
+ | Method | HTTP | Path | Auth | Description |
461
+ |---|---|---|---|---|
462
+ | `create(params)` | POST | `/api/v2/organizations` | JWT, IAT | Create an organization |
463
+ | `delete(params)` | DELETE | `/api/v2/organizations/{orgId}` | JWT, IAT | Delete an organization |
464
+ | `upgradePrivilegeSystem()` | POST | `/api/v2/organizations/privilege-system-upgrade` | JWT, IAT | Upgrade privilege system |
465
+ | `listMemberships(params)` | GET | `/api/v2/organizations/{orgId}/memberships` | JWT, IAT | List org members |
466
+ | `getMembership(params)` | GET | `/api/v2/organizations/{orgId}/memberships/{membershipId}` | JWT, IAT | Get a membership |
467
+ | `updateMembership(params)` | PATCH | `/api/v2/organizations/{orgId}/memberships/{membershipId}` | JWT, IAT | Update a membership |
468
+ | `deleteMembership(params)` | DELETE | `/api/v2/organizations/{orgId}/memberships/{membershipId}` | JWT, IAT | Remove a member |
469
+ | `bulkDeleteMemberships(params)` | DELETE | `/api/v2/organizations/{orgId}/memberships` | JWT, IAT | Remove multiple members |
470
+ | `listProjectMembershipsByOrgMembership(params)` | GET | `/api/v2/organizations/{orgId}/memberships/{membershipId}/project-memberships` | JWT, IAT | List project memberships for an org member |
471
+ | `listProjects(params)` | GET | `/api/v2/organizations/{orgId}/workspaces` | JWT, IAT | List org projects |
472
+
473
+ ---
474
+
475
+ ### Organization Identities
476
+
477
+ List machine identities within an organization.
478
+
479
+ **Accessor:** `client.organizationIdentities`
480
+
481
+ | Method | HTTP | Path | Auth | Description |
482
+ |---|---|---|---|---|
483
+ | `list(params)` | GET | `/api/v2/organizations/{orgId}/identity-memberships` | JWT, IAT | List identity memberships in an org |
484
+
485
+ ---
486
+
487
+ ### Identities
488
+
489
+ CRUD operations for machine identities.
490
+
491
+ **Accessor:** `client.identities`
492
+
493
+ | Method | HTTP | Path | Auth | Description |
494
+ |---|---|---|---|---|
495
+ | `create(params)` | POST | `/api/v1/identities` | JWT, IAT | Create an identity |
496
+ | `update(params)` | PATCH | `/api/v1/identities/{identityId}` | JWT, IAT | Update an identity |
497
+ | `delete(params)` | DELETE | `/api/v1/identities/{identityId}` | JWT, IAT | Delete an identity |
498
+ | `get(params)` | GET | `/api/v1/identities/{identityId}` | JWT, IAT | Get identity details |
499
+ | `listProjectMemberships(params)` | GET | `/api/v1/identities/{identityId}/identity-memberships` | JWT, IAT | List project memberships for an identity |
500
+ | `search(params)` | GET | `/api/v1/organizations/{organizationId}/identities` | JWT, IAT | Search identities in an org |
501
+
502
+ ---
503
+
504
+ ### Identity Access Tokens
505
+
506
+ Renew and revoke machine identity access tokens.
507
+
508
+ **Accessor:** `client.identityAccessTokens`
509
+
510
+ | Method | HTTP | Path | Auth | Description |
511
+ |---|---|---|---|---|
512
+ | `renew(params)` | POST | `/api/v1/auth/token/renew` | IAT | Renew an access token |
513
+ | `revoke(params)` | POST | `/api/v1/auth/token/revoke` | IAT | Revoke an access token |
514
+
515
+ ---
516
+
517
+ ### Identity Auth
518
+
519
+ Authentication methods for machine identities. Each sub-resource follows a consistent pattern: a `login()` method that requires no authentication (it returns a token), and `attach`/`update`/`get`/`revoke` methods for managing the auth configuration on an identity.
520
+
521
+ All identity auth sub-resources are accessed via `client.identityAuth.<provider>`.
522
+
523
+ #### Universal Auth
524
+
525
+ **Accessor:** `client.identityAuth.universal`
526
+
527
+ | Method | HTTP | Path | Auth | Description |
528
+ |---|---|---|---|---|
529
+ | `login(params)` | POST | `/api/v1/auth/universal-auth/login` | None | Authenticate with client ID and secret |
530
+ | `attach(params)` | POST | `/api/v1/auth/universal-auth/identities/{identityId}` | JWT, IAT | Attach universal auth to an identity |
531
+ | `update(params)` | PATCH | `/api/v1/auth/universal-auth/identities/{identityId}` | JWT, IAT | Update universal auth config |
532
+ | `get(params)` | GET | `/api/v1/auth/universal-auth/identities/{identityId}` | JWT, IAT | Get universal auth config |
533
+ | `revoke(params)` | DELETE | `/api/v1/auth/universal-auth/identities/{identityId}` | JWT, IAT | Remove universal auth from identity |
534
+ | `createClientSecret(params)` | POST | `/api/v1/auth/universal-auth/identities/{identityId}/client-secrets` | JWT, IAT | Create a client secret |
535
+ | `listClientSecrets(params)` | GET | `/api/v1/auth/universal-auth/identities/{identityId}/client-secrets` | JWT, IAT | List client secrets |
536
+ | `getClientSecret(params)` | GET | `/api/v1/auth/universal-auth/identities/{identityId}/client-secrets/{clientSecretId}` | JWT, IAT | Get a client secret |
537
+ | `revokeClientSecret(params)` | DELETE | `/api/v1/auth/universal-auth/identities/{identityId}/client-secrets/{clientSecretId}` | JWT, IAT | Revoke a client secret |
538
+
539
+ **Example: Authenticate with Universal Auth**
540
+
541
+ ```typescript
542
+ import { InfisicalClient } from "@azerothian/infisical";
543
+
544
+ const client = new InfisicalClient();
545
+
546
+ // login() calls POST /api/v1/auth/universal-auth/login, stores the token,
547
+ // and sets up auto-renewal.
548
+ const response = await client.login({
549
+ universalAuth: {
550
+ clientId: "YOUR_CLIENT_ID",
551
+ clientSecret: "YOUR_CLIENT_SECRET",
552
+ },
553
+ });
554
+
555
+ console.log("Authenticated, token expires in", response.expiresIn, "seconds");
556
+
557
+ // All subsequent calls use the stored token automatically.
558
+ const folders = await client.secretFolders.list({
559
+ projectId: "project-id",
560
+ environment: "production",
561
+ path: "/",
562
+ });
563
+ ```
564
+
565
+ #### Token Auth
566
+
567
+ **Accessor:** `client.identityAuth.token`
568
+
569
+ | Method | HTTP | Path | Auth | Description |
570
+ |---|---|---|---|---|
571
+ | `login(params)` | POST | `/api/v1/auth/token/login` | None | Authenticate with a token |
572
+ | `attach(params)` | POST | `/api/v1/auth/token/identities/{identityId}` | JWT, IAT | Attach token auth |
573
+ | `update(params)` | PATCH | `/api/v1/auth/token/identities/{identityId}` | JWT, IAT | Update token auth config |
574
+ | `get(params)` | GET | `/api/v1/auth/token/identities/{identityId}` | JWT, IAT | Get token auth config |
575
+ | `revoke(params)` | DELETE | `/api/v1/auth/token/identities/{identityId}` | JWT, IAT | Remove token auth |
576
+ | `createToken(params)` | POST | `/api/v1/auth/token/identities/{identityId}/tokens` | JWT, IAT | Create a token |
577
+ | `listTokens(params)` | GET | `/api/v1/auth/token/identities/{identityId}/tokens` | JWT, IAT | List tokens |
578
+ | `getToken(params)` | GET | `/api/v1/auth/token/identities/{identityId}/tokens/{tokenId}` | JWT, IAT | Get a token |
579
+ | `updateToken(params)` | PATCH | `/api/v1/auth/token/identities/{identityId}/tokens/{tokenId}` | JWT, IAT | Update a token |
580
+ | `revokeToken(params)` | DELETE | `/api/v1/auth/token/identities/{identityId}/tokens/{tokenId}` | JWT, IAT | Revoke a token |
581
+
582
+ #### AWS Auth
583
+
584
+ **Accessor:** `client.identityAuth.aws`
585
+
586
+ | Method | HTTP | Path | Auth | Description |
587
+ |---|---|---|---|---|
588
+ | `login(params)` | POST | `/api/v1/auth/aws-auth/login` | None | Authenticate via AWS IAM |
589
+ | `attach(params)` | POST | `/api/v1/auth/aws-auth/identities/{identityId}` | JWT, IAT | Attach AWS auth |
590
+ | `update(params)` | PATCH | `/api/v1/auth/aws-auth/identities/{identityId}` | JWT, IAT | Update AWS auth config |
591
+ | `get(params)` | GET | `/api/v1/auth/aws-auth/identities/{identityId}` | JWT, IAT | Get AWS auth config |
592
+ | `revoke(params)` | DELETE | `/api/v1/auth/aws-auth/identities/{identityId}` | JWT, IAT | Remove AWS auth |
593
+
594
+ #### GCP Auth
595
+
596
+ **Accessor:** `client.identityAuth.gcp`
597
+
598
+ | Method | HTTP | Path | Auth | Description |
599
+ |---|---|---|---|---|
600
+ | `login(params)` | POST | `/api/v1/auth/gcp-auth/login` | None | Authenticate via GCP |
601
+ | `attach(params)` | POST | `/api/v1/auth/gcp-auth/identities/{identityId}` | JWT, IAT | Attach GCP auth |
602
+ | `update(params)` | PATCH | `/api/v1/auth/gcp-auth/identities/{identityId}` | JWT, IAT | Update GCP auth config |
603
+ | `get(params)` | GET | `/api/v1/auth/gcp-auth/identities/{identityId}` | JWT, IAT | Get GCP auth config |
604
+ | `revoke(params)` | DELETE | `/api/v1/auth/gcp-auth/identities/{identityId}` | JWT, IAT | Remove GCP auth |
605
+
606
+ #### Azure Auth
607
+
608
+ **Accessor:** `client.identityAuth.azure`
609
+
610
+ | Method | HTTP | Path | Auth | Description |
611
+ |---|---|---|---|---|
612
+ | `login(params)` | POST | `/api/v1/auth/azure-auth/login` | None | Authenticate via Azure AD |
613
+ | `attach(params)` | POST | `/api/v1/auth/azure-auth/identities/{identityId}` | JWT, IAT | Attach Azure auth |
614
+ | `update(params)` | PATCH | `/api/v1/auth/azure-auth/identities/{identityId}` | JWT, IAT | Update Azure auth config |
615
+ | `get(params)` | GET | `/api/v1/auth/azure-auth/identities/{identityId}` | JWT, IAT | Get Azure auth config |
616
+ | `revoke(params)` | DELETE | `/api/v1/auth/azure-auth/identities/{identityId}` | JWT, IAT | Remove Azure auth |
617
+
618
+ #### Kubernetes Auth
619
+
620
+ **Accessor:** `client.identityAuth.kubernetes`
621
+
622
+ | Method | HTTP | Path | Auth | Description |
623
+ |---|---|---|---|---|
624
+ | `login(params)` | POST | `/api/v1/auth/kubernetes-auth/login` | None | Authenticate via Kubernetes SA token |
625
+ | `attach(params)` | POST | `/api/v1/auth/kubernetes-auth/identities/{identityId}` | JWT, IAT | Attach Kubernetes auth |
626
+ | `update(params)` | PATCH | `/api/v1/auth/kubernetes-auth/identities/{identityId}` | JWT, IAT | Update Kubernetes auth config |
627
+ | `get(params)` | GET | `/api/v1/auth/kubernetes-auth/identities/{identityId}` | JWT, IAT | Get Kubernetes auth config |
628
+ | `revoke(params)` | DELETE | `/api/v1/auth/kubernetes-auth/identities/{identityId}` | JWT, IAT | Remove Kubernetes auth |
629
+
630
+ #### OIDC Auth
631
+
632
+ **Accessor:** `client.identityAuth.oidc`
633
+
634
+ | Method | HTTP | Path | Auth | Description |
635
+ |---|---|---|---|---|
636
+ | `login(params)` | POST | `/api/v1/auth/oidc-auth/login` | None | Authenticate via OIDC provider |
637
+ | `attach(params)` | POST | `/api/v1/auth/oidc-auth/identities/{identityId}` | JWT, IAT | Attach OIDC auth |
638
+ | `update(params)` | PATCH | `/api/v1/auth/oidc-auth/identities/{identityId}` | JWT, IAT | Update OIDC auth config |
639
+ | `get(params)` | GET | `/api/v1/auth/oidc-auth/identities/{identityId}` | JWT, IAT | Get OIDC auth config |
640
+ | `revoke(params)` | DELETE | `/api/v1/auth/oidc-auth/identities/{identityId}` | JWT, IAT | Remove OIDC auth |
641
+
642
+ #### JWT Auth
643
+
644
+ **Accessor:** `client.identityAuth.jwt`
645
+
646
+ | Method | HTTP | Path | Auth | Description |
647
+ |---|---|---|---|---|
648
+ | `login(params)` | POST | `/api/v1/auth/jwt-auth/login` | None | Authenticate via external JWT |
649
+ | `attach(params)` | POST | `/api/v1/auth/jwt-auth/identities/{identityId}` | JWT, IAT | Attach JWT auth |
650
+ | `update(params)` | PATCH | `/api/v1/auth/jwt-auth/identities/{identityId}` | JWT, IAT | Update JWT auth config |
651
+ | `get(params)` | GET | `/api/v1/auth/jwt-auth/identities/{identityId}` | JWT, IAT | Get JWT auth config |
652
+ | `revoke(params)` | DELETE | `/api/v1/auth/jwt-auth/identities/{identityId}` | JWT, IAT | Remove JWT auth |
653
+
654
+ #### LDAP Auth
655
+
656
+ **Accessor:** `client.identityAuth.ldap`
657
+
658
+ | Method | HTTP | Path | Auth | Description |
659
+ |---|---|---|---|---|
660
+ | `login(params)` | POST | `/api/v1/auth/ldap-auth/login` | None | Authenticate via LDAP |
661
+ | `attach(params)` | POST | `/api/v1/auth/ldap-auth/identities/{identityId}` | JWT, IAT | Attach LDAP auth |
662
+ | `update(params)` | PATCH | `/api/v1/auth/ldap-auth/identities/{identityId}` | JWT, IAT | Update LDAP auth config |
663
+ | `get(params)` | GET | `/api/v1/auth/ldap-auth/identities/{identityId}` | JWT, IAT | Get LDAP auth config |
664
+ | `revoke(params)` | DELETE | `/api/v1/auth/ldap-auth/identities/{identityId}` | JWT, IAT | Remove LDAP auth |
665
+
666
+ #### TLS Certificate Auth
667
+
668
+ **Accessor:** `client.identityAuth.tlsCert`
669
+
670
+ | Method | HTTP | Path | Auth | Description |
671
+ |---|---|---|---|---|
672
+ | `login(params)` | POST | `/api/v1/auth/tls-cert-auth/login` | None | Authenticate via TLS client certificate |
673
+ | `attach(params)` | POST | `/api/v1/auth/tls-cert-auth/identities/{identityId}` | JWT, IAT | Attach TLS cert auth |
674
+ | `update(params)` | PATCH | `/api/v1/auth/tls-cert-auth/identities/{identityId}` | JWT, IAT | Update TLS cert auth config |
675
+ | `get(params)` | GET | `/api/v1/auth/tls-cert-auth/identities/{identityId}` | JWT, IAT | Get TLS cert auth config |
676
+ | `revoke(params)` | DELETE | `/api/v1/auth/tls-cert-auth/identities/{identityId}` | JWT, IAT | Remove TLS cert auth |
677
+
678
+ #### OCI Auth
679
+
680
+ **Accessor:** `client.identityAuth.oci`
681
+
682
+ | Method | HTTP | Path | Auth | Description |
683
+ |---|---|---|---|---|
684
+ | `login(params)` | POST | `/api/v1/auth/oci-auth/login` | None | Authenticate via Oracle Cloud Infrastructure |
685
+ | `attach(params)` | POST | `/api/v1/auth/oci-auth/identities/{identityId}` | JWT, IAT | Attach OCI auth |
686
+ | `update(params)` | PATCH | `/api/v1/auth/oci-auth/identities/{identityId}` | JWT, IAT | Update OCI auth config |
687
+ | `get(params)` | GET | `/api/v1/auth/oci-auth/identities/{identityId}` | JWT, IAT | Get OCI auth config |
688
+ | `revoke(params)` | DELETE | `/api/v1/auth/oci-auth/identities/{identityId}` | JWT, IAT | Remove OCI auth |
689
+
690
+ #### AliCloud Auth
691
+
692
+ **Accessor:** `client.identityAuth.alicloud`
693
+
694
+ | Method | HTTP | Path | Auth | Description |
695
+ |---|---|---|---|---|
696
+ | `login(params)` | POST | `/api/v1/auth/alicloud-auth/login` | None | Authenticate via Alibaba Cloud |
697
+ | `attach(params)` | POST | `/api/v1/auth/alicloud-auth/identities/{identityId}` | JWT, IAT | Attach AliCloud auth |
698
+ | `update(params)` | PATCH | `/api/v1/auth/alicloud-auth/identities/{identityId}` | JWT, IAT | Update AliCloud auth config |
699
+ | `get(params)` | GET | `/api/v1/auth/alicloud-auth/identities/{identityId}` | JWT, IAT | Get AliCloud auth config |
700
+ | `revoke(params)` | DELETE | `/api/v1/auth/alicloud-auth/identities/{identityId}` | JWT, IAT | Remove AliCloud auth |
701
+
702
+ ---
703
+
704
+ ### Projects
705
+
706
+ Manage projects (workspaces), their environments, roles, tags, and trusted IPs.
707
+
708
+ **Accessor:** `client.projects`
709
+
710
+ | Method | HTTP | Path | Auth | Description |
711
+ |---|---|---|---|---|
712
+ | `get(params)` | GET | `/api/v1/workspace/{projectId}` | JWT, IAT | Get project details |
713
+ | `update(params)` | PATCH | `/api/v1/workspace/{projectId}` | JWT, IAT | Update project settings |
714
+ | `delete(params)` | DELETE | `/api/v1/workspace/{projectId}` | JWT, IAT | Delete a project |
715
+ | `listMemberships(params)` | GET | `/api/v1/workspace/{projectId}/memberships` | JWT, IAT | List project members |
716
+ | `listEnvironments(params)` | GET | `/api/v1/workspace/{projectId}/environments` | JWT, IAT | List environments |
717
+ | `createEnvironment(params)` | POST | `/api/v1/workspace/{projectId}/environments` | JWT, IAT | Create an environment |
718
+ | `updateEnvironment(params)` | PATCH | `/api/v1/workspace/{projectId}/environments/{environmentId}` | JWT, IAT | Update an environment |
719
+ | `deleteEnvironment(params)` | DELETE | `/api/v1/workspace/{projectId}/environments/{environmentId}` | JWT, IAT | Delete an environment |
720
+ | `listRoles(params)` | GET | `/api/v1/workspace/{projectId}/roles` | JWT, IAT | List project roles |
721
+ | `listTags(params)` | GET | `/api/v1/workspace/{projectId}/tags` | JWT, IAT | List project tags |
722
+
723
+ ---
724
+
725
+ ### Secrets
726
+
727
+ Manage secrets within project environments.
728
+
729
+ **Accessor:** `client.secrets`
730
+
731
+ | Method | HTTP | Path | Auth | Description |
732
+ |---|---|---|---|---|
733
+ | `list(params)` | GET | `/api/v4/secrets` | JWT, IAT, ST | List secrets in an environment |
734
+ | `getByName(params)` | GET | `/api/v4/secrets/{secretName}` | JWT, IAT, ST | Get a secret by name |
735
+ | `getById(params)` | GET | `/api/v4/secrets/id/{secretId}` | JWT, IAT, ST | Get a secret by ID |
736
+ | `create(params)` | POST | `/api/v4/secrets/{secretName}` | JWT, IAT, ST | Create a secret |
737
+ | `update(params)` | PATCH | `/api/v4/secrets/{secretName}` | JWT, IAT, ST | Update a secret |
738
+ | `delete(params)` | DELETE | `/api/v4/secrets/{secretName}` | JWT, IAT, ST | Delete a secret |
739
+ | `batchCreate(params)` | POST | `/api/v4/secrets/batch` | JWT, IAT, ST | Batch create secrets |
740
+ | `batchUpdate(params)` | PATCH | `/api/v4/secrets/batch` | JWT, IAT, ST | Batch update secrets |
741
+ | `batchDelete(params)` | DELETE | `/api/v4/secrets/batch` | JWT, IAT, ST | Batch delete secrets |
742
+ | `move(params)` | POST | `/api/v4/secrets/move` | JWT, IAT, ST | Move secrets between paths |
743
+ | `getAccessList(params)` | GET | `/api/v1/secrets/{secretName}/access-list` | JWT, IAT, ST | Get access list for a secret |
744
+
745
+ ---
746
+
747
+ ### Secret Folders
748
+
749
+ Manage folders within project environments for organizing secrets.
750
+
751
+ **Accessor:** `client.secretFolders`
752
+
753
+ | Method | HTTP | Path | Auth | Description |
754
+ |---|---|---|---|---|
755
+ | `create(params)` | POST | `/api/v2/folders` | JWT, IAT | Create a folder |
756
+ | `update(params)` | PATCH | `/api/v2/folders/{folderId}` | JWT, IAT | Update a folder |
757
+ | `updateBatch(params)` | PATCH | `/api/v2/folders/batch` | JWT, IAT | Batch update folders |
758
+ | `delete(params)` | DELETE | `/api/v2/folders/{folderIdOrName}` | JWT, IAT | Delete a folder |
759
+ | `list(params)` | GET | `/api/v2/folders` | JWT, IAT | List folders |
760
+ | `getById(params)` | GET | `/api/v2/folders/{id}` | JWT, IAT | Get a folder by ID |
761
+
762
+ **Example: Create and list folders**
763
+
764
+ ```typescript
765
+ // Create a folder
766
+ await client.secretFolders.create({
767
+ projectId: "project-id",
768
+ environment: "production",
769
+ path: "/",
770
+ name: "database-secrets",
771
+ });
772
+
773
+ // List folders
774
+ const folders = await client.secretFolders.list({
775
+ projectId: "project-id",
776
+ environment: "production",
777
+ path: "/",
778
+ });
779
+ ```
780
+
781
+ ---
782
+
783
+ ### Secret Imports
784
+
785
+ Import secrets from one environment/path into another.
786
+
787
+ **Accessor:** `client.secretImports`
788
+
789
+ | Method | HTTP | Path | Auth | Description |
790
+ |---|---|---|---|---|
791
+ | `create(params)` | POST | `/api/v2/secret-imports` | JWT, IAT | Create a secret import |
792
+ | `update(params)` | PATCH | `/api/v2/secret-imports/{secretImportId}` | JWT, IAT | Update a secret import |
793
+ | `delete(params)` | DELETE | `/api/v2/secret-imports/{secretImportId}` | JWT, IAT | Delete a secret import |
794
+ | `resyncReplication(params)` | POST | `/api/v2/secret-imports/{secretImportId}/replication-resync` | JWT, IAT | Resync replicated import |
795
+ | `list(params)` | GET | `/api/v2/secret-imports` | JWT, IAT | List secret imports |
796
+ | `get(params)` | GET | `/api/v2/secret-imports/{secretImportId}` | JWT, IAT | Get a secret import |
797
+ | `getRawSecrets(params)` | GET | `/api/v2/secret-imports/secrets` | JWT, IAT | Get raw imported secrets |
798
+
799
+ ---
800
+
801
+ ### Secret Sharing
802
+
803
+ Create and manage shared secrets with expiration and access controls.
804
+
805
+ **Accessor:** `client.secretSharing`
806
+
807
+ | Method | HTTP | Path | Auth | Description |
808
+ |---|---|---|---|---|
809
+ | `create(params)` | POST | `/api/v1/secret-sharing` | JWT, IAT | Create a shared secret |
810
+ | `delete(params)` | DELETE | `/api/v1/secret-sharing/{sharedSecretId}` | JWT, IAT | Delete a shared secret |
811
+ | `list()` | GET | `/api/v1/secret-sharing` | JWT, IAT | List shared secrets |
812
+ | `get(params)` | GET | `/api/v1/secret-sharing/{sharedSecretId}` | Mixed | Get a shared secret (public access may be allowed) |
813
+
814
+ ---
815
+
816
+ ### Secret Syncs
817
+
818
+ Synchronize secrets to external destinations (AWS Parameter Store, Vercel, GitHub, etc.).
819
+
820
+ **Accessor:** `client.secretSyncs`
821
+
822
+ | Method | HTTP | Path | Auth | Description |
823
+ |---|---|---|---|---|
824
+ | `create(params)` | POST | `/api/v1/secret-syncs/{destination}` | JWT, IAT | Create a sync |
825
+ | `update(params)` | PATCH | `/api/v1/secret-syncs/{destination}/{syncId}` | JWT, IAT | Update a sync |
826
+ | `delete(params)` | DELETE | `/api/v1/secret-syncs/{destination}/{syncId}` | JWT, IAT | Delete a sync |
827
+ | `get(params)` | GET | `/api/v1/secret-syncs/{destination}/{syncId}` | JWT, IAT | Get sync details |
828
+ | `list(params)` | GET | `/api/v1/secret-syncs/{destination}` | JWT, IAT | List syncs for a destination |
829
+ | `trigger(params)` | POST | `/api/v1/secret-syncs/{destination}/{syncId}/sync` | JWT, IAT | Trigger a sync manually |
830
+
831
+ ---
832
+
833
+ ### Webhooks
834
+
835
+ Manage project webhooks for secret change notifications.
836
+
837
+ **Accessor:** `client.webhooks`
838
+
839
+ | Method | HTTP | Path | Auth | Description |
840
+ |---|---|---|---|---|
841
+ | `create(params)` | POST | `/api/v1/webhooks` | JWT, IAT | Create a webhook |
842
+ | `update(params)` | PATCH | `/api/v1/webhooks/{webhookId}` | JWT, IAT | Update a webhook |
843
+ | `delete(params)` | DELETE | `/api/v1/webhooks/{webhookId}` | JWT, IAT | Delete a webhook |
844
+ | `list(params)` | GET | `/api/v1/webhooks` | JWT, IAT | List webhooks |
845
+ | `test(params)` | POST | `/api/v1/webhooks/{webhookId}/test` | JWT, IAT | Send a test webhook |
846
+
847
+ ---
848
+
849
+ ### PKI Certificate Authorities
850
+
851
+ List PKI certificate authorities.
852
+
853
+ **Accessor:** `client.pki.ca`
854
+
855
+ | Method | HTTP | Path | Auth | Description |
856
+ |---|---|---|---|---|
857
+ | `list(params)` | GET | `/api/v2/pki/ca` | JWT, IAT | List certificate authorities |
858
+
859
+ ---
860
+
861
+ ### PKI Certificate Templates
862
+
863
+ Manage certificate templates for issuing and signing certificates.
864
+
865
+ **Accessor:** `client.pki.templates`
866
+
867
+ | Method | HTTP | Path | Auth | Description |
868
+ |---|---|---|---|---|
869
+ | `create(params)` | POST | `/api/v2/pki/certificate-templates` | JWT, IAT | Create a certificate template |
870
+ | `update(params)` | PATCH | `/api/v2/pki/certificate-templates/{templateName}` | JWT, IAT | Update a template |
871
+ | `delete(params)` | DELETE | `/api/v2/pki/certificate-templates/{templateName}` | JWT, IAT | Delete a template |
872
+ | `get(params)` | GET | `/api/v2/pki/certificate-templates/{templateName}` | JWT, IAT | Get a template |
873
+ | `list(params)` | GET | `/api/v2/pki/certificate-templates` | JWT, IAT | List templates |
874
+ | `issueCertificate(params)` | POST | `/api/v2/pki/certificate-templates/{templateName}/issue-certificate` | JWT, IAT | Issue a certificate |
875
+ | `signCertificate(params)` | POST | `/api/v2/pki/certificate-templates/{templateName}/sign-certificate` | JWT, IAT | Sign a CSR |
876
+
877
+ ---
878
+
879
+ ### PKI Alerts
880
+
881
+ Manage PKI certificate expiration alerts.
882
+
883
+ **Accessor:** `client.pki.alerts`
884
+
885
+ | Method | HTTP | Path | Auth | Description |
886
+ |---|---|---|---|---|
887
+ | `create(params)` | POST | `/api/v2/pki/alerts` | JWT, IAT | Create an alert |
888
+ | `list(params)` | GET | `/api/v2/pki/alerts` | JWT, IAT | List alerts |
889
+ | `get(params)` | GET | `/api/v2/pki/alerts/{alertId}` | JWT, IAT | Get an alert |
890
+ | `update(params)` | PATCH | `/api/v2/pki/alerts/{alertId}` | JWT, IAT | Update an alert |
891
+ | `delete(params)` | DELETE | `/api/v2/pki/alerts/{alertId}` | JWT, IAT | Delete an alert |
892
+ | `listCertificates(params)` | GET | `/api/v2/pki/alerts/{alertId}/certificates` | JWT, IAT | List certificates for an alert |
893
+ | `previewCertificates(params)` | POST | `/api/v2/pki/alerts/preview/certificates` | JWT, IAT | Preview certificates matching alert criteria |
894
+
895
+ ---
896
+
897
+ ### PKI Certificates
898
+
899
+ Manage PKI certificates: create, retrieve, renew, revoke, and configure.
900
+
901
+ **Accessor:** `client.pki.certificates`
902
+
903
+ | Method | HTTP | Path | Auth | Description |
904
+ |---|---|---|---|---|
905
+ | `create(params)` | POST | `/api/v1/pki/certificates` | JWT, IAT | Create a certificate |
906
+ | `get(params)` | GET | `/api/v1/pki/certificates/{certificateId}` | JWT, IAT | Get certificate details |
907
+ | `getBody(params)` | GET | `/api/v1/pki/certificates/{certificateId}/certificate` | JWT, IAT | Get certificate body (PEM) |
908
+ | `getBundle(params)` | GET | `/api/v1/pki/certificates/{certificateId}/bundle` | JWT, IAT | Get certificate bundle |
909
+ | `getPrivateKey(params)` | GET | `/api/v1/pki/certificates/{certificateId}/private-key` | JWT, IAT | Get certificate private key |
910
+ | `renew(params)` | POST | `/api/v1/pki/certificates/{certificateId}/renew` | JWT, IAT | Renew a certificate |
911
+ | `revoke(params)` | POST | `/api/v1/pki/certificates/{certificateId}/revoke` | JWT, IAT | Revoke a certificate |
912
+ | `delete(params)` | DELETE | `/api/v1/pki/certificates/{certificateId}` | JWT, IAT | Delete a certificate |
913
+ | `updateConfig(params)` | PATCH | `/api/v1/pki/certificates/{certificateId}/config` | JWT, IAT | Update certificate config |
914
+
915
+ ---
916
+
917
+ ### KMS
918
+
919
+ Key Management Service for encrypting and decrypting data with managed keys.
920
+
921
+ **Accessor:** `client.kms`
922
+
923
+ | Method | HTTP | Path | Auth | Description |
924
+ |---|---|---|---|---|
925
+ | `createKey(params)` | POST | `/api/v1/kms/keys` | JWT, IAT | Create an encryption key |
926
+ | `updateKey(params)` | PATCH | `/api/v1/kms/keys/{keyId}` | JWT, IAT | Update key metadata |
927
+ | `deleteKey(params)` | DELETE | `/api/v1/kms/keys/{keyId}` | JWT, IAT | Delete a key |
928
+ | `getKey(params)` | GET | `/api/v1/kms/keys/{keyId}` | JWT, IAT | Get key details |
929
+ | `listKeys(params)` | GET | `/api/v1/kms/keys` | JWT, IAT | List keys |
930
+ | `encrypt(params)` | POST | `/api/v1/kms/keys/{keyId}/encrypt` | JWT, IAT | Encrypt data |
931
+ | `decrypt(params)` | POST | `/api/v1/kms/keys/{keyId}/decrypt` | JWT, IAT | Decrypt data |
932
+
933
+ **Example: Encrypt and decrypt data**
934
+
935
+ ```typescript
936
+ // Create a key
937
+ const key = await client.kms.createKey({
938
+ projectId: "project-id",
939
+ name: "my-encryption-key",
940
+ });
941
+
942
+ // Encrypt
943
+ const encrypted = await client.kms.encrypt({
944
+ keyId: key.id,
945
+ plaintext: "sensitive-data",
946
+ });
947
+
948
+ // Decrypt
949
+ const decrypted = await client.kms.decrypt({
950
+ keyId: key.id,
951
+ ciphertext: encrypted.ciphertext,
952
+ });
953
+ ```
954
+
955
+ ---
956
+
957
+ ### Integration Auth
958
+
959
+ Manage authentication credentials for third-party integrations.
960
+
961
+ **Accessor:** `client.integrationAuth`
962
+
963
+ | Method | HTTP | Path | Auth | Description |
964
+ |---|---|---|---|---|
965
+ | `create(params)` | POST | `/api/v1/integration-auth/access-token` | JWT, IAT | Create integration auth with access token |
966
+ | `get(params)` | GET | `/api/v1/integration-auth/{integrationAuthId}` | JWT, IAT | Get integration auth details |
967
+ | `delete(params)` | DELETE | `/api/v1/integration-auth/{integrationAuthId}` | JWT, IAT | Delete integration auth |
968
+ | `list(params)` | GET | `/api/v1/integration-auth` | JWT, IAT | List integration auths |
969
+
970
+ ---
971
+
972
+ ### App Connections
973
+
974
+ Manage connections to external applications.
975
+
976
+ **Accessor:** `client.appConnections`
977
+
978
+ | Method | HTTP | Path | Auth | Description |
979
+ |---|---|---|---|---|
980
+ | `create(params)` | POST | `/api/v1/app-connections/{app}` | JWT, IAT | Create a connection |
981
+ | `update(params)` | PATCH | `/api/v1/app-connections/{app}/{connectionId}` | JWT, IAT | Update a connection |
982
+ | `delete(params)` | DELETE | `/api/v1/app-connections/{app}/{connectionId}` | JWT, IAT | Delete a connection |
983
+ | `get(params)` | GET | `/api/v1/app-connections/{app}/{connectionId}` | JWT, IAT | Get connection details |
984
+ | `list(params)` | GET | `/api/v1/app-connections/{app}` | JWT, IAT | List connections for an app |
985
+
986
+ ---
987
+
988
+ ### Admin
989
+
990
+ Super admin endpoints for managing the Infisical instance: configuration, user management, organization management, identity management, integrations, encryption, cache, and usage reports.
991
+
992
+ **Accessor:** `client.admin`
993
+
994
+ | Method | HTTP | Path | Auth | Description |
995
+ |---|---|---|---|---|
996
+ | `bootstrap(params)` | POST | `/api/v1/admin/bootstrap` | None | Bootstrap a new Infisical instance |
997
+ | `signup(params)` | POST | `/api/v1/admin/signup` | None | Admin sign up |
998
+ | `getConfig()` | GET | `/api/v1/admin/config` | None | Get server configuration |
999
+ | `updateConfig(params)` | PATCH | `/api/v1/admin/config` | JWT, IAT | Update server configuration |
1000
+ | `listUsers(params?)` | GET | `/api/v1/admin/user-management/users` | JWT, IAT | List all users |
1001
+ | `deleteUser(params)` | DELETE | `/api/v1/admin/user-management/users/{userId}` | JWT, IAT | Delete a user |
1002
+ | `deleteUsers(params)` | DELETE | `/api/v1/admin/user-management/users` | JWT, IAT | Bulk delete users |
1003
+ | `grantAdminAccess(params)` | PATCH | `/api/v1/admin/user-management/users/{userId}/admin-access` | JWT, IAT | Grant super admin access to a user |
1004
+ | `revokeAdminAccess(params)` | DELETE | `/api/v1/admin/user-management/users/{userId}/admin-access` | JWT, IAT | Revoke super admin access from a user |
1005
+ | `listOrganizations(params?)` | GET | `/api/v1/admin/organization-management/organizations` | JWT, IAT | List all organizations |
1006
+ | `createOrganization(params)` | POST | `/api/v1/admin/organization-management/organizations` | JWT, IAT | Create an organization |
1007
+ | `deleteOrganization(params)` | DELETE | `/api/v1/admin/organization-management/organizations/{organizationId}` | JWT, IAT | Delete an organization |
1008
+ | `deleteOrgMembership(params)` | DELETE | `/api/v1/admin/organization-management/organizations/{organizationId}/memberships/{membershipId}` | JWT, IAT | Remove a member from an organization |
1009
+ | `resendOrgInvite(params)` | POST | `/api/v1/admin/organization-management/organizations/{organizationId}/memberships/{membershipId}/resend-invite` | JWT, IAT | Resend an organization invite |
1010
+ | `joinOrganization(params)` | POST | `/api/v1/admin/organization-management/organizations/{organizationId}/access` | JWT | Join an organization as admin |
1011
+ | `listIdentities(params?)` | GET | `/api/v1/admin/identity-management/identities` | JWT, IAT | List all identities |
1012
+ | `revokeIdentitySuperAdmin(params)` | DELETE | `/api/v1/admin/identity-management/identities/{identityId}/super-admin-access` | JWT, IAT | Revoke super admin access from an identity |
1013
+ | `getIntegrations()` | GET | `/api/v1/admin/integrations` | JWT, IAT | Get admin integrations (Slack, Teams, GitHub) |
1014
+ | `getEncryptionStrategies()` | GET | `/api/v1/admin/encryption-strategies` | JWT, IAT | List encryption strategies |
1015
+ | `updateEncryptionStrategy(params)` | PATCH | `/api/v1/admin/encryption-strategies` | JWT, IAT | Update encryption strategy |
1016
+ | `getEnvOverrides()` | GET | `/api/v1/admin/env-overrides` | JWT, IAT | Get environment variable overrides |
1017
+ | `invalidateCache(params)` | POST | `/api/v1/admin/invalidate-cache` | JWT, IAT | Invalidate server cache |
1018
+ | `getCacheStatus()` | GET | `/api/v1/admin/invalidating-cache-status` | JWT, IAT | Get cache invalidation status |
1019
+ | `generateUsageReport()` | POST | `/api/v1/admin/usage-report/generate` | JWT, IAT | Generate a usage report (CSV) |
1020
+
1021
+ ---
1022
+
1023
+ ### Org Admin
1024
+
1025
+ Organization admin endpoints for managing projects across the organization.
1026
+
1027
+ **Accessor:** `client.orgAdmin`
1028
+
1029
+ | Method | HTTP | Path | Auth | Description |
1030
+ |---|---|---|---|---|
1031
+ | `listProjects(params?)` | GET | `/api/v1/org-admin/projects` | JWT, IAT | List all projects in the organization |
1032
+ | `grantProjectAccess(params)` | POST | `/api/v1/org-admin/projects/{projectId}/grant-admin-access` | JWT | Grant admin access to a project |
1033
+
1034
+ ---
1035
+
1036
+ ## License
1037
+
1038
+ MIT