Validate current API key
client.Auth.Validate(ctx) (*AuthValidateResponse, error)
GET/v1/auth/validate
Returns metadata for the current API key, including the subject type and granted public scopes. Use this endpoint to confirm a key is active before making scoped API requests.
Required scope: None
Rate limit category: Read
Validate current API key
package main
import (
"context"
"fmt"
"github.com/Lightfld/lightfield-go"
"github.com/Lightfld/lightfield-go/option"
)
func main() {
client := githubcomlightfldlightfieldgo.NewClient(
option.WithAPIKey("My API Key"),
)
authValidateResponse, err := client.Auth.Validate(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", authValidateResponse.Active)
}
{
"active": true,
"scopes": [
"string"
],
"subjectType": "user",
"tokenType": "api_key"
}Returns Examples
{
"active": true,
"scopes": [
"string"
],
"subjectType": "user",
"tokenType": "api_key"
}