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

# Post spacedata dbpreflight

> Validate a PostgreSQL data database before binding it to a space

Required token scopes: `space|create`



## OpenAPI

````yaml /swagger.json post /space/data-db/preflight
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
tags:
  - name: base
    x-group: project
  - name: base node
    x-group: project node
  - name: base-share
    x-group: project-share
paths:
  /space/data-db/preflight:
    post:
      tags:
        - space
      description: |-
        Validate a PostgreSQL data database before binding it to a space

        Required token scopes: `space|create`
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  minLength: 1
                spaceId:
                  type: string
                targetMode:
                  type: string
                  enum:
                    - initialize-empty
                    - migrate-space
                    - adopt-existing
                  default: initialize-empty
                internalSchema:
                  type: string
                  pattern: ^[a-z_]\w*$/i
                confirmLargeMigration:
                  type: boolean
                switchOnCompletion:
                  type: boolean
              required:
                - url
      responses:
        '200':
          description: Returns PostgreSQL data database validation details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  provider:
                    type: string
                    enum:
                      - postgres
                  maskedUrl:
                    type: string
                  urlFingerprint:
                    type: string
                  displayHost:
                    type: string
                  displayDatabase:
                    type: string
                  internalSchema:
                    type: string
                  serverVersion:
                    type: string
                  classification:
                    type: string
                    enum:
                      - empty
                      - teable-managed-compatible
                      - teable-managed-incompatible
                      - non-empty-unknown
                  availableDatabases:
                    type: array
                    items:
                      type: string
                  requiresDatabaseSelection:
                    type: boolean
                  capabilities:
                    type: object
                    properties:
                      createSchema:
                        type: boolean
                      createTable:
                        type: boolean
                      createFunction:
                        type: boolean
                      createTrigger:
                        type: boolean
                      createRole:
                        type: boolean
                      grantPrivileges:
                        type: boolean
                      inspectActivity:
                        type: boolean
                    required:
                      - createSchema
                      - createTable
                      - createFunction
                      - createTrigger
                      - createRole
                      - grantPrivileges
                      - inspectActivity
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                        message:
                          type: string
                        remediation:
                          type: string
                      required:
                        - code
                        - message
                required:
                  - ok
                  - provider
                  - classification
                  - capabilities
                  - errors
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request POST \
              --url https://app.teable.ai/api/space/data-db/preflight \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"url":"string","spaceId":"string","targetMode":"initialize-empty","internalSchema":"string","confirmLargeMigration":true,"switchOnCompletion":true}'
        - lang: JavaScript
          source: |-
            const url = 'https://app.teable.ai/api/space/data-db/preflight';
            const options = {
              method: 'POST',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              },
              body: '{"url":"string","spaceId":"string","targetMode":"initialize-empty","internalSchema":"string","confirmLargeMigration":true,"switchOnCompletion":true}'
            };

            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: |-
            const http = require('https');

            const options = {
              method: 'POST',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/space/data-db/preflight',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              url: 'string',
              spaceId: 'string',
              targetMode: 'initialize-empty',
              internalSchema: 'string',
              confirmLargeMigration: true,
              switchOnCompletion: true
            }));
            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            payload =
            "{\"url\":\"string\",\"spaceId\":\"string\",\"targetMode\":\"initialize-empty\",\"internalSchema\":\"string\",\"confirmLargeMigration\":true,\"switchOnCompletion\":true}"


            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
            }


            conn.request("POST", "/api/space/data-db/preflight", payload,
            headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````