openapi: 3.1.0 info: title: API Template version: 1.0.0 servers: - url: / paths: /auth: post: summary: Register user account requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/AuthSignUpRequest' responses: '200': description: Registration accepted content: application/json: schema: $ref: '#/components/schemas/AuthRegisterSuccessResponse' '422': description: Registration validation error content: application/json: schema: $ref: '#/components/schemas/AuthRegisterErrorResponse' /auth/sign_in: post: summary: Sign in and issue token headers requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/AuthSignInRequest' responses: '200': description: Login success headers: Authorization: schema: type: string example: Bearer eyJhbGciOi... access-token: schema: type: string client: schema: type: string uid: schema: type: string expiry: schema: type: string token-type: schema: type: string example: Bearer content: application/json: schema: $ref: '#/components/schemas/AuthSessionSuccessResponse' '401': description: Bad credentials or unconfirmed account content: application/json: schema: $ref: '#/components/schemas/AuthErrorResponse' /auth/sign_out: delete: summary: Sign out and revoke current token client security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] responses: '200': description: Logout success content: application/json: schema: $ref: '#/components/schemas/AuthSignOutSuccessResponse' '404': description: Token/session not found content: application/json: schema: $ref: '#/components/schemas/AuthErrorResponse' /auth/validate_token: get: summary: Validate token headers and return current auth user security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] responses: '200': description: Valid token content: application/json: schema: $ref: '#/components/schemas/AuthSessionSuccessResponse' '401': description: Invalid token content: application/json: schema: $ref: '#/components/schemas/AuthErrorResponse' /api/v1/users: get: summary: List users security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] parameters: - in: query name: page required: false schema: type: integer minimum: 1 - in: query name: per_page required: false schema: type: integer minimum: 1 responses: '200': description: Users list content: application/json: schema: $ref: '#/components/schemas/UsersIndexResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' '403': description: Not authorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' post: summary: Create user requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateUserRequest' responses: '201': description: Created user content: application/json: schema: $ref: '#/components/schemas/UserShowResponse' '422': description: Validation error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v1/users/me: get: summary: Current authenticated user security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] responses: '200': description: Current user content: application/json: schema: $ref: '#/components/schemas/UserShowResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' /api/v1/features: get: summary: Effective feature flags for current authenticated user security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] responses: '200': description: Feature flag states for the current actor content: application/json: schema: $ref: '#/components/schemas/FeatureFlagsResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' /api/v1/errors: post: summary: Report client-side web/mobile JavaScript errors requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ClientErrorReportRequest' responses: '202': description: Error report accepted content: application/json: schema: $ref: '#/components/schemas/BaseSuccess' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /api/v1/push_devices: post: summary: Register or update current user's push device security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PushDeviceRegistrationRequest' responses: '202': description: Push registration accepted content: application/json: schema: $ref: '#/components/schemas/BaseSuccess' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' delete: summary: Deactivate current user's push registration security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] parameters: - in: query name: push_token required: true schema: type: string responses: '202': description: Push registration deactivation accepted content: application/json: schema: $ref: '#/components/schemas/BaseSuccess' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Push token is not owned by current user content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' /api/v1/users/{id}: parameters: - in: path name: id required: true schema: type: integer get: summary: Fetch user by id security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] responses: '200': description: User detail content: application/json: schema: $ref: '#/components/schemas/UserShowResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' '403': description: Not authorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' put: summary: Update user security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateUserRequest' responses: '200': description: Updated user content: application/json: schema: $ref: '#/components/schemas/UserShowResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' '403': description: Not authorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '422': description: Validation error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' patch: summary: Partially update user security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] - BearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateUserRequest' responses: '200': description: Updated user content: application/json: schema: $ref: '#/components/schemas/UserShowResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' '403': description: Not authorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '422': description: Validation error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' delete: summary: Delete user security: - AccessTokenAuth: [] ClientAuth: [] UidAuth: [] responses: '200': description: Deleted user content: application/json: schema: $ref: '#/components/schemas/UserShowResponse' '401': description: Missing or invalid auth headers content: application/json: schema: $ref: '#/components/schemas/AuthRequiredErrorResponse' '403': description: Not authorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' components: securitySchemes: BearerAuth: type: http scheme: bearer AccessTokenAuth: type: apiKey in: header name: access-token ClientAuth: type: apiKey in: header name: client UidAuth: type: apiKey in: header name: uid schemas: BaseSuccess: type: object required: - success - request_id - meta properties: success: type: boolean const: true request_id: type: string meta: type: object additionalProperties: true ErrorResponse: type: object required: - success - error - request_id properties: success: type: boolean const: false error: type: object required: - type - message - details properties: type: type: string message: type: string details: type: array items: type: string request_id: type: string AuthErrorResponse: type: object required: - success - errors properties: success: type: boolean const: false errors: type: array items: type: string AuthRequiredErrorResponse: type: object required: - errors properties: errors: type: array items: type: string AuthUser: type: object required: - id - uid - provider - email properties: id: type: integer uid: type: string format: email provider: type: string example: email email: type: string format: email name: type: [string, 'null'] nickname: type: [string, 'null'] image: type: [string, 'null'] allow_password_change: type: [boolean, 'null'] AuthSessionSuccessResponse: type: object required: - data properties: data: $ref: '#/components/schemas/AuthUser' AuthRegisterSuccessResponse: type: object required: - status - data properties: status: type: string const: success data: $ref: '#/components/schemas/AuthUser' AuthRegisterErrorResponse: type: object required: - status - data - errors properties: status: type: string const: error data: type: object additionalProperties: true errors: type: object additionalProperties: type: array items: type: string AuthSignOutSuccessResponse: type: object required: - success properties: success: type: boolean const: true AuthSignUpRequest: type: object properties: email: type: string format: email password: type: string password_confirmation: type: string confirm_success_url: type: string format: uri required: - email - password - password_confirmation - confirm_success_url AuthSignInRequest: type: object properties: email: type: string format: email password: type: string required: - email - password CreateUserRequest: type: object properties: name: type: string email: type: string format: email password: type: string password_confirmation: type: string required: - email - password - password_confirmation UpdateUserRequest: type: object properties: name: type: string email: type: string format: email PaginationMeta: type: object properties: count: type: integer page: type: integer limit: type: integer pages: type: integer prev: type: [integer, 'null'] next: type: [integer, 'null'] additionalProperties: true PaginationEnvelope: type: object required: - pagination properties: pagination: $ref: '#/components/schemas/PaginationMeta' additionalProperties: true User: type: object required: - id - email - admin - created_at - updated_at properties: id: type: integer email: type: string format: email name: type: [string, 'null'] admin: type: boolean created_at: type: string format: date-time updated_at: type: string format: date-time UserShowResponse: allOf: - $ref: '#/components/schemas/BaseSuccess' - type: object required: - data properties: data: $ref: '#/components/schemas/User' UsersIndexResponse: allOf: - $ref: '#/components/schemas/BaseSuccess' - type: object required: - data properties: data: type: array items: $ref: '#/components/schemas/User' meta: $ref: '#/components/schemas/PaginationEnvelope' FeatureFlagsResponse: allOf: - $ref: '#/components/schemas/BaseSuccess' - type: object required: - data properties: data: type: object additionalProperties: type: boolean ClientErrorReportRequest: type: object required: - error properties: client: type: string description: Optional client type. Known values are mobile and web; omitted or unrecognized values are normalized to unknown server-side. example: mobile origin: type: string description: Client-reported origin/category (for example application, uncaught_exception, react_error_boundary). example: application handled: type: boolean default: true error: $ref: '#/components/schemas/ClientErrorPayload' context: type: object additionalProperties: true ClientErrorPayload: type: object required: - message properties: name: type: string example: TypeError message: type: string stack: type: string PushDeviceRegistrationRequest: type: object required: - push_token properties: push_token: type: string example: ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx] platform: type: string description: Optional client platform value normalized server-side. example: ios app_version: type: string example: 1.4.0 build_version: type: string example: '42'