{ "components": { "securitySchemes": { "AdminAuth": { "description": "Use an administrator token for writes, or a read-only token for GET requests", "scheme": "bearer", "type": "http" } } }, "info": { "title": "User service reference", "version": "1.0.0" }, "openapi": "3.0.3", "paths": { "/api/v1/users": { "get": { "operationId": "user_ListUsers", "parameters": [ { "in": "query", "name": "page", "required": false, "schema": { "default": 1, "format": "int64", "maximum": 1000000, "minimum": 1, "type": "integer" } }, { "in": "query", "name": "pageSize", "required": false, "schema": { "default": 20, "format": "int64", "maximum": 100, "minimum": 1, "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "data": { "additionalProperties": false, "properties": { "items": { "items": { "additionalProperties": false, "properties": { "createdAt": { "type": "string" }, "email": { "type": "string" }, "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "email", "createdAt", "updatedAt" ], "type": "object" }, "type": "array" }, "page": { "format": "int64", "type": "integer" }, "pageSize": { "format": "int64", "type": "integer" }, "total": { "format": "int64", "type": "integer" } }, "required": [ "items", "total", "page", "pageSize" ], "type": "object" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message", "data" ], "type": "object" } } }, "description": "Success" }, "400": { "content": { "application/json": { "examples": { "InvalidPage": { "summary": "invalid pagination", "value": { "code": "INVALID_PAGE", "message": "invalid pagination", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "INVALID_PAGE: invalid pagination" }, "401": { "content": { "application/json": { "examples": { "Unauthenticated": { "summary": "authentication required", "value": { "code": "UNAUTHENTICATED", "message": "authentication required", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "UNAUTHENTICATED: authentication required" }, "413": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "415": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "500": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "501": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" } }, "security": [ { "AdminAuth": [] } ], "summary": "", "tags": [ "user" ], "x-omni-errors": [ "Unauthenticated", "InvalidPage" ], "x-omni-middleware": [ "Auth" ] }, "post": { "description": "Normalizes the email, then commits user data and audit in one transaction", "operationId": "user_CreateUser", "requestBody": { "content": { "application/json": { "schema": { "additionalProperties": false, "properties": { "email": { "format": "email", "maxLength": 254, "minLength": 1, "type": "string" }, "name": { "maxLength": 100, "minLength": 1, "type": "string" } }, "required": [ "name", "email" ], "type": "object" } } }, "required": true }, "responses": { "201": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "data": { "additionalProperties": false, "properties": { "createdAt": { "type": "string" }, "email": { "type": "string" }, "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "email", "createdAt", "updatedAt" ], "type": "object" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message", "data" ], "type": "object" } } }, "description": "Success" }, "400": { "content": { "application/json": { "examples": { "InvalidUser": { "summary": "invalid user", "value": { "code": "INVALID_USER", "message": "invalid user", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "INVALID_USER: invalid user" }, "401": { "content": { "application/json": { "examples": { "Unauthenticated": { "summary": "authentication required", "value": { "code": "UNAUTHENTICATED", "message": "authentication required", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "UNAUTHENTICATED: authentication required" }, "403": { "content": { "application/json": { "examples": { "Forbidden": { "summary": "permission denied", "value": { "code": "FORBIDDEN", "message": "permission denied", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "FORBIDDEN" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "FORBIDDEN: permission denied" }, "409": { "content": { "application/json": { "examples": { "EmailTaken": { "summary": "email already in use", "value": { "code": "EMAIL_TAKEN", "message": "email already in use", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "EMAIL_TAKEN" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "EMAIL_TAKEN: email already in use" }, "413": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "415": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "500": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "501": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" } }, "security": [ { "AdminAuth": [] } ], "summary": "Create a user", "tags": [ "users" ], "x-omni-errors": [ "Unauthenticated", "Forbidden", "InvalidUser", "EmailTaken" ], "x-omni-middleware": [ "Auth" ] } }, "/api/v1/users/{id}": { "delete": { "operationId": "user_DeleteUser", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "format": "int64", "maximum": 9007199254740991, "minimum": 1, "type": "integer" } } ], "responses": { "204": { "description": "Success" }, "400": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "401": { "content": { "application/json": { "examples": { "Unauthenticated": { "summary": "authentication required", "value": { "code": "UNAUTHENTICATED", "message": "authentication required", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "UNAUTHENTICATED: authentication required" }, "403": { "content": { "application/json": { "examples": { "Forbidden": { "summary": "permission denied", "value": { "code": "FORBIDDEN", "message": "permission denied", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "FORBIDDEN" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "FORBIDDEN: permission denied" }, "404": { "content": { "application/json": { "examples": { "UserNotFound": { "summary": "user not found", "value": { "code": "USER_NOT_FOUND", "message": "user not found", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "USER_NOT_FOUND" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "USER_NOT_FOUND: user not found" }, "413": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "415": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "500": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "501": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" } }, "security": [ { "AdminAuth": [] } ], "summary": "", "tags": [ "user" ], "x-omni-errors": [ "Unauthenticated", "Forbidden", "UserNotFound" ], "x-omni-middleware": [ "Auth" ] }, "get": { "operationId": "user_GetUser", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "format": "int64", "maximum": 9007199254740991, "minimum": 1, "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "data": { "additionalProperties": false, "properties": { "createdAt": { "type": "string" }, "email": { "type": "string" }, "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "email", "createdAt", "updatedAt" ], "type": "object" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message", "data" ], "type": "object" } } }, "description": "Success" }, "400": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "401": { "content": { "application/json": { "examples": { "Unauthenticated": { "summary": "authentication required", "value": { "code": "UNAUTHENTICATED", "message": "authentication required", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "UNAUTHENTICATED: authentication required" }, "404": { "content": { "application/json": { "examples": { "UserNotFound": { "summary": "user not found", "value": { "code": "USER_NOT_FOUND", "message": "user not found", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "USER_NOT_FOUND" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "USER_NOT_FOUND: user not found" }, "413": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "415": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "500": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "501": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" } }, "security": [ { "AdminAuth": [] } ], "summary": "", "tags": [ "user" ], "x-omni-errors": [ "Unauthenticated", "UserNotFound" ], "x-omni-middleware": [ "Auth" ] }, "put": { "operationId": "user_UpdateUser", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "format": "int64", "maximum": 9007199254740991, "minimum": 1, "type": "integer" } } ], "requestBody": { "content": { "application/json": { "schema": { "additionalProperties": false, "properties": { "email": { "format": "email", "maxLength": 254, "minLength": 1, "type": "string" }, "name": { "maxLength": 100, "minLength": 1, "type": "string" } }, "required": [ "name", "email" ], "type": "object" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "data": { "additionalProperties": false, "properties": { "createdAt": { "type": "string" }, "email": { "type": "string" }, "id": { "format": "int64", "type": "integer" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "email", "createdAt", "updatedAt" ], "type": "object" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message", "data" ], "type": "object" } } }, "description": "Success" }, "400": { "content": { "application/json": { "examples": { "InvalidUser": { "summary": "invalid user", "value": { "code": "INVALID_USER", "message": "invalid user", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "INVALID_USER: invalid user" }, "401": { "content": { "application/json": { "examples": { "Unauthenticated": { "summary": "authentication required", "value": { "code": "UNAUTHENTICATED", "message": "authentication required", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "UNAUTHENTICATED: authentication required" }, "403": { "content": { "application/json": { "examples": { "Forbidden": { "summary": "permission denied", "value": { "code": "FORBIDDEN", "message": "permission denied", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "FORBIDDEN" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "FORBIDDEN: permission denied" }, "404": { "content": { "application/json": { "examples": { "UserNotFound": { "summary": "user not found", "value": { "code": "USER_NOT_FOUND", "message": "user not found", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "USER_NOT_FOUND" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "USER_NOT_FOUND: user not found" }, "409": { "content": { "application/json": { "examples": { "EmailTaken": { "summary": "email already in use", "value": { "code": "EMAIL_TAKEN", "message": "email already in use", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "EMAIL_TAKEN" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "EMAIL_TAKEN: email already in use" }, "413": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "415": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "500": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "501": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" } }, "security": [ { "AdminAuth": [] } ], "summary": "", "tags": [ "user" ], "x-omni-errors": [ "Unauthenticated", "Forbidden", "InvalidUser", "UserNotFound", "EmailTaken" ], "x-omni-middleware": [ "Auth" ] } }, "/api/v1/users/{id}/export": { "post": { "operationId": "user_ExportUser", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "format": "int64", "maximum": 9007199254740991, "minimum": 1, "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "data": { "additionalProperties": false, "properties": { "downloadUrl": { "type": "string" } }, "required": [ "downloadUrl" ], "type": "object" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message", "data" ], "type": "object" } } }, "description": "Success" }, "400": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "401": { "content": { "application/json": { "examples": { "Unauthenticated": { "summary": "authentication required", "value": { "code": "UNAUTHENTICATED", "message": "authentication required", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "UNAUTHENTICATED: authentication required" }, "403": { "content": { "application/json": { "examples": { "Forbidden": { "summary": "permission denied", "value": { "code": "FORBIDDEN", "message": "permission denied", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "FORBIDDEN" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "FORBIDDEN: permission denied" }, "404": { "content": { "application/json": { "examples": { "UserNotFound": { "summary": "user not found", "value": { "code": "USER_NOT_FOUND", "message": "user not found", "requestId": "exampleRequest" } } }, "schema": { "properties": { "code": { "enum": [ "USER_NOT_FOUND" ], "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "USER_NOT_FOUND: user not found" }, "413": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "415": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "500": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" }, "501": { "content": { "application/json": { "schema": { "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "requestId": { "type": "string" } }, "required": [ "code", "message" ], "type": "object" } } }, "description": "Error" } }, "security": [ { "AdminAuth": [] } ], "summary": "Export one user as a private text object with a short-lived download link", "tags": [ "user" ], "x-omni-errors": [ "Unauthenticated", "Forbidden", "UserNotFound" ], "x-omni-middleware": [ "Auth" ] } } }, "x-omni-errors": [ { "name": "Unauthenticated", "status": 401, "code": "UNAUTHENTICATED", "message": "authentication required" }, { "name": "Forbidden", "status": 403, "code": "FORBIDDEN", "message": "permission denied" }, { "name": "UserNotFound", "status": 404, "code": "USER_NOT_FOUND", "message": "user not found" }, { "name": "EmailTaken", "status": 409, "code": "EMAIL_TAKEN", "message": "email already in use" }, { "name": "InvalidUser", "status": 400, "code": "INVALID_USER", "message": "invalid user" }, { "name": "InvalidPage", "status": 400, "code": "INVALID_PAGE", "message": "invalid pagination" } ] }