# Api Key

> **Package : spaceone.api.identity.v1**

## APIKey

{% hint style="info" %}
**APIKey Methods:**
{% endhint %}

| Method                  | Request                                     | Response                                                                                                           |
| ----------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create)   | [CreateAPIKeyRequest](#createapikeyrequest) | [APIKeyInfo](#apikeyinfo)                                                                                          |
| [**enable**](#enable)   | [APIKeyRequest](#apikeyrequest)             | [APIKeyInfo](#apikeyinfo)                                                                                          |
| [**disable**](#disable) | [APIKeyRequest](#apikeyrequest)             | [APIKeyInfo](#apikeyinfo)                                                                                          |
| [**delete**](#delete)   | [APIKeyRequest](#apikeyrequest)             | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)         | [GetAPIKeyRequest](#getapikeyrequest)       | [APIKeyInfo](#apikeyinfo)                                                                                          |
| [**list**](#list)       | [APIKeyQuery](#apikeyquery)                 | [APIKeysInfo](#apikeysinfo)                                                                                        |
| [**stat**](#stat)       | [APIKeyStatQuery](#apikeystatquery)         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /identity/v1/api-keys

| Type     | Message                                     |
| -------- | ------------------------------------------- |
| Request  | [CreateAPIKeyRequest](#createapikeyrequest) |
| Response | [APIKeyInfo](#apikeyinfo)                   |

### enable

> **PUT** /identity/v1/api-key/{api\_key\_id}/enable

| Type     | Message                         |
| -------- | ------------------------------- |
| Request  | [APIKeyRequest](#apikeyrequest) |
| Response | [APIKeyInfo](#apikeyinfo)       |

### disable

> **PUT** /identity/v1/api-key/{api\_key\_id}/disable

| Type     | Message                         |
| -------- | ------------------------------- |
| Request  | [APIKeyRequest](#apikeyrequest) |
| Response | [APIKeyInfo](#apikeyinfo)       |

### delete

> **DELETE** /identity/v1/api-key/{api\_key\_id}

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [APIKeyRequest](#apikeyrequest)                                                                                  |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

### get

> **GET** /identity/v1/api-key/{api\_key\_id}

| Type     | Message                               |
| -------- | ------------------------------------- |
| Request  | [GetAPIKeyRequest](#getapikeyrequest) |
| Response | [APIKeyInfo](#apikeyinfo)             |

### list

> **GET** /identity/v1/api-keys
>
> **POST** /identity/v1/api-keys/search

| Type     | Message                     |
| -------- | --------------------------- |
| Request  | [APIKeyQuery](#apikeyquery) |
| Response | [APIKeysInfo](#apikeysinfo) |

### stat

> **POST** /identity/v1/api-keys/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [APIKeyStatQuery](#apikeystatquery)                                                                                |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

##

## Message

### APIKeyInfo

| Field              | Type                                                           | Description |
| ------------------ | -------------------------------------------------------------- | ----------- |
| api\_key\_id       | string                                                         |             |
| api\_key           | string                                                         |             |
| state              | <ul><li>NONE\_STATE</li><li>ENABLED</li><li>DISABLED</li></ul> |             |
| user\_id           | string                                                         |             |
| domain\_id         | string                                                         |             |
| last\_accessed\_at | string                                                         |             |
| created\_at        | string                                                         |             |

### APIKeyQuery

| Field        | Type                                                                                               | Required | Description |
| ------------ | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| query        | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ✘        |             |
| api\_key\_id | string                                                                                             | ✘        |             |
| state        | <ul><li>NONE\_STATE</li><li>ENABLED</li><li>DISABLED</li></ul>                                     | ✘        |             |
| user\_id     | string                                                                                             | ✘        |             |
| domain\_id   | string                                                                                             | ✔        |             |

### APIKeyRequest

| Field        | Type   | Required | Description |
| ------------ | ------ | :------: | ----------- |
| api\_key\_id | string |     ✔    |             |
| domain\_id   | string |     ✔    |             |

### APIKeyStatQuery

| Field      | Type                                                                                                             | Required | Description |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    |             |
| domain\_id | string                                                                                                           |     ✔    |             |

### APIKeysInfo

| Field        | Type                                                                                            | Description |
| ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| results      | [list of APIKeyInfo](#apikeyinfo)                                                               |             |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### CreateAPIKeyRequest

| Field      | Type   | Required | Description |
| ---------- | ------ | :------: | ----------- |
| user\_id   | string |     ✔    |             |
| domain\_id | string |     ✔    |             |

### GetAPIKeyRequest

| Field        | Type           | Required | Description |
| ------------ | -------------- | :------: | ----------- |
| api\_key\_id | string         |     ✔    |             |
| domain\_id   | string         |     ✔    |             |
| only         | list of string |     ✘    |             |
