v1

latestOpenAPI 3.0.32026-08-06138294578.6 KB
Models

Preview Model

Submits a job that previews the fields a model would expose without persisting it.

The response contains a job ID that resolves to the list of fields the model would expose. Poll the job until it completes to retrieve the field list. The model is not persisted — this endpoint is useful for validating a query or configuration before calling POST /api/models to save it.

post/api/model-preview

Query parameters

asyncboolean

Headers

X-Polytomic-Versionstring

Request body

configurationobject required
connection_idstring uuid required
fieldsstring[] nullable
identifierstring
labelsstring[] nullable
namestring required
organization_idstring uuid nullable
policiesstring[] nullable
tracking_columnsstring[] nullable

Example request

{
  "configuration": {
    "table": "public.users"
  },
  "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
  "enricher": {
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "enricher_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "fields": [
      {
        "name": "phone_number"
      }
    ]
  },
  "identifier": "id",
  "labels": [
    "248df4b7-aa70-47b8-a036-33ac447e668d"
  ],
  "name": "Users",
  "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
  "policies": [
    "248df4b7-aa70-47b8-a036-33ac447e668d"
  ],
  "relations": [
    {
      "to": {
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      }
    }
  ]
}

Response

OK

Example response

{
  "data": {
    "configuration": {
      "table": "public.contacts"
    },
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "created_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    },
    "enricher": {
      "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "enricher_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "fields": [
        {
          "name": "phone_number"
        }
      ]
    },
    "fields": [
      {
        "created_by": {
          "id": "12345678-1234-1234-1234-123456789012",
          "name": "John Doe",
          "type": "user"
        },
        "description": "Unique identifier",
        "example": 123,
        "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
        "label": "ID",
        "name": "id",
        "remote_type": "string",
        "type": "string",
        "unique": true
      }
    ],
    "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "identifier": "id",
    "name": "Contacts",
    "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "policies": [
      "248df4b7-aa70-47b8-a036-33ac447e668d"
    ],
    "relations": [
      {
        "from": "id",
        "to": {
          "field": "user_id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        }
      }
    ],
    "type": "postgresql",
    "updated_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    },
    "version": 1
  },
  "job": {
    "error": "error message",
    "job_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "type": "createmodel"
  }
}