# CfnAPIKeyProps

Properties for defining a `CfnAPIKey`.

Extends: CfnAPIKeyProps
Used as props by: CfnAPIKey

- Source: Generated code
- Type last changed: v2.119.0 · 11 Jan 2024

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_location as location } from 'aws-cdk-lib';
const cfnAPIKeyProps: location.CfnAPIKeyProps = {
  keyName: 'keyName',
  restrictions: {
    allowActions: ['allowActions'],
    allowResources: ['allowResources'],

    // the properties below are optional
    allowAndroidApps: [{
      certificateFingerprint: 'certificateFingerprint',
      package: 'package',
    }],
    allowAppleApps: [{
      bundleId: 'bundleId',
    }],
    allowReferers: ['allowReferers'],
  },

  // the properties below are optional
  description: 'description',
  expireTime: 'expireTime',
  forceDelete: false,
  forceUpdate: false,
  noExpiry: false,
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
```

## Properties

- `description`: string — Updates the description for the API key resource.

- `expireTime`: string — The optional timestamp for when the API key resource will expire in [ISO 8601 format](https://docs.aws.amazon.com/https://www.iso.org/iso-8601-date-and-time-format.html) .

- `forceDelete`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — ForceDelete bypasses an API key's expiry conditions and deletes the key.

  Set the parameter `true` to delete the key or to `false` to not preemptively delete the API key.

  Valid values: `true` , or `false` .

  > This action is irreversible. Only use ForceDelete if you are certain the key is no longer in use.

- `forceUpdate`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — The boolean flag to be included for updating `ExpireTime` or Restrictions details.

  Must be set to `true` to update an API key resource that has been used in the past 7 days. `False` if force update is not preferred.

- `keyName`: string (required) — A custom name for the API key resource.

  Requirements:

  - Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).
  - Must be a unique API key name.
  - No spaces allowed. For example, `ExampleAPIKey` .

- `noExpiry`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Whether the API key should expire.

  Set to `true` to set the API key to have no expiration time.

- `restrictions`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAPIKey.ApiKeyRestrictionsProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_location.CfnAPIKey.ApiKeyRestrictionsProperty.html) (required) — The API key restrictions for the API key resource.

- `tags`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — Applies one or more tags to the map resource.

  A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.
