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

# runArtifactSchemaInference

> Run (or re-run) schema inference on a CSV artifact. Reads the head from
GCS, parses the sample, calls the inferer, and persists the resulting
schema + column metadata. Used both for the initial inference (post-
upload) and for recomputing after a prior failure or user request.



## OpenAPI

````yaml /api-reference/openapi.json post /api/artifacts/run-artifact-schema-inference
openapi: 3.0.3
info:
  title: Parable API
  description: >-
    The REST API for your Parable workspace: manage connectors and taps, explore
    your data catalog, upload artifacts, and administer users and roles.
  version: v1
servers:
  - url: https://api.askparable.com
    description: Production
security: []
paths:
  /api/artifacts/run-artifact-schema-inference:
    post:
      tags:
        - artifacts
      summary: runArtifactSchemaInference
      description: |-
        Run (or re-run) schema inference on a CSV artifact. Reads the head from
        GCS, parses the sample, calls the inferer, and persists the resulting
        schema + column metadata. Used both for the initial inference (post-
        upload) and for recomputing after a prior failure or user request.
      operationId: ArtifactsRunArtifactSchemaInferenceHandler
      parameters:
        - description: >-
            Workspace slug. Overrides subdomain-based workspace resolution when
            provided.
          in: header
          name: X-Tenant
          required: false
          schema:
            example: acme
            type: string
        - description: Optional request correlation ID echoed back in the response.
          in: header
          name: X-Request-ID
          required: false
          schema:
            example: 550e8400-e29b-41d4-a716-446655440000
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunArtifactSchemaInferenceInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/ArtifactUploadResult'
                  links:
                    $ref: '#/components/schemas/ResponseLinks'
                  meta:
                    $ref: '#/components/schemas/ResponseMeta'
                required:
                  - data
                  - meta
                type: object
          description: Successful response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error
      security:
        - bearerAuth: []
