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

# AI-generate a schema from sample data

> AI-generate a schema from sample data.

## Usage notes

`sample_data` may be CSV text, a header row, or a free-text description. Lasso analyzes at most the first 5,000 characters and immediately saves the generated Product Schema.

Review the returned columns before using the schema for extraction. Generation may create or attach company Attributes for the proposed keys.


## OpenAPI

````yaml openapi.yaml POST /schemas/generate
openapi: 3.1.0
info:
  title: Lasso API
  description: AI-powered product data extraction and enhancement API
  version: 1.0.0
  contact:
    name: Lasso Support
    url: https://lasso.ai
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://app.productlasso.com/api/v1
    description: Production
security:
  - BearerAuth: []
paths:
  /schemas/generate:
    post:
      tags:
        - Schemas
      summary: AI-generate a schema from sample data
      operationId: generateSchema
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sample_data:
                  type: string
                  description: >-
                    CSV text, column headers, or free-text description of the
                    data structure
                name:
                  type: string
                  description: Optional name for the generated schema
      responses:
        '201':
          description: Generated schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schema'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    Schema:
      type: object
      required:
        - id
        - name
        - columns
        - created_at
        - updated_at
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        is_default:
          type: boolean
        columns:
          type: array
          items:
            $ref: '#/components/schemas/Column'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      examples:
        - id: 9e1c77dd-8f10-41ca-bfe8-e672b89692d1
          name: Supplier products
          description: Core supplier feed fields
          is_default: false
          columns:
            - id: 8d79b7da-7134-443e-8110-678fe04de51b
              attribute_id: 11111111-1111-4111-8111-111111111111
              kind: attribute
              key: product_name
              label: Product name
              type: text
          created_at: '2026-08-31T09:00:00.000Z'
          updated_at: '2026-08-31T09:00:00.000Z'
    Column:
      type: object
      additionalProperties: true
      required:
        - attribute_id
        - kind
        - key
        - label
        - type
      description: >
        A column returned by schema and table read APIs. Every returned column
        includes

        `attribute_id` and `kind`. Attribute columns are hydrated from the
        current company

        Attribute definition; helpers keep their table- or schema-local
        definition.


        API visibility does not imply eligibility for Catalog or other
        persistent/scheduled

        sync destinations. Those destinations accept canonical Attribute-backed
        columns only.

        Filter canonical columns with `kind == "attribute"`; helpers remain
        available for

        one-time table reads and file exports according to the destination's
        rules.
      properties:
        id:
          type: string
          description: >-
            Server-issued stable usage ID. Retain it when round-tripping schema
            updates.
        attribute_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Stable company Attribute ID, or null for a local helper.
        kind:
          type: string
          enum:
            - attribute
            - helper
          description: >-
            Derived column identity. Callers cannot use this field to bypass
            destination eligibility.
        attribute_status:
          type: string
          enum:
            - active
            - archived
        attribute_archived_at:
          type:
            - string
            - 'null'
          format: date-time
        attribute_resolution_error:
          type: string
          enum:
            - missing_attribute
        key:
          type: string
          description: Unique column identifier
        label:
          type: string
          description: Display name
        type:
          $ref: '#/components/schemas/ColumnType'
        format_output_type:
          oneOf:
            - $ref: '#/components/schemas/FormatOutputType'
            - type: 'null'
          description: >-
            Declared stored value type for Formula columns. Null or omitted
            defaults to text.
        required:
          type: boolean
          default: false
        description:
          type: string
        language:
          type:
            - string
            - 'null'
          description: >-
            Language code inherited from the canonical Attribute when
            configured.
        enum_values:
          type: array
          items:
            type: string
          description: Allowed values for enum and tags types
        tags_values:
          type: array
          items:
            type: string
        boolean_config:
          type: object
          additionalProperties: true
        number_config:
          oneOf:
            - $ref: '#/components/schemas/NumberConfig'
            - type: 'null'
          description: Canonical presentation metadata. API values remain raw numbers.
        validation:
          oneOf:
            - type: object
              additionalProperties: true
            - type: string
        image_config:
          type: object
          additionalProperties: true
        runnable_config:
          type: object
          additionalProperties: true
        format_config:
          type: object
          additionalProperties: true
        enum_config:
          type: object
          additionalProperties: true
        tags_config:
          type: object
          additionalProperties: true
        relation_config:
          type:
            - object
            - 'null'
          additionalProperties: true
        zip_export_config:
          type: object
          additionalProperties: true
        fast_photo_config:
          type: object
          additionalProperties: true
        content_template:
          type: object
          description: >-
            Rich-text content template configuration. See the Content templates
            guide for visual layouts, coded definitions, and export styling.
          additionalProperties: true
        always_export:
          type: boolean
        never_export:
          type: boolean
        zip_name_column:
          type: string
        content_template_id:
          type: string
        is_title:
          type: boolean
        is_thumbnail:
          type: boolean
          description: >-
            Marks this Shared image/gallery usage as the Catalog product
            thumbnail.
      examples:
        - attribute_id: 11111111-1111-4111-8111-111111111111
          kind: attribute
          key: product_name
          label: Product name
          type: text
          language: en
        - attribute_id: null
          kind: helper
          key: working_copy
          label: Working copy
          type: text
    Error:
      type: object
      required:
        - status_code
        - error_type
        - message
        - request_id
      properties:
        status_code:
          type: integer
        error_type:
          type: string
          enum:
            - invalid_request
            - unauthenticated
            - forbidden
            - not_found
            - conflict
            - validation_error
            - rate_limited
            - service_unavailable
            - internal_error
        message:
          type: string
        request_id:
          type: string
        code:
          type: string
          description: >-
            Stable machine-readable detail code for validation, conflict, and
            retryable availability errors.
        retryable:
          type: boolean
          description: Whether the request can be retried without changing its payload.
        attribute_id:
          type: string
          format: uuid
          description: Stable Attribute identity when the error is scoped to one Attribute.
        attribute_key:
          type: string
          description: Attribute key when the error is scoped to one Attribute.
        details:
          type: object
          additionalProperties: true
        current_updated_at:
          type: string
          format: date-time
          description: >-
            Current resource revision supplied for client-directed refetch after
            a stale write.
    ColumnType:
      type: string
      enum:
        - text
        - number
        - url
        - email
        - date
        - boolean
        - richtext
        - runnable
        - format
        - enum
        - tags
        - image
        - images
        - file
        - files
        - json
        - relation
    FormatOutputType:
      type: string
      enum:
        - text
        - number
        - boolean
        - json
        - richtext
        - file
        - image
      description: >-
        The stored result type produced by a format Attribute. Format formulas
        execute only in Extraction; Catalog stores the resulting value.
    NumberConfig:
      type: object
      additionalProperties: false
      description: >-
        Presentation metadata for number and Formula-number Attributes. Stored
        and API values remain numeric.
      properties:
        unit:
          type: string
          minLength: 1
          maxLength: 64
          description: Literal, untranslated unit.
        unit_position:
          type: string
          enum:
            - before
            - after
          default: after
        format_style:
          type: string
          enum:
            - dot_plain
            - comma_plain
            - dot_with_comma_grouping
            - comma_with_dot_grouping
            - dot_with_space_grouping
            - comma_with_space_grouping
        file_export:
          type: string
          enum:
            - raw
            - formatted_text
          default: raw
          description: >-
            Applies to CSV/XLSX file exports, including files requested through
            export endpoints. JSON and non-file API or integration values remain
            raw.
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.