> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create SSH key

> Creates an SSH public key for SFTP storage access. These keys are used for passwordless authentication to SFTP storages.



## OpenAPI

````yaml /api-reference/services_documented/object_storage_api.yaml post /storage/v4/ssh_keys
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Object Storage API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-14T07:00:22.640261+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Notifications
    x-displayName: Notifications
  - name: SSHKeys
    x-displayName: SSHKeys
  - name: Storage Locations
    x-displayName: Storage Locations
  - name: Storage
    x-displayName: Storage
  - name: Storage Statistics
    x-displayName: Storage Statistics
  - name: S3-Compatible Storage
    x-displayName: S3-Compatible Storage
  - name: SFTP Storage
    x-displayName: SFTP Storage
paths:
  /storage/v4/ssh_keys:
    post:
      tags:
        - SSHKeys
      summary: Create SSH key
      description: >-
        Creates an SSH public key for SFTP storage access. These keys are used
        for passwordless authentication to SFTP storages.
      operationId: createSshKeyV4
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SSHKeyCreateBodyV4'
        required: true
      responses:
        '201':
          description: SSHKeyV4
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SSHKeyV4'
        '400':
          description: ErrResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrResponse'
        '401':
          description: ErrResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrResponse'
        '409':
          description: ErrResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrResponse'
      x-codeSamples:
        - lang: Python
          source: |-
            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)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/option\"\n\t\"github.com/G-Core/gcore-go/storage\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tsshKey, err := client.Storage.SSHKeys.New(context.TODO(), storage.SSHKeyNewParams{\n\t\tName:      \"my-production-key\",\n\t\tPublicKey: \"ssh-rsa AAAAB3NzaC1yc2EAAA... user@example.com\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", sshKey.ID)\n}\n"
components:
  schemas:
    SSHKeyCreateBodyV4:
      title: SSHKeyCreateBodyV4 Request body for creating an SSH key.
      required:
        - name
        - public_key
      type: object
      properties:
        name:
          type: string
          description: User-defined name for the SSH key
          example: my-production-key
        public_key:
          type: string
          description: The SSH public key content (ssh-rsa or ssh-ed25519 format)
          example: ssh-rsa AAAAB3NzaC1yc2EAAA... user@example.com
    SSHKeyV4:
      title: >-
        SSHKeyV4 SSH public key for passwordless SFTP storage authentication.
        Link keys to SFTP storages via the storage update endpoint.
      required:
        - created_at
        - id
        - name
        - public_key
      type: object
      properties:
        created_at:
          type: string
          description: ISO 8601 timestamp when the SSH key was created
          format: date-time
          example: '2025-08-05T09:15:00Z'
        id:
          type: integer
          description: Unique identifier for the SSH key
          format: int64
          example: 123
        name:
          type: string
          description: User-defined name for the SSH key
          example: my-production-key
        public_key:
          type: string
          description: The SSH public key content
          example: ssh-rsa AAAAB3NzaC1yc2EAAA... user@example.com
    ErrResponse:
      type: object
      properties:
        error:
          type: string
      description: ErrResponse is an error response
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````