KeyEnvKeyEnv
API Reference

Auth

Authentication and user sync

Auth

Authentication and user sync

Sync user from Clerk

POST /api/v1/auth/sync

Syncs user data from Clerk to KeyEnv. This should be called after a user signs up or logs in to ensure their account exists in KeyEnv. Creates a personal team for new users.

Operation ID: authSync · Authentication: Authorization: Bearer <token>

Responses

StatusDescriptionBody
200User synced successfullyUser
401Authentication requiredError

Response body (200)

FieldTypeDescription
idstring (uuid)
clerk_idstring
emailstring (email)
namestring
avatar_urlstring (uri)
auth_typeenum (user, service_token)Authentication type. Only present for service token auth.
team_idstring (uuid)Team ID. Only present for service token auth.
project_idsstring (uuid)[]Project IDs the token has access to. Only present for service token auth. Tokens can access multiple projects.
scopesstring[]Token scopes (e.g., read, write). Only present for service token auth.
created_atstring (date-time)

Example

curl -X POST "https://api.keyenv.dev/api/v1/auth/sync" \
  -H "Authorization: Bearer $KEYENV_TOKEN"

On this page