---
title: "Import or generate keypair"
method: POST
path: "/cloud/v2/keypairs"
tags: ["SSH Keys"]
deprecated: true
---

# Import or generate keypair

`POST /cloud/v2/keypairs`

> **Deprecated.**

To generate a keypair do not use the `public_key` parameter in the request body

## Request body

- CreateKeypairV2Serializer
  - `project_id` integer, required — Project ID
  - `public_key` string, nullable — Public part of the key. To generate public and private keys in the platform, do not specify the parameter in the request body.
  - `shared_in_project` boolean, nullable — Keypair is shared for all users in the project. Default True
  - `sshkey_name` string, required — Keypair name

## Response `200`

OK

- KeypairSerializer
  - `created_at` string, date-time, nullable — Keypair creation datetime
  - `fingerprint` string, nullable — Key fingerprint
  - `id` string, required — Key ID, equal to `sshkey_name`
  - `name` string, required — Keypair name
  - `private_key` string, nullable — Private part of the key
  - `project_id` integer, nullable — Project ID
  - `public_key` string, required — Public part of the key. To generate public and private keys in the platform, do not specify the parameter in the request body.
  - `shared_in_project` boolean, required — Keypair is shared for all users in the project
  - `state` 'ACTIVE' | 'DELETING', required

---

[API](https://skmtc.net/g-core/apis/gcore-openapi.md) · [All operations](https://skmtc.net/g-core/apis/gcore-openapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/g-core/gcore-openapi/revisions/09e652815095/schema)
