Skip to content

Instantly share code, notes, and snippets.

@jimbrig
Created November 7, 2024 23:35
Show Gist options
  • Save jimbrig/e79dcae2c71ce9c865097f6f698d29a2 to your computer and use it in GitHub Desktop.
Save jimbrig/e79dcae2c71ce9c865097f6f698d29a2 to your computer and use it in GitHub Desktop.
NoClocksAuth OpenAPI
openapi: 3.1.0
info:
title: No Clocks Auth API
version: 1.0.0
description: >-
This API allows for user authentication, management of users, roles, permissions, and session handling.
termsOfService: https://noclocks.dev/terms
contact:
name: API Support
url: https://support.noclocks.dev
email: [email protected]
x-logo:
href: "https://raw.githubusercontent.com/noclocks/noclocks-brand/8e32f14e967ae4a4b06b6b0116381286ceaf37bb/src/images/logos/main/noclocks-logo-black.svg"
altText: No Clocks Logo
url: "https://noclocks.dev"
license:
name: Unlicense
url: https://choosealicense.com/licenses/unlicense/
servers:
- url: https://api-{environment}.noclocks.dev/{version}
description: Cloud Hosted Server
variables:
environment:
default: prod
description: API environment
enum: [prod, staging, dev, test]
version:
default: v1
description: API version string
enum: [v1]
tags:
- name: Users
description: User Management
- name: Apps
description: App Management
- name: Roles
description: Role Management
- name: Permissions
description: Permission Management
- name: Tenants
description: Tenant Management
- name: Sessions
description: Session Management
- name: Secrets
description: API Keys and Secrets Management
- name: Emails
description: Email Management
- name: EmailTemplates
description: Email Template Management
- name: Brands
description: Brand Management
- name: Accounts
description: Account Management
- name: Profiles
description: User Profile Management
- name: Audit
description: Audit Management
- name: Settings
description: Settings Management
- name: Logs
description: Log Management
- name: Admin
description: Administrative
- name: Health
description: Health
- name: Public
description: Public
- name: Auth
description: Authentication
- name: Utility
description: Utility Endpoints
paths:
/health:
summary: Healthcheck Endpoint
description: >-
Simple healthcheck API to check if the API is up and running.
get:
tags:
- Utility
- Admin
summary: Healthcheck Endpoint
operationId: getHealth
x-function: api_healthcheck
responses:
"200":
description: API is up and running
content:
application/json:
schema:
$ref: '#/components/schemas/HealthResponse'
/ping:
summary: Ping API
description: Simple API Ping
get:
tags:
- Utility
- Admin
summary: Ping Endpoint
operationId: ping
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PingResponse'
/users:
description: >-
User Management Endpoints.
summary: User Management Operations and Methods.
get:
summary: List all Users
description: List all Users
operationId: getUsers
tags:
- Users
parameters:
- name: email
description: Filter by user email.
in: query
schema:
type: string
format: email
security:
- BearerAuth: []
responses:
'200':
$ref: '#/components/responses/UserListResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'500':
$ref: '#/components/responses/ServerErrorResponse'
post:
description: Register a new user.
summary: Register new user.
tags:
- Users
operationId: createUser
requestBody:
$ref: '#/components/requestBodies/UserCreate'
responses:
'201':
$ref: '#/components/responses/UserResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
/users/{id}:
get:
summary: Get user by ID.
operationId: getUserById
security:
- BearerAuth: []
tags:
- Users
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
$ref: '#/components/responses/UserResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update User by ID.
operationId: updateUser
tags:
- Users
security:
- BearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserUpdate'
responses:
'200':
$ref: '#/components/responses/UserResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
delete:
summary: Remove a user
operationId: deleteUser
tags:
- Users
security:
- BearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
/users/me:
get:
summary: Get current user.
operationId: getCurrentUser
x-path-alias: /whoami
tags:
- Users
- Utility
security:
- BearerAuth: []
responses:
'200':
$ref: '#/components/responses/UserResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/users/{id}/verify:
post:
summary: Verify user's email via TOTP
description: Verify user email address providing TOTP
tags:
- Users
- Auth
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/VerifyTOTP'
responses:
'200':
description: Email verified successfully
'400':
$ref: '#/components/responses/ErrorResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
/users/{id}/reverify:
post:
summary: Re-send verification email
description: Re-send the verification email to the user to complete the email verification process.
tags:
- Users
- Auth
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
$ref: '#/components/schemas/Email'
responses:
'200':
description: Verification email sent successfully
'400':
$ref: '#/components/responses/ErrorResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
/users/{user_id}/apps:
get:
summary: Get apps associated with a user
operationId: getUserApps
tags:
- Users
- Apps
security:
- BearerAuth: []
parameters:
- name: user_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: List of apps associated with the user
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/App'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Associate an app with a user
operationId: addUserApp
tags:
- Users
- Apps
security:
- BearerAuth: []
parameters:
- name: user_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserAppAssociation'
responses:
'201':
description: App associated with user successfully
content:
application/json:
schema:
$ref: '#/components/schemas/App'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/users/{user_id}/apps/{app_id}:
delete:
summary: Remove association between a user and an app
operationId: removeUserApp
tags:
- Users
- Apps
security:
- BearerAuth: []
parameters:
- name: user_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
- name: app_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/users/{user_id}/roles:
get:
summary: Get roles assigned to a user
operationId: getUserRoles
tags:
- Users
- Roles
security:
- BearerAuth: []
parameters:
- name: user_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: List of roles assigned to the user
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Role'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Assign a role to a user
operationId: addUserRole
tags:
- Users
- Roles
security:
- BearerAuth: []
parameters:
- name: user_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserRoleAssignment'
responses:
'201':
description: Role assigned to user successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Role'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/users/{user_id}/roles/{role_id}:
delete:
summary: Remove a role from a user
operationId: removeUserRole
tags:
- Users
- Roles
security:
- BearerAuth: []
parameters:
- name: user_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
- name: role_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/profiles:
get:
summary: List all user profiles
operationId: getProfiles
tags:
- Profiles
security:
- BearerAuth: []
responses:
'200':
description: List of user profiles
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Profile'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new user profile
operationId: createProfile
tags:
- Profiles
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/ProfileCreate'
responses:
'201':
description: Profile created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Profile'
'400':
$ref: '#/components/responses/ErrorResponse'
/profiles/{profile_id}:
get:
summary: Get a user profile by ID
operationId: getProfileById
tags:
- Profiles
security:
- BearerAuth: []
parameters:
- name: profile_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: User profile details
content:
application/json:
schema:
$ref: '#/components/schemas/Profile'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update a user profile
operationId: updateProfile
tags:
- Profiles
security:
- BearerAuth: []
parameters:
- name: profile_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/ProfileUpdate'
responses:
'200':
description: Profile updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Profile'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
delete:
summary: Delete a user profile
operationId: deleteProfile
tags:
- Profiles
security:
- BearerAuth: []
parameters:
- name: profile_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/tenants:
get:
summary: List all tenants
operationId: getTenants
tags:
- Tenants
security:
- BearerAuth: []
responses:
'200':
description: List of tenants
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Tenant'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new tenant
operationId: createTenant
tags:
- Tenants
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/TenantCreate'
responses:
'201':
description: Tenant created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
'400':
$ref: '#/components/responses/ErrorResponse'
/tenants/{tenant_id}:
get:
summary: Get a tenant by ID
operationId: getTenantById
tags:
- Tenants
security:
- BearerAuth: []
parameters:
- name: tenant_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: Tenant details
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update a tenant
operationId: updateTenant
tags:
- Tenants
security:
- BearerAuth: []
parameters:
- name: tenant_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/TenantUpdate'
responses:
'200':
description: Tenant updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
delete:
summary: Delete a tenant
operationId: deleteTenant
tags:
- Tenants
security:
- BearerAuth: []
parameters:
- name: tenant_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/apps:
get:
summary: List all apps
operationId: getApps
tags:
- Apps
security:
- BearerAuth: []
responses:
'200':
description: List of apps
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/App'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new app
operationId: createApp
tags:
- Apps
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/AppCreate'
responses:
'201':
description: App created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/App'
'400':
$ref: '#/components/responses/ErrorResponse'
/apps/{app_id}:
get:
summary: Get an app by ID
operationId: getAppById
tags:
- Apps
security:
- BearerAuth: []
parameters:
- name: app_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: App details
content:
application/json:
schema:
$ref: '#/components/schemas/App'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update an app
operationId: updateApp
tags:
- Apps
security:
- BearerAuth: []
parameters:
- name: app_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/AppUpdate'
responses:
'200':
description: App updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/App'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
delete:
summary: Delete an app
operationId: deleteApp
tags:
- Apps
security:
- BearerAuth: []
parameters:
- name: app_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/roles:
get:
summary: List all roles
operationId: getRoles
tags:
- Roles
security:
- BearerAuth: []
responses:
'200':
description: List of roles
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Role'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new role
operationId: createRole
tags:
- Roles
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/RoleCreate'
responses:
'201':
description: Role created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Role'
'400':
$ref: '#/components/responses/ErrorResponse'
/roles/{role_id}:
get:
summary: Get a role by ID
operationId: getRoleById
tags:
- Roles
security:
- BearerAuth: []
parameters:
- name: role_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: Role details
content:
application/json:
schema:
$ref: '#/components/schemas/Role'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update a role
operationId: updateRole
tags:
- Roles
security:
- BearerAuth: []
parameters:
- name: role_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/RoleUpdate'
responses:
'200':
description: Role updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Role'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
delete:
summary: Delete a role
operationId: deleteRole
tags:
- Roles
security:
- BearerAuth: []
parameters:
- name: role_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/secrets:
get:
summary: List all API keys and secrets
operationId: getSecrets
tags:
- Secrets
security:
- BearerAuth: []
responses:
'200':
description: List of secrets
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Secret'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new API key or secret
operationId: createSecret
tags:
- Secrets
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/SecretCreate'
responses:
'201':
description: Secret created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Secret'
'400':
$ref: '#/components/responses/ErrorResponse'
/secrets/{secret_id}:
delete:
summary: Delete an API key or secret
operationId: deleteSecret
tags:
- Secrets
security:
- BearerAuth: []
parameters:
- name: secret_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/emails:
get:
summary: List all emails
operationId: getEmails
tags:
- Emails
security:
- BearerAuth: []
responses:
'200':
description: List of emails
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/EmailRecord'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/emails/{email_id}:
get:
summary: Get an email by ID
operationId: getEmailById
tags:
- Emails
security:
- BearerAuth: []
parameters:
- name: email_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: Email details
content:
application/json:
schema:
$ref: '#/components/schemas/EmailRecord'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
/email-templates:
get:
summary: List all email templates
operationId: getEmailTemplates
tags:
- EmailTemplates
security:
- BearerAuth: []
responses:
'200':
description: List of email templates
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/EmailTemplate'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new email template
operationId: createEmailTemplate
tags:
- EmailTemplates
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/EmailTemplateCreate'
responses:
'201':
description: Email template created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/EmailTemplate'
'400':
$ref: '#/components/responses/ErrorResponse'
/email-templates/{template_id}:
get:
summary: Get an email template by ID
operationId: getEmailTemplateById
tags:
- EmailTemplates
security:
- BearerAuth: []
parameters:
- name: template_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: Email template details
content:
application/json:
schema:
$ref: '#/components/schemas/EmailTemplate'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update an email template
operationId: updateEmailTemplate
tags:
- EmailTemplates
security:
- BearerAuth: []
parameters:
- name: template_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/EmailTemplateUpdate'
responses:
'200':
description: Email template updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/EmailTemplate'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
delete:
summary: Delete an email template
operationId: deleteEmailTemplate
tags:
- EmailTemplates
security:
- BearerAuth: []
parameters:
- name: template_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/brands:
get:
summary: List all brands
operationId: getBrands
tags:
- Brands
security:
- BearerAuth: []
responses:
'200':
description: List of brands
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Brand'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new brand
operationId: createBrand
tags:
- Brands
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/BrandCreate'
responses:
'201':
description: Brand created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Brand'
'400':
$ref: '#/components/responses/ErrorResponse'
/brands/{brand_id}:
get:
summary: Get a brand by ID
operationId: getBrandById
tags:
- Brands
security:
- BearerAuth: []
parameters:
- name: brand_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: Brand details
content:
application/json:
schema:
$ref: '#/components/schemas/Brand'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update a brand
operationId: updateBrand
tags:
- Brands
security:
- BearerAuth: []
parameters:
- name: brand_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/BrandUpdate'
responses:
'200':
description: Brand updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Brand'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
delete:
summary: Delete a brand
operationId: deleteBrand
tags:
- Brands
security:
- BearerAuth: []
parameters:
- name: brand_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/accounts:
get:
summary: List all accounts
operationId: getAccounts
tags:
- Accounts
security:
- BearerAuth: []
responses:
'200':
description: List of accounts
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Account'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
post:
summary: Create a new account
operationId: createAccount
tags:
- Accounts
security:
- BearerAuth: []
requestBody:
$ref: '#/components/requestBodies/AccountCreate'
responses:
'201':
description: Account created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
'400':
$ref: '#/components/responses/ErrorResponse'
/accounts/{account_id}:
get:
summary: Get an account by ID
operationId: getAccountById
tags:
- Accounts
security:
- BearerAuth: []
parameters:
- name: account_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: Account details
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
put:
summary: Update an account
operationId: updateAccount
tags:
- Accounts
security:
- BearerAuth: []
parameters:
- name: account_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
requestBody:
$ref: '#/components/requestBodies/AccountUpdate'
responses:
'200':
description: Account updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
delete:
summary: Delete an account
operationId: deleteAccount
tags:
- Accounts
security:
- BearerAuth: []
parameters:
- name: account_id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/auth/login:
post:
summary: Login and obtain authentication tokens
description: Authenticate a user with email and password, and return JWT tokens for session management.
tags:
- Auth
requestBody:
$ref: '#/components/requestBodies/Login'
responses:
'200':
$ref: '#/components/responses/TokenResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
/auth/logout:
post:
summary: Logout the current user by invalidating tokens
security:
- BearerAuth: []
tags:
- Auth
responses:
'204':
$ref: '#/components/responses/NoContentResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
requestBody:
content:
application/json:
schema:
type: object
/auth/password-reset:
post:
summary: Request password reset email
description: Request an email with a password reset link or token.
tags:
- Auth
requestBody:
$ref: '#/components/requestBodies/PasswordResetRequest'
responses:
'200':
description: Password reset email sent
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
/auth/password-reset/verify:
post:
summary: Verify password reset request and set new password
description: Verify the password reset token and update the user's password.
tags:
- Auth
requestBody:
$ref: '#/components/requestBodies/PasswordResetVerify'
responses:
'200':
description: Password reset successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
/sessions:
get:
summary: Get session information
description: Retrieve session details based on query parameters
operationId: getSessions
tags:
- Sessions
parameters:
- in: query
name: hashed_cookie
required: true
schema:
type: string
description: Hashed session cookie
- in: query
name: app_id
required: true
schema:
type: string
description: Application ID
- in: query
name: session_started
schema:
type: boolean
default: true
description: Has the session been started/initialized?
security:
- BearerAuth: []
responses:
'200':
description: Session information retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Session'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'500':
$ref: '#/components/responses/ServerErrorResponse'
post:
summary: Create a new session
tags:
- Sessions
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewSession'
security:
- BearerAuth: []
responses:
'201':
description: Session created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'500':
$ref: '#/components/responses/ServerErrorResponse'
put:
summary: Update session information
tags:
- Sessions
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateSession'
security:
- BearerAuth: []
responses:
'200':
description: Session updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'500':
$ref: '#/components/responses/ServerErrorResponse'
components:
securitySchemes:
BearerAuth:
description: >-
Bearer JWT scheme used to authenticate users and provide access to the API.
type: http
scheme: bearer
bearerFormat: JWT
schemas:
InternalError:
description: Internal Error
type: string
enum:
- Internal Error
NotFound:
description: Not Found
type: string
enum:
- Not Found
MethodNotSupported:
description: Method Not Supported
type: string
enum:
- Method Not Supported
InvalidJSON:
description: Invalid JSON
type: string
RequestUnauthorised:
description: Request Unauthorized
type: string
enum:
- Invalid API key
LicenseError:
description: License Error
type: string
enum:
- License Error
GeneralErrorResponse:
type: object
properties:
status:
type: string
enum:
- GENERAL_ERROR
message:
type: string
Email:
description: Email Address
type: string
format: email
examples: ["[email protected]"]
Password:
description: Password
type: string
format: password
minLength: 8
maxLength: 128
UUID:
description: Universally Unique Identifier (UUID)
type: string
format: uuid
examples: ["123e4567-e89b-12d3-a456-426614174000"]
ID:
description: Generic ID
oneOf:
- type: string
format: uuid
- type: integer
examples: ["123e4567-e89b-12d3-a456-426614174000"]
JWT:
description: JSON Web Token
type: object
properties:
accessToken:
type: string
description: Access token
refreshToken:
type: string
description: Refresh token
required:
- accessToken
- refreshToken
Error:
description: Error Object
type: object
required:
- message
- code
properties:
message:
type: string
description: Error message
code:
type: integer
description: HTTP status code
examples: [{ message: "Unauthorized", code: 401 }]
VerifyTOTP:
type: object
properties:
email:
$ref: '#/components/schemas/Email'
totpCode:
type: string
description: TOTP code provided by the user
required:
- email
- totpCode
Login:
type: object
properties:
email:
$ref: '#/components/schemas/Email'
password:
$ref: '#/components/schemas/Password'
required:
- email
- password
User:
description: User Object (Internal Use)
type: object
properties:
user_id:
$ref: '#/components/schemas/UUID'
tenant_id:
$ref: '#/components/schemas/UUID'
profile_id:
$ref: '#/components/schemas/UUID'
email:
$ref: '#/components/schemas/Email'
password_hashed:
type: string
description: Hashed password (Sensitive)
is_verified:
type: boolean
default: false
verification_code:
type: string
description: Verification code (Sensitive)
verification_expiry:
type: string
format: date-time
password_reset_code:
type: string
description: Password reset code (Sensitive)
password_reset_expiry:
type: string
format: date-time
is_active:
type: boolean
default: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
UserPublic:
description: User object returned in API responses
type: object
properties:
user_id:
$ref: '#/components/schemas/UUID'
tenant_id:
$ref: '#/components/schemas/UUID'
profile_id:
$ref: '#/components/schemas/UUID'
email:
$ref: '#/components/schemas/Email'
is_verified:
type: boolean
default: false
is_active:
type: boolean
default: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
UserCreate:
description: User Creation
type: object
properties:
email:
$ref: '#/components/schemas/Email'
password:
$ref: '#/components/schemas/Password'
required:
- email
- password
UserUpdate:
description: User Update
type: object
properties:
email:
$ref: '#/components/schemas/Email'
password:
$ref: '#/components/schemas/Password'
is_active:
type: boolean
default: true
PasswordResetRequest:
type: object
properties:
email:
$ref: '#/components/schemas/Email'
required:
- email
PasswordResetVerify:
type: object
properties:
email:
$ref: '#/components/schemas/Email'
resetToken:
type: string
description: Password reset token
newPassword:
$ref: '#/components/schemas/Password'
required:
- email
- resetToken
- newPassword
Session:
type: object
properties:
session_id:
$ref: '#/components/schemas/UUID'
user_id:
$ref: '#/components/schemas/UUID'
email:
$ref: '#/components/schemas/Email'
is_admin:
type: boolean
roles:
type: array
items:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
NewSession:
type: object
properties:
user_id:
$ref: '#/components/schemas/UUID'
hashed_cookie:
type: string
app_id:
$ref: '#/components/schemas/UUID'
required:
- user_id
- hashed_cookie
- app_id
UpdateSession:
type: object
properties:
session_id:
$ref: '#/components/schemas/UUID'
is_active:
type: boolean
SuccessResponse:
type: object
properties:
message:
type: string
examples: [{ message: "Operation completed successfully" }]
HealthResponse:
type: object
properties:
status:
type: string
default: OK
timestamp:
type: string
format: date-time
PingResponse:
type: object
properties:
message:
type: string
default: "Pong!"
timestamp:
type: string
format: date-time
UserAppAssociation:
type: object
properties:
app_id:
$ref: '#/components/schemas/UUID'
required:
- app_id
UserRoleAssignment:
type: object
properties:
role_id:
$ref: '#/components/schemas/UUID'
required:
- role_id
Profile:
description: User Profile Object
type: object
properties:
profile_id:
$ref: '#/components/schemas/UUID'
user_id:
$ref: '#/components/schemas/UUID'
first_name:
type: string
last_name:
type: string
phone_number:
type: string
address:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
ProfileCreate:
description: User Profile Creation
type: object
properties:
user_id:
$ref: '#/components/schemas/UUID'
first_name:
type: string
last_name:
type: string
phone_number:
type: string
address:
type: string
required:
- user_id
- first_name
- last_name
ProfileUpdate:
description: User Profile Update
type: object
properties:
first_name:
type: string
last_name:
type: string
phone_number:
type: string
address:
type: string
Tenant:
description: Tenant Object
type: object
properties:
tenant_id:
$ref: '#/components/schemas/UUID'
name:
type: string
description:
type: string
is_active:
type: boolean
default: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
TenantCreate:
description: Tenant Creation
type: object
properties:
name:
type: string
description:
type: string
required:
- name
TenantUpdate:
description: Tenant Update
type: object
properties:
name:
type: string
description:
type: string
is_active:
type: boolean
App:
description: Application Object
type: object
properties:
app_id:
$ref: '#/components/schemas/UUID'
name:
type: string
description:
type: string
client_id:
type: string
client_secret:
type: string
description: Sensitive information
redirect_uris:
type: array
items:
type: string
format: uri
is_active:
type: boolean
default: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
AppCreate:
description: Application Creation
type: object
properties:
name:
type: string
description:
type: string
redirect_uris:
type: array
items:
type: string
format: uri
required:
- name
AppUpdate:
description: Application Update
type: object
properties:
name:
type: string
description:
type: string
redirect_uris:
type: array
items:
type: string
format: uri
is_active:
type: boolean
Role:
description: Role Object
type: object
properties:
role_id:
$ref: '#/components/schemas/UUID'
name:
type: string
description:
type: string
permissions:
type: array
items:
type: string
is_active:
type: boolean
default: true
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
RoleCreate:
description: Role Creation
type: object
properties:
name:
type: string
description:
type: string
permissions:
type: array
items:
type: string
required:
- name
RoleUpdate:
description: Role Update
type: object
properties:
name:
type: string
description:
type: string
permissions:
type: array
items:
type: string
is_active:
type: boolean
Secret:
description: Secret Object (API Key)
type: object
properties:
secret_id:
$ref: '#/components/schemas/UUID'
name:
type: string
key:
type: string
description: API Key (Sensitive)
user_id:
$ref: '#/components/schemas/UUID'
created_at:
type: string
format: date-time
SecretCreate:
description: Secret Creation
type: object
properties:
name:
type: string
required:
- name
EmailRecord:
description: Email Record Object
type: object
properties:
email_id:
$ref: '#/components/schemas/UUID'
to:
type: string
format: email
subject:
type: string
body:
type: string
status:
type: string
enum: [sent, pending, failed]
sent_at:
type: string
format: date-time
EmailTemplate:
description: Email Template Object
type: object
properties:
template_id:
$ref: '#/components/schemas/UUID'
name:
type: string
subject:
type: string
body:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
EmailTemplateCreate:
description: Email Template Creation
type: object
properties:
name:
type: string
subject:
type: string
body:
type: string
required:
- name
- subject
- body
EmailTemplateUpdate:
description: Email Template Update
type: object
properties:
name:
type: string
subject:
type: string
body:
type: string
Brand:
description: Brand Object
type: object
properties:
brand_id:
$ref: '#/components/schemas/UUID'
tenant_id:
$ref: '#/components/schemas/UUID'
name:
type: string
logo_url:
type: string
format: uri
primary_color:
type: string
secondary_color:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
BrandCreate:
description: Brand Creation
type: object
properties:
tenant_id:
$ref: '#/components/schemas/UUID'
name:
type: string
logo_url:
type: string
format: uri
primary_color:
type: string
secondary_color:
type: string
required:
- tenant_id
- name
BrandUpdate:
description: Brand Update
type: object
properties:
name:
type: string
logo_url:
type: string
format: uri
primary_color:
type: string
secondary_color:
type: string
Account:
description: Account Object
type: object
properties:
account_id:
$ref: '#/components/schemas/UUID'
user_id:
$ref: '#/components/schemas/UUID'
balance:
type: number
format: float
currency:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
AccountCreate:
description: Account Creation
type: object
properties:
user_id:
$ref: '#/components/schemas/UUID'
currency:
type: string
required:
- user_id
- currency
AccountUpdate:
description: Account Update
type: object
properties:
balance:
type: number
format: float
currency:
type: string
requestBodies:
UserCreate:
description: Request body payload for registering a new user.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserCreate'
Login:
description: Credentials for logging in a user.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
VerifyTOTP:
description: TOTP code and email for verifying a user's email.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyTOTP'
PasswordResetRequest:
description: Request to reset password by providing the user's email.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PasswordResetRequest'
PasswordResetVerify:
description: Provide the reset token, email, and new password to reset a password.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PasswordResetVerify'
ProfileCreate:
description: User Profile Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ProfileCreate'
ProfileUpdate:
description: User Profile Update
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ProfileUpdate'
TenantCreate:
description: Tenant Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TenantCreate'
TenantUpdate:
description: Tenant Update
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TenantUpdate'
AppCreate:
description: Application Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AppCreate'
AppUpdate:
description: Application Update
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AppUpdate'
RoleCreate:
description: Role Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RoleCreate'
RoleUpdate:
description: Role Update
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RoleUpdate'
SecretCreate:
description: Secret Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SecretCreate'
EmailTemplateCreate:
description: Email Template Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EmailTemplateCreate'
EmailTemplateUpdate:
description: Email Template Update
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EmailTemplateUpdate'
BrandCreate:
description: Brand Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BrandCreate'
BrandUpdate:
description: Brand Update
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BrandUpdate'
AccountCreate:
description: Account Creation
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccountCreate'
AccountUpdate:
description: Account Update
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccountUpdate'
responses:
Response400:
description: error code 400
content:
application/json:
schema:
$ref: "#/components/schemas/InvalidJSON"
Response401:
description: error code 401
content:
application/json:
schema:
$ref: "#/components/schemas/RequestUnauthorised"
Response402:
description: error code 402
content:
application/json:
schema:
$ref: "#/components/schemas/LicenseError"
Response404:
description: Error Code 404
content:
application/json:
schema:
$ref: '#/components/schemas/NotFound'
Response405:
description: Error Code 405
content:
application/json:
schema:
$ref: '#/components/schemas/MethodNotSupported'
Response500:
description: Error Code 500
content:
application/json:
schema:
$ref: '#/components/schemas/InternalError'
NoContentResponse:
description: No content, successful operation with no response body.
ErrorResponse:
description: Error response with details of the issue.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFoundResponse:
description: Resource not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
UnauthorizedResponse:
description: Unauthorized access, invalid token or credentials.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
ForbiddenResponse:
description: Forbidden access, admin rights required.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
ServerErrorResponse:
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
TokenResponse:
description: Successful response containing JWT access and refresh tokens.
content:
application/json:
schema:
$ref: '#/components/schemas/JWT'
UserResponse:
description: Successful response with user details.
content:
application/json:
schema:
$ref: '#/components/schemas/UserPublic'
UserListResponse:
description: Successful response with list of users.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UserPublic'
UserCreatedSuccessResponse:
description: Successful user registration response.
content:
application/json:
schema:
$ref: '#/components/schemas/UserPublic'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment