Skip to main content
POST

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

skipColumnQuery
boolean
default:false

Body

application/json

The input for creating a Model

name
string
required

The name of the model

slug
string
required

The slug of the model

queryType
string
required

The type of the query. Available options: custom, raw_sql, tabel, dbt and visual.

sourceId
number<double>
required

The id of the source that model is connected to

isSchema
boolean
required

If is_schema is true, the model is just used to build other models. Either as part of visual querying, or as the root of a visual query.

visual
object

Visual query, used by audience

custom
object

Custom query for sources that doesn't support sql. For example, Airtable.

table
object

Table-based query that fetches on a table instead of SQL

raw
object

Standard raw SQL query

folderId
string
spaceId
string

The Space this audience belongs to. Applies only to workspaces with Spaces enabled; contact Hightouch to enable Spaces and to obtain Space ids. Only valid when queryType is "visual". Omitted for models that are not in a Space. An API key scoped to a Space must set it on create. Read-only after creation.

rowLevelAccessRuleIds
string[]

Row-level access rules attached to this audience. Applies only to workspaces with Spaces enabled. Only valid when queryType is "visual"; always present on an audience. When creating an audience in a Space, include one rule from each required row-level access group on the parent model. Rule ids come from the Spaces governance API. Read-only after creation.

primaryKey
string

The primary key will be null if the query doesn't get directly synced (e.g. a relationship table for visual querying). Optional here but actually conditionally required: every model except a general model must supply one.

isGeneralModel
boolean

Create a general model: a model that exposes warehouse data to Hightouch AI agents instead of being synced. Takes no primaryKey and no folderId, and cannot be a schema model, and only supports certain query types.

description
string

The description of the model. On a general model this is the context AI agents read to decide when to use it.

dbt
object
dbt_cloud
object

Response

Ok

The SQL query that pulls data from your source to send to your destination. We send your SQL query directly to your source so any SQL that is valid for your source (including functions) is valid in Hightouch.

id
number<double>
required

The id of the model

name
string
required

The name of the model

slug
string
required

The slug of the model

description
string | null
required

The description of the model. Null when no description has been set.

workspaceId
number<double>
required

The id of the workspace where the model belongs to

primaryKey
string
required

The primary key will be null if the query doesn't get directly synced (e.g. a relationship table for visual querying)

createdAt
string<date-time>
required

The timestamp when model was created

updatedAt
string<date-time>
required

The timestamp when model was lastly updated

createdBy
object | null
required

The user who created the model, or null if no user was recorded

updatedBy
object | null
required

The user who last updated the model, or null if no user was recorded

sourceId
number<double>
required

The id of the source that model is connected to

queryType
string
required

The type of the query. Available options: custom, raw_sql, tabel, dbt and visual.

tags
object
required

The tags of the model

isSchema
boolean
required

If is_schema is true, the model is just used to build other models. Either as part of visual querying, or as the root of a visual query.

isGeneralModel
boolean
required

If is_general_model is true, the model is not synced. It exposes warehouse data to Hightouch AI agents and is managed from the schema section.

syncs
number<double>[]
required

The list of id of syncs that uses this model

lastRunSize
number<double> | null
required

The number of rows returned by the most recent successful sync run of this model. Null if the model has never been synced successfully.

visual
object

Visual query, used by audience

custom
object

Custom query for sources that doesn't support sql. For example, Airtable.

table
object

Table-based query that fetches on a table instead of SQL

dbt
object

Query that is based on a dbt model

dbt_cloud
object
raw
object

Standard raw SQL query

folderId
string
spaceId
string

The Space this audience belongs to. Applies only to workspaces with Spaces enabled; contact Hightouch to enable Spaces and to obtain Space ids. Only valid when queryType is "visual". Omitted for models that are not in a Space. An API key scoped to a Space must set it on create. Read-only after creation.

rowLevelAccessRuleIds
string[]

Row-level access rules attached to this audience. Applies only to workspaces with Spaces enabled. Only valid when queryType is "visual"; always present on an audience. When creating an audience in a Space, include one rule from each required row-level access group on the parent model. Rule ids come from the Spaces governance API. Read-only after creation.