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

# Get import source schema

> Get column schema for an import source table or SQL query.



## OpenAPI

````yaml /generated/openapi-import-generated-2023-12-01.json post /import/sources/{id}/get-schema
openapi: 3.1.0
info:
  title: Prequel Data Import
  description: Data Import API spec
  version: '2023-12-01'
servers:
  - url: https://api.prequel.co
    description: Cloud-hosted server (US)
  - url: https://eu-api.prequel.co
    description: Cloud-hosted server (EU)
  - url: https://{custom_host}
    description: Self-hosted Prequel API host
security:
  - ApiKeyAuth: []
paths:
  /import/sources/{id}/get-schema:
    post:
      tags:
        - Import Sources
      summary: Get import source schema
      description: Get column schema for an import source table or SQL query.
      operationId: get-import-source-schema
      parameters:
        - name: id
          in: path
          required: true
          description: Import Source ID.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SourcePreviewOptions'
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: >-
                https://github.com/prequel-co/datafeed/internal/import/api/models/source-preview-options
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    $ref: '#/components/schemas/SourceSchemaResponse'
                    $schema: https://json-schema.org/draft/2020-12/schema
                    $id: >-
                      https://github.com/prequel-co/datafeed/internal/import/api/models/source-schema-response
                  message:
                    type: string
                type: object
                required:
                  - status
                  - data
                  - message
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SourcePreviewOptions:
      allOf:
        - oneOf:
            - properties:
                method:
                  const: table
                table:
                  $ref: '#/components/schemas/TableOptions'
                  title: Table Configuration
              required:
                - method
                - table
              title: Table Configuration
            - properties:
                method:
                  const: sql
                sql:
                  $ref: '#/components/schemas/SQLOptions'
                  title: SQL Configuration
              required:
                - method
                - sql
              title: SQL Configuration
            - properties:
                method:
                  const: glob
                glob:
                  $ref: '#/components/schemas/GlobOptions'
                  title: Glob Configuration
              required:
                - method
                - glob
              title: Glob Configuration
      properties: {}
      type: object
      unevaluatedProperties: false
    SourceSchemaResponse:
      properties:
        schema:
          items:
            $ref: '#/components/schemas/SourcePreviewSchemaField'
          type: array
      additionalProperties: false
      type: object
      required:
        - schema
    TableOptions:
      properties:
        source_table_namespace:
          type: string
          pattern: ^[A-Za-z0-9_.]+([-][A-Za-z0-9_.]+)*$
          title: Source Table Namespace
          description: Namespace or schema of the source table.
        source_table_name:
          type: string
          pattern: ^[A-Za-z0-9_.]+([-][A-Za-z0-9_.]+)*$
          title: Source Table Name
          description: Name of the source table.
      additionalProperties: false
      type: object
      required:
        - source_table_namespace
        - source_table_name
    SQLOptions:
      properties:
        query:
          type: string
          title: Query
          description: SQL query to execute.
      additionalProperties: false
      type: object
      required:
        - query
    GlobOptions:
      properties:
        pattern:
          type: string
          title: Pattern
          description: Glob pattern for object files.
        format:
          type: string
          enum:
            - csv
            - parquet
            - jsonl
            - json
          title: Format
          description: Format of the object files.
      additionalProperties: false
      type: object
      required:
        - pattern
        - format
    SourcePreviewSchemaField:
      properties:
        name:
          type: string
        raw_type:
          type: string
        prequel_type:
          type: string
        ordinal_position:
          type: integer
        is_nullable:
          type: boolean
      additionalProperties: false
      type: object
      required:
        - name
        - raw_type
        - prequel_type
        - ordinal_position
    ErrorResponse:
      properties:
        status:
          type: string
          const: error
        message:
          type: string
        data:
          type: 'null'
      type: object
      required:
        - status
        - message
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````