## Create

`client.Admin.APIKeys.New(ctx, body) (*AdminAPIKeyNewResponse, error)`

**post** `/compute/v1/admin/api-keys`

Create a workspace API key

### Parameters

- `body AdminAPIKeyNewParams`

  - `Name param.Field[string]`

    API key name

  - `AllowedIPs param.Field[[]string]`

    IP addresses allowed to use this key (IPv4 or IPv6). An empty array (the default) means all IPs are allowed.

  - `ExpiresInDays param.Field[int64]`

    Days until the key expires. Omit for a key that does not expire.

  - `Mode param.Field[AdminAPIKeyNewParamsMode]`

    Key mode. Test keys create test-mode resources with synthetic data.

    - `const AdminAPIKeyNewParamsModeLive AdminAPIKeyNewParamsMode = "live"`

    - `const AdminAPIKeyNewParamsModeTest AdminAPIKeyNewParamsMode = "test"`

  - `WorkspaceID param.Field[string]`

    Workspace ID to scope this key to. Omit for default workspace.

### Returns

- `type AdminAPIKeyNewResponse struct{…}`

  - `Key string`

    The full API key. This is only shown once — store it securely.

  - `KeyDetails AdminAPIKeyNewResponseKeyDetails`

    - `ID string`

      API key ID

    - `AllowedIPs []string`

      IP addresses allowed to use this key. An empty array means all IPs are allowed.

    - `CreatedAt Time`

    - `ExpiresAt Time`

      When the key expires. Null if the key does not expire.

    - `IsActive bool`

    - `KeyPrefix string`

      First 12 characters of the key

    - `KeyType Workspace`

      - `const WorkspaceWorkspace Workspace = "workspace"`

    - `LastUsedAt Time`

    - `Livemode bool`

      Whether this is a live API key (false for test keys).

    - `Name string`

      API key name

    - `WorkspaceID string`

      Workspace this key is scoped to

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/boltz-bio/boltz-api-go"
  "github.com/boltz-bio/boltz-api-go/option"
)

func main() {
  client := boltzapi.NewClient(
    option.WithAPIKey("My API Key"),
  )
  apiKey, err := client.Admin.APIKeys.New(context.TODO(), boltzapi.AdminAPIKeyNewParams{
    Name: "x",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", apiKey.Key)
}
```
