API Reference
Auth
Authentication and user sync
Auth
Authentication and user sync
Sync user from Clerk
POST /api/v1/auth/syncSyncs 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
| Status | Description | Body |
|---|---|---|
200 | User synced successfully | User |
401 | Authentication required | Error |
Response body (200)
| Field | Type | Description |
|---|---|---|
id | string (uuid) | |
clerk_id | string | |
email | string (email) | |
name | string | |
avatar_url | string (uri) | |
auth_type | enum (user, service_token) | Authentication type. Only present for service token auth. |
team_id | string (uuid) | Team ID. Only present for service token auth. |
project_ids | string (uuid)[] | Project IDs the token has access to. Only present for service token auth. Tokens can access multiple projects. |
scopes | string[] | Token scopes (e.g., read, write). Only present for service token auth. |
created_at | string (date-time) |
Example
curl -X POST "https://api.keyenv.dev/api/v1/auth/sync" \
-H "Authorization: Bearer $KEYENV_TOKEN"