Skip to content

Accounts

An account represents an authenticated user. Accounts are provisioned automatically on first login via GitHub OAuth (JIT upsert). The account holds profile information, subscription tier state, and the public slug used in config URLs.

All account endpoints are under /api/admin/accounts and require a GitHub OAuth Bearer token.


Object: Account

json
{
  "accountId": "550e8400-e29b-41d4-a716-446655440000",
  "ssoProvider": "github",
  "ssoUserId": "12345678",
  "email": "user@example.com",
  "displayName": "Jane Smith",
  "avatarUrl": "https://avatars.githubusercontent.com/u/12345678",
  "stripeCustomerId": "cus_abc123",
  "subscriptionTier": "hobby",
  "paymentFailedAt": null,
  "currentPeriodEnd": "2025-02-01T00:00:00.000Z",
  "stripeSubscriptionId": "sub_xyz",
  "lastStripeError": null,
  "slug": "jane-smith",
  "lastLoginAt": "2025-01-20T09:00:00.000Z",
  "createdAt": "2025-01-01T00:00:00.000Z",
  "updatedAt": "2025-01-20T09:00:00.000Z"
}
FieldTypeDescription
accountIdUUIDUnique account ID
ssoProviderstringOAuth provider (always "github")
ssoUserIdstringGitHub user ID
emailstring or nullEmail from GitHub profile
displayNamestring or nullDisplay name from GitHub profile
avatarUrlstring or nullAvatar image URL
stripeCustomerIdstring or nullStripe customer ID
subscriptionTierstringCurrent tier: free, hobby, or pro
paymentFailedAtISO 8601 or nullWhen the last payment failed, if any
currentPeriodEndISO 8601 or nullEnd of the current Stripe billing period
stripeSubscriptionIdstring or nullActive Stripe subscription ID
lastStripeErrorstring or nullLast Stripe error message
slugstringURL-safe account identifier, used in public config URLs
lastLoginAtISO 8601 or nullMost recent login timestamp
createdAtISO 8601 datetimeAccount creation timestamp
updatedAtISO 8601 datetimeLast account update timestamp

Get Current Account

Returns the profile of the authenticated account.

GET /api/admin/accounts/me

Auth: Authorization: Bearer <token>

Responses:

StatusDescription
200Returns Account object
404Account not found

Example:

bash
curl https://app.skystate.io/api/admin/accounts/me \
  -H "Authorization: Bearer <token>"

Update Account Profile

Updates the displayName and avatarUrl fields. Both fields are optional; omit a field to leave it unchanged.

PUT /api/admin/accounts/me

Auth: Authorization: Bearer <token>

Request body:

json
{
  "displayName": "Jane Smith",
  "avatarUrl": "https://example.com/avatar.png"
}
FieldTypeDescription
displayNamestring or nullNew display name
avatarUrlstring or nullNew avatar URL

Responses:

StatusDescription
204Updated
404Account not found

Example:

bash
curl -X PUT https://app.skystate.io/api/admin/accounts/me \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"displayName":"Jane Smith","avatarUrl":null}'

Set Account Slug

Sets the account slug, which appears in public config URLs:

/api/public/{accountSlug}/{projectSlug}/config/{envSlug}

Slugs must be lowercase alphanumeric with hyphens and cannot start or end with a hyphen. Slugs are globally unique across all accounts.

PUT /api/admin/accounts/me/slug

Auth: Authorization: Bearer <token>

Request body:

json
{
  "slug": "jane-smith"
}
FieldTypeRequiredConstraints
slugstringYesPattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$

Responses:

StatusDescription
204Slug updated
400Invalid slug format
404Account not found
409Slug already taken by another account

Example:

bash
curl -X PUT https://app.skystate.io/api/admin/accounts/me/slug \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"slug":"jane-smith"}'

Delete Account

Permanently deletes the account and all associated data including projects, configurations, and billing history. This action is irreversible.

DELETE /api/admin/accounts/me

Auth: Authorization: Bearer <token>

Responses:

StatusDescription
204Account deleted
404Account not found

Example:

bash
curl -X DELETE https://app.skystate.io/api/admin/accounts/me \
  -H "Authorization: Bearer <token>"

Built with VitePress