components:
  schemas:
    RunArtifactSchemaInferenceInput:
      description: >-
        Input for running (or re-running) schema inference on an existing
        artifact.
      properties:
        artifactId:
          description: UUID v4 with automatic base62 encoding for client-facing APIs
          type: string
      required:
        - artifactId
      type: object
    ArtifactUploadResult:
      description: >-
        Shared result shape for `uploadArtifact` and
        `runArtifactSchemaInference`.

        Carries the persisted artifact record alongside optional inference
        output

        and a small sample-row preview so the schema editor can render without
        an

        extra round trip.

        Inference fields are populated only by `runArtifactSchemaInference`. In

        `uploadArtifact` responses, `inference` and `inferenceError` are always

        null (upload never runs inference).
      properties:
        artifact:
          $ref: '#/components/schemas/ArtifactInfo'
          description: The persisted artifact record.
        inference:
          $ref: '#/components/schemas/ArtifactInference'
          description: |-
            Schema inference output. Always null in `uploadArtifact` responses
            (upload does not run inference). Populated by
            `runArtifactSchemaInference` on success; null on that call when
            inference failed -- in which case `inferenceError` is populated.
        inferenceError:
          $ref: '#/components/schemas/ArtifactInferenceError'
          description: >-
            Populated only by `runArtifactSchemaInference` when inference
            failed.

            The artifact remains available with `uploadStatus = READY`,

            `schemaInferenceStatus = FAILED`, and its current `dataSchema`

            unchanged. Always null in `uploadArtifact` responses.
        sampleRows:
          description: >-
            Preview rows from the parsed sample, used to seed the schema editor.

            Each row is a `Parable_SchemaData` keyed by field name, conforming
            to

            the artifact's current `dataSchema` (header-only all-`String` after

            CSV upload; the inferred schema after `runArtifactSchemaInference`).

            Empty for non-CSV uploads, which are not parsed at upload time.
          items:
            description: A Parable Schema in JSON
            type: object
          type: array
      required:
        - artifact
        - sampleRows
      type: object
    ResponseLinks:
      properties:
        first:
          nullable: true
          type: string
        last:
          nullable: true
          type: string
        next:
          nullable: true
          type: string
        prev:
          nullable: true
          type: string
      type: object
    ResponseMeta:
      properties:
        requestId:
          description: Unique identifier for the request
          type: string
        totalCount:
          description: Total count of items for paginated responses
          nullable: true
          type: integer
      required:
        - requestId
      type: object
    Error:
      properties:
        error:
          type: string
      type: object
    ArtifactInfo:
      description: Artifact metadata for customer display.
      properties:
        attributedTapId:
          description: >-
            ID of the TenantConnectorTap that was derived from this artifact, if
            any.

            Populated by a query-time lookup from
            `tenant_connector_tap.artifact_id`

            rather than a stored column (the inverse FK is intentionally
            one-way; see

            EDR-0021 Phase 1 cycle-breaking decision). Null until the artifact
            has

            been processed and its derived tap has been created.
          type: string
        createdAt:
          description: ISO8601 datetime string
          type: string
        createdBy:
          description: UUID v4 string as base62
          type: string
        dataSchema:
          description: Current persisted schema. Null until a schema is generated or saved.
          type: object
        fileName:
          type: string
        fileSize:
          description: File size in bytes (non-negative, BIGINT-backed)
          format: int64
          type: integer
        fileType:
          $ref: '#/components/schemas/ArtifactTypeEnum'
        id:
          description: UUID v4 with automatic base62 encoding for client-facing APIs
          type: string
        path:
          description: >-
            Virtual-folder path for this artifact, dot-separated ltree. NULL
            means

            the artifact lives at the workspace root.
          type: string
        schemaInferenceStatus:
          $ref: '#/components/schemas/ArtifactSchemaInferenceStatusEnum'
        updatedAt:
          description: ISO8601 datetime string
          type: string
        updatedBy:
          description: UUID v4 string as base62
          type: string
        uploadStatus:
          $ref: '#/components/schemas/ArtifactUploadStatusEnum'
        uploadedBy:
          $ref: '#/components/schemas/UserInfo'
      required:
        - id
        - createdAt
        - createdBy
        - updatedAt
        - updatedBy
        - fileName
        - fileType
        - fileSize
        - uploadStatus
        - schemaInferenceStatus
        - uploadedBy
      type: object
    ArtifactInference:
      description: |-
        Schema inference output for an uploaded artifact. The inferred schema is
        returned as a first-class `Parable_Schema` (the same shape that lives on
        the persisted `TenantArtifact.dataSchema`). Per-column inference signal
        that does not belong inside the schema itself (confidence, demotion,
        sample failure stats) lives in `columnMetadata`, keyed by `fieldPath` to
        the matching `FieldDef` in the schema.
      properties:
        columnMetadata:
          description: >-
            Per-column inference signal. Each entry references a field in
            `schema`

            via its `fieldPath` (e.g. "Inferred.email").
          items:
            $ref: '#/components/schemas/ArtifactInferenceColumnMetadata'
          type: array
        model:
          description: Provider model identifier used for inference.
          type: string
        schema:
          description: |-
            The inferred schema. Field rationale from the model is folded into
            `FieldDef.description` so the schema is self-documenting.
          type: object
        tokenInputCount:
          description: Input tokens consumed by the inference call.
          format: int64
          type: integer
        tokenOutputCount:
          description: Output tokens produced by the inference call.
          format: int64
          type: integer
      required:
        - schema
        - columnMetadata
        - model
        - tokenInputCount
        - tokenOutputCount
      type: object
    ArtifactInferenceError:
      description: Structured error returned when schema inference fails.
      properties:
        code:
          $ref: '#/components/schemas/WebApiArtifactError'
          description: Typed error code from the web-api artifact error enum.
        message:
          description: Human-readable error message.
          type: string
      required:
        - code
        - message
      type: object
    ArtifactTypeEnum:
      description: Type of uploaded artifact file
      enum:
        - csv
        - xlsx
        - xls
        - numbers
        - ods
        - zip
      type: string
    ArtifactSchemaInferenceStatusEnum:
      description: Status of optional schema inference for an artifact
      enum:
        - not_requested
        - processing
        - succeeded
        - failed
      type: string
    ArtifactUploadStatusEnum:
      description: Availability status of an uploaded artifact file
      enum:
        - pending
        - processing
        - ready
        - failed
      type: string
    UserInfo:
      description: |-
        A type for general info about a user for returning enough public facing
        user info for fields like createdBy or updatedBy.
      properties:
        email:
          description: An email address
          type: string
        id:
          description: UUID v4 with automatic base62 encoding for client-facing APIs
          type: string
        name:
          description: An objects name
          type: string
      required:
        - id
        - name
        - email
      type: object
    ArtifactInferenceColumnMetadata:
      description: |-
        Per-column inference signal that is not encoded in the `Parable_Schema`
        itself. Linked back to the schema via `fieldPath`.
      properties:
        confidence:
          $ref: '#/components/schemas/ArtifactInferenceConfidenceEnum'
          description: Inferer's reported confidence for this column.
        demoted:
          description: |-
            True if the column was demoted by post-validation (model proposed a
            scalar that the sample data did not satisfy).
          type: boolean
        fieldPath:
          description: >-
            Path to the matching `FieldDef` in the inferred schema, formatted as

            "{typeName}.{fieldName}" (e.g. "Inferred.email"). Stable identifier
            the

            editor uses to merge this metadata with the schema.
          type: string
        firstSampleError:
          description: First sample-validation error message, when one occurred.
          type: string
        sampleFailures:
          description: Number of sample values that failed validation.
          format: int64
          type: integer
        sampleSeen:
          description: Number of sample values evaluated against the chosen type.
          format: int64
          type: integer
      required:
        - fieldPath
        - confidence
        - demoted
        - sampleSeen
        - sampleFailures
      type: object
    WebApiArtifactError:
      description: web-api artifact upload errors
      enum:
        - WA-AF-001
        - WA-AF-002
        - WA-AF-003
        - WA-AF-004
        - WA-AF-005
        - WA-AF-006
        - WA-AF-007
        - WA-AF-008
        - WA-AF-009
        - WA-AF-010
        - WA-AF-011
        - WA-AF-012
        - WA-AF-013
        - WA-AF-014
        - WA-AF-015
        - WA-AF-016
        - WA-AF-017
      type: string
    ArtifactInferenceConfidenceEnum:
      description: Confidence level reported by schema inference for a single column.
      enum:
        - low
        - medium
        - high
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http

````