# Auth ## 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](/using-the-api/scopes/):** None **[Rate limit category](/using-the-api/rate-limits/):** Read ### Returns - `type AuthValidateResponse struct{…}` - `Active bool` Whether the current API key is valid. Always `true` on successful responses. - `Scopes []string` Granted public scopes for the current API key. Empty when the key has full access. - `SubjectType AuthValidateResponseSubjectType` Whether the API key belongs to a `user` or `workspace`. - `const AuthValidateResponseSubjectTypeUser AuthValidateResponseSubjectType = "user"` - `const AuthValidateResponseSubjectTypeWorkspace AuthValidateResponseSubjectType = "workspace"` - `TokenType AuthValidateResponseTokenType` Credential family, always `api_key`. - `const AuthValidateResponseTokenTypeAPIKey AuthValidateResponseTokenType = "api_key"` ### Example ```go 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) } ``` #### Response ```json { "active": true, "scopes": [ "string" ], "subjectType": "user", "tokenType": "api_key" } ``` ## Domain Types ### Auth Validate Response - `type AuthValidateResponse struct{…}` - `Active bool` Whether the current API key is valid. Always `true` on successful responses. - `Scopes []string` Granted public scopes for the current API key. Empty when the key has full access. - `SubjectType AuthValidateResponseSubjectType` Whether the API key belongs to a `user` or `workspace`. - `const AuthValidateResponseSubjectTypeUser AuthValidateResponseSubjectType = "user"` - `const AuthValidateResponseSubjectTypeWorkspace AuthValidateResponseSubjectType = "workspace"` - `TokenType AuthValidateResponseTokenType` Credential family, always `api_key`. - `const AuthValidateResponseTokenTypeAPIKey AuthValidateResponseTokenType = "api_key"`