ClientKeysManager
Client Keys management client
Provides methods for managing client keys for service-to-service authentication. Client keys allow external services to authenticate without user credentials.
Example
Section titled “Example”const client = createClient({ url: 'http://localhost:8080' })await client.auth.login({ email: 'user@example.com', password: 'password' })
// Create a client keyconst { client_key, key } = await client.management.clientKeys.create({ name: 'Production Service', scopes: ['read:users', 'write:users'], rate_limit_per_minute: 100})
// List client keysconst { client_keys } = await client.management.clientKeys.list()Constructors
Section titled “Constructors”new ClientKeysManager()
Section titled “new ClientKeysManager()”new ClientKeysManager(
fetch):ClientKeysManager
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetch | FluxbaseFetch |
Returns
Section titled “Returns”Methods
Section titled “Methods”create()
Section titled “create()”create(
request):Promise<CreateClientKeyResponse>
Create a new client key
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
request | CreateClientKeyRequest | Client key configuration |
Returns
Section titled “Returns”Promise<CreateClientKeyResponse>
Created client key with the full key value (only shown once)
Example
Section titled “Example”const { client_key, key } = await client.management.clientKeys.create({ name: 'Production Service', description: 'Client key for production service', scopes: ['read:users', 'write:users'], rate_limit_per_minute: 100, expires_at: '2025-12-31T23:59:59Z'})
// Store the key securely - it won't be shown againconsole.log('Client Key:', key)delete()
Section titled “delete()”delete(
keyId):Promise<DeleteClientKeyResponse>
Delete a client key
Permanently removes the client key from the system.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
keyId | string | Client key ID |
Returns
Section titled “Returns”Promise<DeleteClientKeyResponse>
Deletion confirmation
Example
Section titled “Example”await client.management.clientKeys.delete('key-uuid')console.log('Client key deleted')get(
keyId):Promise<ClientKey>
Get a specific client key by ID
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
keyId | string | Client key ID |
Returns
Section titled “Returns”Promise<ClientKey>
Client key details
Example
Section titled “Example”const clientKey = await client.management.clientKeys.get('key-uuid')console.log('Last used:', clientKey.last_used_at)list()
Section titled “list()”list():
Promise<ListClientKeysResponse>
List all client keys for the authenticated user
Returns
Section titled “Returns”Promise<ListClientKeysResponse>
List of client keys (without full key values)
Example
Section titled “Example”const { client_keys, total } = await client.management.clientKeys.list()
client_keys.forEach(key => { console.log(`${key.name}: ${key.key_prefix}... (expires: ${key.expires_at})`)})revoke()
Section titled “revoke()”revoke(
keyId):Promise<RevokeClientKeyResponse>
Revoke a client key
Revoked keys can no longer be used but remain in the system for audit purposes.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
keyId | string | Client key ID |
Returns
Section titled “Returns”Promise<RevokeClientKeyResponse>
Revocation confirmation
Example
Section titled “Example”await client.management.clientKeys.revoke('key-uuid')console.log('Client key revoked')update()
Section titled “update()”update(
keyId,updates):Promise<ClientKey>
Update a client key
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
keyId | string | Client key ID |
updates | UpdateClientKeyRequest | Fields to update |
Returns
Section titled “Returns”Promise<ClientKey>
Updated client key
Example
Section titled “Example”const updated = await client.management.clientKeys.update('key-uuid', { name: 'Updated Name', rate_limit_per_minute: 200})