godo.SpacesKeys.Get()

Generated on 5 Nov 2026 from godo version v1.236.0

Usage

client.SpacesKeys.Get(ctx context.Context, accessKey string) (*godo.SpacesKey, *godo.Response, error)

Description

Get retrieves a Spaces key.

This method sends a GET request to /v2/spaces/keys/{}.

Parameters

accessKey string required

Returns

*godo.SpacesKey
*godo.Response

The HTTP response, with pagination Links, Meta, and Rate limit information.

error

Non-nil when the request fails. API errors are returned as *godo.ErrorResponse.

Fields of godo.SpacesKey

SpacesKey represents a DigitalOcean Spaces key

Name string

JSON key: name

AccessKey string

JSON key: access_key

SecretKey string

JSON key: secret_key

Grants []*godo.Grant

JSON key: grants

CreatedAt string

JSON key: created_at

Request Sample

Show Request Sample
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	result, _, err := client.SpacesKeys.Get(ctx, "<your-access-key>")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", result)
}

Response Example

Show Response Example
{
  "key": {
    "name": "read-only-key",
    "access_key": "DOACCESSKEYEXAMPLE",
    "grants": [
      {
        "bucket": "my-bucket",
        "permission": "read"
      }
    ],
    "created_at": "2018-07-19T15:04:16Z"
  }
}

More Information

See GET /v2/spaces/keys/{} in the API reference for additional detail on responses, headers, parameters, and more.

See the Go package documentation for the source of this method.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.