Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/cursor

src/me.ts

27 lines · 713 B · TypeScript
import { cursorApi } from './lib/client.ts'

export type ApiKeyInfo = {
	apiKeyName?: string
	createdAt?: string
	userId?: number
	userEmail?: string
	userFirstName?: string
	userLastName?: string
	[key: string]: unknown
}

/**
 * Retrieve information about the API key used for authentication.
 *
 * @returns API key metadata (name, owner, creation time).
 * @example
 * import { apiKeyInfo } from 'kody:@kentcdodds/cursor/me'
 * const info = await apiKeyInfo()
 * // => { apiKeyName: 'Production', userEmail: 'you@example.com' }
 */
export async function apiKeyInfo(): Promise<ApiKeyInfo> {
	return cursorApi<ApiKeyInfo>({ path: '/v1/me' })
}

/** Default export: API key metadata. */
export default apiKeyInfo