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

# Add SSH key

> Validates and stores an SSH public key. Minimum RSA 2048-bit, Ed25519 recommended.



## OpenAPI

````yaml /openapi.json post /api/v1/user/ssh-keys
openapi: 3.1.0
info:
  title: Phala Cloud API
  version: 0.1.0
servers:
  - url: https://cloud-api.phala.com
security: []
tags:
  - name: CVMs
    description: Confidential Virtual Machine (CVM) lifecycle management on Phala Network
  - name: Apps
    description: App template management and CVM deployment from app blueprints
  - name: Webhooks
    description: Manage webhook endpoints and monitor delivery history
  - name: SSH Keys
    description: SSH public key management for CVM access
  - name: KMS
    description: >-
      Key Management Service — key derivation, on-chain anchoring, and
      inspection
  - name: Instance Types
    description: Available hardware configurations for CVM deployment
  - name: Attestations
    description: Remote attestation and TEE verification endpoints
paths:
  /api/v1/user/ssh-keys:
    post:
      tags:
        - SSH Keys
      summary: Add SSH key
      description: >-
        Validates and stores an SSH public key. Minimum RSA 2048-bit, Ed25519
        recommended.
      operationId: create_user_ssh_key_api_v1_user_ssh_keys_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SshKeyCreateRequest'
        required: true
      responses:
        '201':
          description: Key created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SshKeyResponse'
        '400':
          description: Invalid key format or key too weak
        '401':
          description: Not authenticated
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SshKeyCreateRequest:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
          description: Human-readable name for the key
        public_key:
          type: string
          title: Public Key
          description: OpenSSH format public key
      type: object
      required:
        - name
        - public_key
      title: SshKeyCreateRequest
      description: Request model for creating an SSH key.
    SshKeyResponse:
      properties:
        id:
          type: string
          title: Id
          description: Key hashid
        user_id:
          type: string
          title: User Id
          description: Owner user hashid
        name:
          type: string
          title: Name
          description: Human-readable name
        public_key:
          type: string
          title: Public Key
          description: OpenSSH format public key
        fingerprint:
          type: string
          title: Fingerprint
          description: SHA256 fingerprint
        key_type:
          type: string
          title: Key Type
          description: Algorithm (ed25519, rsa, etc)
        source:
          type: string
          title: Source
          description: 'Origin: manual or github'
        key_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Key Metadata
          description: Extra data like bit length
        last_synced_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Synced At
          description: Last GitHub sync timestamp
        created_at:
          type: string
          title: Created At
          description: Creation timestamp
        updated_at:
          type: string
          title: Updated At
          description: Last update timestamp
      type: object
      required:
        - id
        - user_id
        - name
        - public_key
        - fingerprint
        - key_type
        - source
        - created_at
        - updated_at
      title: SshKeyResponse
      description: SSH key details returned by API.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````