# Creates an API key for the given Environment

Creates an API key for the given Environment

Endpoint: POST /cf/admin/apikey
Version: 1.0
Security: x-api-key

## Query parameters:

  - `accountIdentifier` (string, required)
    Account Identifier

  - `orgIdentifier` (string, required)
    Organization Identifier

  - `environmentIdentifier` (string, required)
    Environment Identifier

  - `projectIdentifier` (string, required)
    The Project identifier

## Request fields (application/json):

  - `description` (string)
    Example: "This key is for server side production environment"

  - `expiredAt` (integer)

  - `identifier` (string, required)
    Example: "production-environment"

  - `name` (string, required)
    Example: "production-env-key"

  - `type` (string, required)
    The type of key depending on the SDK that is being used.
    Enum: "Server", "Client"

## Response 201 fields (application/json):

  - `apiKey` (string, required)
    The Key will be shown only on create. On subsequent GET calls, only the masked APIKeys will be returned
    Example: "b03af1cd-bd3f-472b-a4b0-c9c9c09c642e"

  - `applicationIds` (array)
    A list of Application IDs

  - `applicationIds.applicationId` (string, required)
    The application ID of the application
    Example: "my-springboot-application"

  - `applicationIds.lastUsed` (integer, required)
    The timestamp of when this application was last accessed
    Example: 1726744149

  - `identifier` (string, required)
    The environment that this key was created in
    Example: "production"

  - `key` (string)
    A hash of API key
    Example: "3c940273c34e8a9b21"

  - `lastUsed` (integer)
    Timestamp of the last time the API key was used
    Example: 1726744149

  - `name` (string, required)
    The user friendly identifier for the API Key
    Example: "Production Server Key"

  - `type` (string, required)
    The type of key depending on the SDK that is being used.
    Enum: "server", "client"

## Response 400 fields (application/json):

  - `code` (string, required)
    The http error code
    Example: 404

  - `details` (object)
    Additional details about the error

  - `message` (string, required)
    The reason the request failed
    Example: "Error retrieving projects, organization 'default_org' does not exist"


