SuperTokens Email Password API

Email and password sign-up, sign-in, and password management

OpenAPI Specification

supertokens-email-password-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: SuperTokens Core Driver Interface Email Password API
  description: The Core Driver Interface (CDI) is the REST API exposed by the supertokens-core HTTP service. Backend SDKs (Node.js, Python, Go) use this API to communicate with the core service for authentication operations including session management, user sign-up/sign-in, email verification, password reset, social login, passwordless authentication, multi-tenancy, and user metadata management.
  version: '5.1'
  contact:
    name: SuperTokens
    url: https://supertokens.com
    email: team@supertokens.com
  license:
    name: Apache-2.0
    url: https://github.com/supertokens/supertokens-core/blob/master/LICENSE.md
servers:
- url: http://{host}:{port}
  description: SuperTokens Core service
  variables:
    host:
      default: localhost
      description: Hostname of the SuperTokens Core instance
    port:
      default: '3567'
      description: Port number of the SuperTokens Core instance
security:
- ApiKeyAuth: []
tags:
- name: Email Password
  description: Email and password sign-up, sign-in, and password management
paths:
  /recipe/signup:
    post:
      operationId: emailPasswordSignUp
      summary: Email Password Sign Up
      description: Creates a new user account with email and password credentials.
      tags:
      - Email Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignUpRequest'
      responses:
        '200':
          description: User created successfully or email already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignUpResponse'
  /recipe/signin:
    post:
      operationId: emailPasswordSignIn
      summary: Email Password Sign In
      description: Authenticates a user with email and password, returning user information.
      tags:
      - Email Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignInRequest'
      responses:
        '200':
          description: Authentication successful or wrong credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignInResponse'
  /recipe/user/password/reset/token:
    post:
      operationId: createResetPasswordToken
      summary: Create Reset Password Token
      description: Generates a password reset token for the specified user.
      tags:
      - Email Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordTokenRequest'
      responses:
        '200':
          description: Password reset token generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResetPasswordTokenResponse'
  /recipe/user/password/reset:
    post:
      operationId: resetPassword
      summary: Reset Password
      description: Resets the user's password using a valid reset token.
      tags:
      - Email Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordRequest'
      responses:
        '200':
          description: Password reset successful or invalid token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusResponse'
components:
  schemas:
    User:
      type: object
      description: A SuperTokens user object
      properties:
        id:
          type: string
          description: Unique user ID
        emails:
          type: array
          items:
            type: string
        phoneNumbers:
          type: array
          items:
            type: string
        thirdParty:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              userId:
                type: string
        timeJoined:
          type: integer
          description: Unix timestamp when user joined
        tenantIds:
          type: array
          items:
            type: string
        loginMethods:
          type: array
          items:
            type: object
    SignInResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - OK
          - WRONG_CREDENTIALS_ERROR
        user:
          $ref: '#/components/schemas/User'
    SignInRequest:
      type: object
      required:
      - email
      - password
      properties:
        email:
          type: string
          format: email
        password:
          type: string
          format: password
        tenantId:
          type: string
    SignUpRequest:
      type: object
      required:
      - email
      - password
      properties:
        email:
          type: string
          format: email
        password:
          type: string
          format: password
        tenantId:
          type: string
    ResetPasswordRequest:
      type: object
      required:
      - method
      - token
      - newPassword
      properties:
        method:
          type: string
          enum:
          - token
        token:
          type: string
        newPassword:
          type: string
          format: password
    ResetPasswordTokenResponse:
      type: object
      properties:
        status:
          type: string
        token:
          type: string
    StatusResponse:
      type: object
      properties:
        status:
          type: string
          example: OK
    SignUpResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - OK
          - EMAIL_ALREADY_EXISTS_ERROR
        user:
          $ref: '#/components/schemas/User'
    ResetPasswordTokenRequest:
      type: object
      required:
      - userId
      - email
      properties:
        userId:
          type: string
        email:
          type: string
          format: email
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-key
      description: SuperTokens Core API key (configured in config.yaml or via environment variable)