Skip to main content
POST
Upload a CSV file

Authorizations

Authorization
string
header
required

Can be either an Organization API Key or Personal Access Token (PAT).

Include in the Authorization header as: Bearer YOUR_TOKEN

Body

multipart/form-data
file
file
required

The CSV file to upload, which must have a .csv extension

modelId
string<uuid>
required

UUID of the model to create the view in

Example:

"880e8400-e29b-41d4-a716-446655440003"

branchId
string<uuid>

UUID of the branch to create the view in. Mutually exclusive with branchName.

Example:

"990e8400-e29b-41d4-a716-446655440004"

branchName
string

Name of the branch to create the view in. Mutually exclusive with branchId.

Example:

"my-branch"

viewName
string

Override the view name. Defaults to sanitized file name, suffixed with _2, _3, and so on if the model already has a view by that name.

Example:

"custom_view_name"

keyColumns
string

Supported for Postgres, Snowflake, Databricks, Lakebase, BigQuery, Redshift, SQL Server, Fabric, and MotherDuck connections.

The column(s) that uniquely identify a row, as a JSON array of column names (["id"]) or a comma-separated list (id,region). null or an empty value means the upload doesn't have a key. If a key is set, every row must have a value for each key column.

The key becomes the view's primary key, recorded under the column names as your warehouse stores them.

See Setting keys for more information, including how to write to the table in apps.

Response

CSV file uploaded successfully and view created.

id
string<uuid>
required

Unique identifier for the upload

fileName
string
required

Original file name

viewName
string
required

Name of the view created. May differ from the requested or derived name if that name was already taken.

modelId
string<uuid>
required

ID of the model the view was created in

inDbAsTableName
string
required

Database table name in the scratch schema

keyColumns
string[] | null
required

The key recorded on the upload, under the column names as your warehouse stores them, or null if the upload doesn't have a key.

rowCount
integer
required

Number of rows in the uploaded file

truncated
boolean
required

Whether the file was truncated due to row limit (500,000 rows)

viewCreated
boolean
required

Whether a view was created in the model