Supabase Functions API

Deploy and manage Edge Functions for serverless compute at the edge.

OpenAPI Specification

supabase-functions-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Supabase Auth Admin Functions 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: Functions
  description: Deploy and manage Edge Functions for serverless compute at the edge.
paths:
  /projects/{ref}/functions:
    get:
      operationId: listFunctions
      summary: List Edge Functions
      description: Returns a list of all Edge Functions deployed to a project including their status, slug, and creation date.
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/ProjectRef'
      responses:
        '200':
          description: Successfully retrieved functions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EdgeFunction'
        '401':
          description: Unauthorized
        '404':
          description: Project not found
    post:
      operationId: createFunction
      summary: Create an Edge Function
      description: Deploys a new Edge Function to the project. The function will be globally distributed and accessible via HTTP requests.
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/ProjectRef'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFunctionRequest'
      responses:
        '201':
          description: Function created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EdgeFunction'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
  /projects/{ref}/functions/{function_slug}:
    get:
      operationId: getFunction
      summary: Get an Edge Function
      description: Retrieves details about a specific Edge Function including its slug, status, version, and creation date.
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/ProjectRef'
      - $ref: '#/components/parameters/FunctionSlug'
      responses:
        '200':
          description: Successfully retrieved function
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EdgeFunction'
        '401':
          description: Unauthorized
        '404':
          description: Function not found
    patch:
      operationId: updateFunction
      summary: Update an Edge Function
      description: Updates an existing Edge Function with new code or configuration changes.
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/ProjectRef'
      - $ref: '#/components/parameters/FunctionSlug'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFunctionRequest'
      responses:
        '200':
          description: Function updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EdgeFunction'
        '401':
          description: Unauthorized
        '404':
          description: Function not found
    delete:
      operationId: deleteFunction
      summary: Delete an Edge Function
      description: Permanently removes an Edge Function from the project.
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/ProjectRef'
      - $ref: '#/components/parameters/FunctionSlug'
      responses:
        '200':
          description: Function deleted successfully
        '401':
          description: Unauthorized
        '404':
          description: Function not found
components:
  schemas:
    CreateFunctionRequest:
      type: object
      required:
      - slug
      - name
      - body
      properties:
        slug:
          type: string
          description: URL-friendly slug for the function
        name:
          type: string
          description: Display name
        body:
          type: string
          description: Function source code
        verify_jwt:
          type: boolean
          description: Whether to require JWT verification
          default: true
    EdgeFunction:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the function
        slug:
          type: string
          description: URL-friendly slug for the function
        name:
          type: string
          description: Display name of the function
        status:
          type: string
          description: Deployment status
          enum:
          - ACTIVE
          - REMOVED
          - THROTTLED
        version:
          type: integer
          description: Current deployment version
        created_at:
          type: string
          format: date-time
          description: Timestamp when the function was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the function was last updated
        verify_jwt:
          type: boolean
          description: Whether JWT verification is required for invocations
    UpdateFunctionRequest:
      type: object
      properties:
        body:
          type: string
          description: Updated function source code
        verify_jwt:
          type: boolean
          description: Whether to require JWT verification
  parameters:
    ProjectRef:
      name: ref
      in: path
      required: true
      description: The unique reference ID for the project, found in the project settings or URL.
      schema:
        type: string
    FunctionSlug:
      name: function_slug
      in: path
      required: true
      description: The URL-friendly slug identifier for the Edge Function.
      schema:
        type: string
  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