> ## Documentation Index
> Fetch the complete documentation index at: https://docs.px0.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Reset Password

> Resets a user's password using a valid reset code and a new password, deriving the user from the code in the database.



## OpenAPI

````yaml /openapi.yaml post /v1/auth/password-reset/reset
openapi: 3.1.0
info:
  title: px0 API
  description: >
    px[0] is an open-source prompt infrastructure toolkit for managing prompts
    in production. It replaces hardcoded prompt strings with versioned
    templates, in-process caching, and OpenTelemetry observability, so teams can
    iterate on prompts without touching application code. This is the OpenAPI
    specification for all the public APIs of px0.
  version: 1.0.0
servers:
  - url: http://localhost:3000
    description: Local development server
security: []
paths:
  /v1/auth/password-reset/reset:
    post:
      tags:
        - Auth
      summary: Reset Password
      description: >-
        Resets a user's password using a valid reset code and a new password,
        deriving the user from the code in the database.
      operationId: resetPassword
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordRequest'
      responses:
        '200':
          description: Password reset successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: password reset successfully
                  email:
                    type: string
                    format: email
                    example: user@example.com
                required:
                  - message
                  - email
        '400':
          description: Invalid input or invalid/expired code
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              examples:
                missing_fields:
                  summary: Missing code or password
                  value:
                    error: code and new_password are required
                short_password:
                  summary: Password too short
                  value:
                    error: password must be at least 8 characters
                weak_password:
                  summary: Password lacks complexity
                  value:
                    error: >-
                      password must contain at least one uppercase letter, one
                      lowercase letter, one digit, and one special character
                invalid_code:
                  summary: Reset code is invalid or expired
                  value:
                    error: invalid or expired password reset code
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              example:
                error: internal error
components:
  schemas:
    ResetPasswordRequest:
      type: object
      properties:
        code:
          type: string
          example: '123456'
        new_password:
          type: string
          minLength: 8
          example: NewSecretPassword123!
      required:
        - code
        - new_password
    APIError:
      type: object
      properties:
        error:
          type: string
          example: invalid credentials
      required:
        - error

````