Skip to main content
POST
/
ssh_keys
Go (SDK)
package main

import(
	"context"
	"os"
	latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
	"github.com/latitudesh/latitudesh-go-sdk/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := latitudeshgosdk.New(
        latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
    )

    res, err := s.SSHKeys.Create(ctx, operations.PostSSHKeySSHKeysRequestBody{
        Data: operations.PostSSHKeySSHKeysData{
            Type: operations.PostSSHKeySSHKeysTypeSSHKeys,
            Attributes: &operations.PostSSHKeySSHKeysAttributes{
                Name: latitudeshgosdk.Pointer("SSH Key"),
                Project: latitudeshgosdk.Pointer("proj_mw49QDB5qagKb"),
                PublicKey: latitudeshgosdk.Pointer("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOLFnjGP3Jsh1usHNS2EILgfqZNC9pOvNqBZqxH+qNAdZdQCzy2csMuiq+ZwLA8Mm4Vo5CvSgBHs/kuZRUKyTl+79YUMZIj8PhHzL4XbdqX1ZnAIklHWcJaveB0+UXLEPKGzFIFq+FkuwtiXQsVe5NnSpIDYgpzhqEs38NsnXvsubKphGUdARDhaxvMdUUl4YsAtLHKMzSyIvE6xwfTtIVwA9bZt/8GoBzrn9px9PEcf25Rgd2NhOYs3WYcZuwvRmfcFdi2vGhVqTPqL9n16R/n5jknxHYrTyqWNxJdpdvg2YqXpN7vnFNoOjYFD6EahJ0pF/+WL4tPCIkLfoaVaSx"),
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
{
  "data": {
    "id": "ssh_1ZJrdxw5Og4LV",
    "type": "ssh_keys",
    "attributes": {
      "tags": [],
      "name": "SSH Key",
      "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOLFnjGP3Jsh1usHNS2EILgfqZNC9pOvNqBZqxH+qNAdZdQCzy2csMuiq+ZwLA8Mm4Vo5CvSgBHs/kuZRUKyTl+79YUMZIj8PhHzL4XbdqX1ZnAIklHWcJaveB0+UXLEPKGzFIFq+FkuwtiXQsVe5NnSpIDYgpzhqEs38NsnXvsubKphGUdARDhaxvMdUUl4YsAtLHKMzSyIvE6xwfTtIVwA9bZt/8GoBzrn9px9PEcf25Rgd2NhOYs3WYcZuwvRmfcFdi2vGhVqTPqL9n16R/n5jknxHYrTyqWNxJdpdvg2YqXpN7vnFNoOjYFD6EahJ0pF/+WL4tPCIkLfoaVaSx",
      "fingerprint": "0a:00:34:53:51:0e:a5:4e:06:2c:d7:16:88:96:82:f3",
      "created_at": "2025-07-16T18:37:07+00:00",
      "updated_at": "2025-07-16T18:37:07+00:00",
      "user": {
        "id": "user_wwjA0m2L4BTXAXMw4X17hMlZl6z",
        "first_name": "Genevive",
        "last_name": "Shields",
        "email": "[email protected]",
        "created_at": "2025-04-28T00:00:00.000Z",
        "updated_at": "2024-11-18T00:00:00.000Z",
        "role": {
          "id": "role_bj5BPjB5o7iyw0QbxWZatE5K81YQ",
          "name": "owner",
          "created_at": "2024-12-04T00:00:00.000Z",
          "updated_at": "2026-01-16T00:00:00.000Z"
        }
      }
    }
  },
  "meta": {}
}

Authorizations

Authorization
string
header
required

Body

data
object
required

Response

201 - application/vnd.api+json

Created

data
object