Neon Data API API

Manage Data API configuration for branches, including enabling and disabling the PostgREST-compatible HTTP interface.

OpenAPI Specification

neon-data-api-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Neon Management API Keys Data API API
  description: The Neon Management API is a RESTful interface for programmatically managing Neon serverless Postgres resources. It allows developers to create and manage projects, branches, databases, roles, compute endpoints, and operations. The API supports everything available through the Neon Console, enabling automation of database infrastructure workflows. An OpenAPI 3.0 specification is available along with TypeScript, Python, and Go SDKs.
  version: '2.0'
  contact:
    name: Neon Support
    url: https://neon.com/docs/introduction/support
  termsOfService: https://neon.com/terms-of-service
servers:
- url: https://console.neon.tech/api/v2
  description: Neon Production API
security:
- bearerAuth: []
tags:
- name: Data API
  description: Manage Data API configuration for branches, including enabling and disabling the PostgREST-compatible HTTP interface.
paths:
  /projects/{project_id}/branches/{branch_id}/data-api:
    get:
      operationId: getProjectBranchDataApi
      summary: Get Data API configuration
      description: Retrieves the Data API configuration for the specified branch, including whether it is enabled, the target database, exposed schemas, and authentication provider settings.
      tags:
      - Data API
      parameters:
      - $ref: '#/components/parameters/projectIdParam'
      - $ref: '#/components/parameters/branchIdParam'
      responses:
        '200':
          description: Successfully retrieved Data API configuration
          content:
            application/json:
              schema:
                type: object
                properties:
                  data_api:
                    $ref: '#/components/schemas/DataApiConfig'
        '401':
          description: Unauthorized
        '404':
          description: Branch not found
    put:
      operationId: updateProjectBranchDataApi
      summary: Update Data API configuration
      description: Updates the Data API configuration for the specified branch, including enabling or disabling the API, configuring exposed schemas, setting response limits, and configuring authentication providers.
      tags:
      - Data API
      parameters:
      - $ref: '#/components/parameters/projectIdParam'
      - $ref: '#/components/parameters/branchIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataApiConfigUpdate'
      responses:
        '200':
          description: Data API configuration updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data_api:
                    $ref: '#/components/schemas/DataApiConfig'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Branch not found
components:
  schemas:
    DataApiConfig:
      type: object
      description: Configuration for the Neon Data API on a branch, providing a PostgREST-compatible HTTP interface to the database.
      properties:
        enabled:
          type: boolean
          description: Whether the Data API is enabled for this branch
        database_name:
          type: string
          description: The target database for the Data API
        exposed_schemas:
          type: array
          items:
            type: string
          description: List of database schemas exposed through the Data API
        max_rows:
          type: integer
          description: Maximum number of rows returned in a single API response
        auth_provider:
          type: string
          description: The authentication provider that validates JWT tokens for Data API requests
    DataApiConfigUpdate:
      type: object
      description: Request body for updating Data API configuration
      properties:
        enabled:
          type: boolean
          description: Whether to enable or disable the Data API
        database_name:
          type: string
          description: The target database
        exposed_schemas:
          type: array
          items:
            type: string
          description: Schemas to expose
        max_rows:
          type: integer
          description: Maximum rows per response
        auth_provider:
          type: string
          description: Authentication provider for JWT validation
  parameters:
    projectIdParam:
      name: project_id
      in: path
      required: true
      description: The Neon project ID
      schema:
        type: string
    branchIdParam:
      name: branch_id
      in: path
      required: true
      description: The branch ID
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Neon API keys are used to authenticate requests. Include the API key in the Authorization header as a Bearer token.
externalDocs:
  description: Neon API Documentation
  url: https://neon.com/docs/reference/api-reference