Skip to main content
POST
/
storage
/
v4
/
ssh_keys
Python
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
ssh_key = client.storage.ssh_keys.create(
    name="my-production-key",
    public_key="ssh-rsa AAAAB3NzaC1yc2EAAA... user@example.com",
)
print(ssh_key.id)
{
  "created_at": "2025-08-05 09:15:00+00:00",
  "id": 123,
  "name": "my-production-key",
  "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAA... user@example.com"
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Body

application/json
name
string
required

User-defined name for the SSH key

Example:

"my-production-key"

public_key
string
required

The SSH public key content (ssh-rsa or ssh-ed25519 format)

Example:

"ssh-rsa AAAAB3NzaC1yc2EAAA... user@example.com"

Response

SSHKeyV4

created_at
string<date-time>
required

ISO 8601 timestamp when the SSH key was created

Example:

"2025-08-05 09:15:00+00:00"

id
integer<int64>
required

Unique identifier for the SSH key

Example:

123

name
string
required

User-defined name for the SSH key

Example:

"my-production-key"

public_key
string
required

The SSH public key content

Example:

"ssh-rsa AAAAB3NzaC1yc2EAAA... user@example.com"