Skip to main content
PATCH
/
auth
/
api_keys
/
{api_key_id}
Go (SDK)
package main

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

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

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

    res, err := s.APIKeys.UpdateAPIKey(ctx, "tok_lpbV0DgRq4AWz", components.UpdateAPIKey{
        Data: &components.UpdateAPIKeyData{
            ID: latitudeshgosdk.Pointer("tok_lpbV0DgRq4AWz"),
            Type: components.UpdateAPIKeyTypeAPIKeys,
            Attributes: &components.UpdateAPIKeyAttributes{
                Name: latitudeshgosdk.Pointer("Updated Name"),
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
{
  "data": {
    "id": "tok_lpbV0DgRq4AWz",
    "type": "api_keys",
    "attributes": {
      "name": "Updated Name",
      "token_last_slice": "c10e6",
      "api_version": "2023-06-01",
      "read_only": false,
      "allowed_ips": null,
      "created_at": "2026-01-14T15:56:30+00:00",
      "updated_at": "2026-01-14T15:56:30+00:00",
      "last_used_at": null,
      "user": {
        "id": "user_YLMV5L9oYRFoe4Jo4l2PCGKr8bBa",
        "email": "[email protected]"
      }
    }
  },
  "meta": {}
}

Authorizations

Authorization
string
header
required

Path Parameters

api_key_id
string
required

Body

data
object

Response

200 - application/vnd.api+json

Success - Update name without rotating token

data
object