API Documentation
Complete reference for SavePoint Authentication API
Overview
The SavePoint Authentication API is built on Better Auth and provides enterprise-grade authentication services including OAuth 2.0, OpenID Connect, WebAuthn, and traditional email/password authentication.
Base URL
https://auth.savepoint.com.auREST API
RESTful endpoints for authentication, user management, and session handling
OAuth 2.0 / OIDC
Standard OAuth 2.0 and OpenID Connect provider for third-party integrations
Authentication
API Authentication
The API supports multiple authentication methods:
- Session Cookies: For web applications using the same domain
- Bearer Tokens: For API access and mobile applications
- API Keys: For server-to-server communication
Example API Request
// Using Bearer Token
fetch('/api/auth/session', {
headers: {
'Authorization': 'Bearer <your-token>',
'Content-Type': 'application/json'
}
})
// Using API Key
fetch('/api/auth/user', {
headers: {
'x-api-key': 'sp_your_api_key_here',
'Content-Type': 'application/json'
}
})Core Endpoints
Authentication
/api/auth/sign-inSign in with email and password
Show example
POST /api/auth/sign-in
Content-Type: application/json
{
"email": "user@example.com",
"password": "secure_password",
"callbackURL": "/dashboard"
}/api/auth/sign-upCreate a new user account
Show example
POST /api/auth/sign-up
Content-Type: application/json
{
"email": "user@example.com",
"password": "secure_password",
"name": "John Doe"
}/api/auth/sessionGet current user session information
/api/auth/sign-outSign out and invalidate session
Social Authentication
/api/auth/sign-in/githubInitiate GitHub OAuth flow
/api/auth/sign-in/googleInitiate Google OAuth flow
/api/auth/callback/:providerOAuth callback endpoint for social providers
WebAuthn / Passkeys
/api/auth/passkey/registerRegister a new passkey for the user
/api/auth/passkey/authenticateAuthenticate using a passkey
/api/auth/passkey/listList user's registered passkeys
Two-Factor Authentication
/api/auth/totp/setupSet up TOTP two-factor authentication
/api/auth/totp/verifyVerify TOTP code
/api/auth/totp/backup-codesGenerate backup codes
OAuth 2.0 / OpenID Connect
SavePoint Authentication Portal acts as an OAuth 2.0 Authorization Server and OpenID Connect Provider.
Well-Known Endpoints
/.well-known/oauth-authorization-server- OAuth 2.0 metadata/.well-known/openid_configuration- OpenID Connect discovery
/oauth/authorizeOAuth 2.0 authorization endpoint
Query Parameters:
client_id- Application client IDresponse_type- "code" for authorization code flowscope- Requested scopes (e.g., "openid profile email")redirect_uri- Callback URLstate- CSRF protection parameter
/oauth/tokenExchange authorization code for tokens
/oauth/userinfoGet user information using access token
API Key Management
For server-to-server communication, use API keys with the prefix sp_.
/api/auth/api-keyCreate a new API key
/api/auth/api-keyList user's API keys
/api/auth/api-key/:idRevoke an API key
Rate Limiting
The API implements rate limiting to ensure fair usage and protect against abuse.
Authentication Endpoints
- • 10 requests per minute per IP
- • Applies to login, signup, password reset
- • Stricter limits for failed attempts
API Key Requests
- • 100 requests per minute per key
- • Higher limits available for enterprise
- • Burst capacity for peak usage
Rate Limit Headers
X-RateLimit-Limit: 100 X-RateLimit-Remaining: 95 X-RateLimit-Reset: 1640995200
Error Handling
The API uses standard HTTP status codes and returns detailed error information in JSON format.
Error Response Format
{
"error": {
"code": "INVALID_CREDENTIALS",
"message": "The provided credentials are invalid",
"details": {
"field": "password",
"reason": "Password does not match"
}
}
}4xx Client Errors
- • 400 - Bad Request
- • 401 - Unauthorized
- • 403 - Forbidden
- • 404 - Not Found
- • 429 - Too Many Requests
5xx Server Errors
- • 500 - Internal Server Error
- • 502 - Bad Gateway
- • 503 - Service Unavailable
- • 504 - Gateway Timeout
SDKs and Libraries
Use these recommended libraries for easier integration with SavePoint Authentication:
JavaScript / TypeScript
npm install @better-auth/client
Official Better Auth client library with TypeScript support
React / Next.js
npm install @better-auth/react
React hooks and components for seamless integration
Quick Start Example
import { createAuthClient } from '@better-auth/client'
const authClient = createAuthClient({
baseURL: 'https://auth.savepoint.com.au'
})
// Sign in
await authClient.signIn.email({
email: 'user@example.com',
password: 'password'
})
// Get session
const session = await authClient.getSession()