[PERS SDK - v2.3.26](/sdk-reference/readme) / [Exports](/sdk-reference/modules) / ApiKeyApi

# Class: ApiKeyApi

Platform-Agnostic API Key API Client

Handles API key management operations for tenant admins.
All operations require admin authentication and operate within tenant context.

## Table of contents

### Constructors

- [constructor](/sdk-reference/classes/apikeyapi#constructor)


### Methods

- [getTenantApiKeys](/sdk-reference/classes/apikeyapi#gettenantapikeys)
- [createApiKey](/sdk-reference/classes/apikeyapi#createapikey)
- [revokeApiKey](/sdk-reference/classes/apikeyapi#revokeapikey)


## Constructors

### constructor

• **new ApiKeyApi**(`apiClient`): [`ApiKeyApi`](/sdk-reference/classes/apikeyapi)

#### Parameters

| Name | Type |
|  --- | --- |
| `apiClient` | [`PersApiClient`](/sdk-reference/classes/persapiclient) |


#### Returns

[`ApiKeyApi`](/sdk-reference/classes/apikeyapi)

#### Defined in

[api-key/api/api-key-api.ts:21](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/api-key/api/api-key-api.ts#L21)

## Methods

### getTenantApiKeys

▸ **getTenantApiKeys**(`type?`, `includeRevoked?`, `options?`): `Promise`<`PaginatedResponseDTO`<`ApiKeyDTO`>>

ADMIN: Get all tenant API keys

#### Parameters

| Name | Type | Default value | Description |
|  --- | --- | --- | --- |
| `type?` | `IntegrationApiKeyType` | `undefined` | Optional filter by integration API key type (database-stored tokens that can be revoked) |
| `includeRevoked` | `boolean` | `false` | Include revoked API keys in results (default: false) |
| `options?` | `PaginationOptions` | `undefined` | Pagination options (page, limit, sortBy, sortOrder) |


#### Returns

`Promise`<`PaginatedResponseDTO`<`ApiKeyDTO`>>

Paginated response with API keys for the current tenant

#### Defined in

[api-key/api/api-key-api.ts:31](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/api-key/api/api-key-api.ts#L31)

### createApiKey

▸ **createApiKey**(`req`): `Promise`<`ApiKeyCreatedDTO`>

ADMIN: Create new API key

#### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `req` | `ApiKeyRequestDTO` | API key creation request containing type, name, and optional configuration |


#### Returns

`Promise`<`ApiKeyCreatedDTO`>

Created API key with the actual key (store securely - only returned once)

#### Defined in

[api-key/api/api-key-api.ts:46](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/api-key/api/api-key-api.ts#L46)

### revokeApiKey

▸ **revokeApiKey**(`apiKeyId`): `Promise`<`ApiKeyVerificationDTO`>

ADMIN: Revoke API key

#### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `apiKeyId` | `string` | Unique identifier of the API key to revoke |


#### Returns

`Promise`<`ApiKeyVerificationDTO`>

API key verification details with revocation status

#### Defined in

[api-key/api/api-key-api.ts:56](https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/api-key/api/api-key-api.ts#L56)