Overview
sptfy.in uses PocketBase for authentication and API access. All authenticated endpoints require a valid PocketBase auth token.Authentication Methods
OAuth2 (GitHub)
The primary authentication method is GitHub OAuth2.Using Auth Tokens
Once authenticated, include the token in subsequent requests:Turnstile Token (Bot Protection)
For unauthenticated link creation, you must include a Cloudflare Turnstile token to prevent abuse.Cloudflare Turnstile challenge token obtained from the client-side widget
Getting a Turnstile Token
Example with Turnstile
User Information
Get Current User
User object if authenticated, null otherwise
Update User Profile
Update username and onboarding status.New username (3-150 chars, alphanumeric, dots, hyphens, underscores)
Updated user record
Not authenticated
Invalid username format
Username already taken
PocketBase Collections
sptfy.in uses these PocketBase collections:random_short
Main collection for shortened links. Write operations require authentication or Turnstile token.
viewList
Read-only view of links with user information. Used for fetching user’s links.
analytics
Analytics data for link visits (country, user agent, timestamps)
users
User accounts managed by PocketBase auth
Error Handling
All endpoints return standard HTTP status codes:| Status Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 204 | No Content (successful deletion) |
| 400 | Bad Request (invalid parameters) |
| 401 | Unauthorized (missing or invalid auth token) |
| 403 | Forbidden (not owner of resource) |
| 404 | Not Found |
| 409 | Conflict (duplicate slug) |
| 503 | Service Unavailable (maintenance mode) |