Supabase User Management API

Endpoints for managing the currently authenticated user profile.

OpenAPI Specification

supabase-user-management-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Supabase Auth Admin User Management API
  description: The Supabase Auth API (based on GoTrue) is a JWT-based API for managing users and issuing access tokens. It provides endpoints for user signup, signin with email/password, magic links, one-time passwords, OAuth social login, token refresh, user management, multi-factor authentication, and SAML-based single sign-on. When deployed on Supabase, the server requires an apikey header containing a valid Supabase-issued API key.
  version: 2.0.0
  contact:
    name: Supabase Support
    url: https://supabase.com/support
  termsOfService: https://supabase.com/terms
servers:
- url: https://{project_ref}.supabase.co/auth/v1
  description: Supabase Project Auth Server
  variables:
    project_ref:
      description: Your Supabase project reference ID
      default: your-project-ref
security:
- apiKeyAuth: []
tags:
- name: User Management
  description: Endpoints for managing the currently authenticated user profile.
paths:
  /user:
    get:
      operationId: getUser
      summary: Get the current user
      description: Returns the user object for the currently authenticated user based on the access token in the Authorization header.
      tags:
      - User Management
      security:
      - bearerAuth: []
      responses:
        '200':
          description: Successfully retrieved user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '401':
          description: Unauthorized
    put:
      operationId: updateUser
      summary: Update the current user
      description: Updates the currently authenticated user's profile data including email, phone, password, and custom user metadata.
      tags:
      - User Management
      security:
      - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserRequest'
      responses:
        '200':
          description: User updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '422':
          description: Unprocessable entity
components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique user identifier
        aud:
          type: string
          description: Audience claim
        role:
          type: string
          description: User role
        email:
          type: string
          format: email
          description: User email address
        email_confirmed_at:
          type: string
          format: date-time
          description: Timestamp when email was confirmed
        phone:
          type: string
          description: User phone number
        phone_confirmed_at:
          type: string
          format: date-time
          description: Timestamp when phone was confirmed
        confirmed_at:
          type: string
          format: date-time
          description: Timestamp when user was confirmed
        last_sign_in_at:
          type: string
          format: date-time
          description: Timestamp of last sign-in
        app_metadata:
          type: object
          properties:
            provider:
              type: string
              description: Primary authentication provider
            providers:
              type: array
              items:
                type: string
              description: List of linked authentication providers
          description: Application-level metadata
        user_metadata:
          type: object
          description: Custom user metadata
        identities:
          type: array
          items:
            $ref: '#/components/schemas/Identity'
          description: Linked identity providers
        factors:
          type: array
          items:
            $ref: '#/components/schemas/MfaFactor'
          description: Enrolled MFA factors
        created_at:
          type: string
          format: date-time
          description: Timestamp when user was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when user was last updated
    MfaFactor:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique factor identifier
        friendly_name:
          type: string
          description: Human-readable name for the factor
        factor_type:
          type: string
          description: Type of MFA factor
          enum:
          - totp
        status:
          type: string
          description: Factor status
          enum:
          - verified
          - unverified
        created_at:
          type: string
          format: date-time
          description: Timestamp when factor was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when factor was last updated
    Identity:
      type: object
      properties:
        id:
          type: string
          description: Unique identity identifier
        user_id:
          type: string
          format: uuid
          description: ID of the associated user
        identity_data:
          type: object
          description: Data from the identity provider
        provider:
          type: string
          description: Identity provider name
        last_sign_in_at:
          type: string
          format: date-time
          description: Timestamp of last sign-in with this identity
        created_at:
          type: string
          format: date-time
          description: Timestamp when identity was linked
        updated_at:
          type: string
          format: date-time
          description: Timestamp when identity was last updated
    UpdateUserRequest:
      type: object
      properties:
        email:
          type: string
          format: email
          description: New email address
        phone:
          type: string
          description: New phone number
        password:
          type: string
          description: New password
          minLength: 6
        data:
          type: object
          description: Custom user metadata to update
        nonce:
          type: string
          description: Nonce for reauthentication when changing password
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apikey
      description: Supabase project API key (anon key for public operations, service_role key for admin operations).
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT access token obtained from a successful authentication.
externalDocs:
  description: Supabase Auth Documentation
  url: https://supabase.com/docs/guides/auth