curl --request POST \
--url https://{instance}.omniapp.co/api/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form modelId=880e8400-e29b-41d4-a716-446655440003 \
--form branchId=990e8400-e29b-41d4-a716-446655440004 \
--form branchName=my-branch \
--form viewName=custom_view_nameimport requests
url = "https://{instance}.omniapp.co/api/v1/uploads"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"branchId": "990e8400-e29b-41d4-a716-446655440004",
"branchName": "my-branch",
"viewName": "custom_view_name"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('modelId', '880e8400-e29b-41d4-a716-446655440003');
form.append('branchId', '990e8400-e29b-41d4-a716-446655440004');
form.append('branchName', 'my-branch');
form.append('viewName', 'custom_view_name');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://{instance}.omniapp.co/api/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.omniapp.co/api/v1/uploads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{instance}.omniapp.co/api/v1/uploads"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{instance}.omniapp.co/api/v1/uploads")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.omniapp.co/api/v1/uploads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "users.csv",
"viewName": "users",
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"inDbAsTableName": "omni_upload_t550e8400",
"rowCount": 150,
"truncated": false,
"viewCreated": true
}{
"detail": "Bad Request: file must have .csv extension",
"status": 400
}{
"detail": "Unauthorized",
"status": 401
}{
"detail": "You do not have permission to perform this action",
"status": 403
}{
"detail": "Model not found",
"status": 404
}{
"error": "<response_code>",
"message": "<error_reason>"
}Upload a CSV file
To use this endpoint:
- The Upload data setting in Settings > Content permissions must enabled by an Organization Admin
- The authenticating user must have Restricted Querier permissions or higher on the model the file will be uploaded to
Upload a CSV file to create a new data input table. The file is parsed, converted to Arrow format, uploaded to storage, written to the connection’s table upload (scratch) schema, and a view is created in the specified model.
Uploaded files:
- Must be a CSV file with
.csvextension - Can have a maximum of 500,000 rows. Files will be truncated if this limit is exceeded.
curl --request POST \
--url https://{instance}.omniapp.co/api/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form modelId=880e8400-e29b-41d4-a716-446655440003 \
--form branchId=990e8400-e29b-41d4-a716-446655440004 \
--form branchName=my-branch \
--form viewName=custom_view_nameimport requests
url = "https://{instance}.omniapp.co/api/v1/uploads"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"branchId": "990e8400-e29b-41d4-a716-446655440004",
"branchName": "my-branch",
"viewName": "custom_view_name"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('modelId', '880e8400-e29b-41d4-a716-446655440003');
form.append('branchId', '990e8400-e29b-41d4-a716-446655440004');
form.append('branchName', 'my-branch');
form.append('viewName', 'custom_view_name');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://{instance}.omniapp.co/api/v1/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.omniapp.co/api/v1/uploads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{instance}.omniapp.co/api/v1/uploads"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{instance}.omniapp.co/api/v1/uploads")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.omniapp.co/api/v1/uploads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modelId\"\r\n\r\n880e8400-e29b-41d4-a716-446655440003\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchId\"\r\n\r\n990e8400-e29b-41d4-a716-446655440004\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"branchName\"\r\n\r\nmy-branch\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"viewName\"\r\n\r\ncustom_view_name\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"fileName": "users.csv",
"viewName": "users",
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"inDbAsTableName": "omni_upload_t550e8400",
"rowCount": 150,
"truncated": false,
"viewCreated": true
}{
"detail": "Bad Request: file must have .csv extension",
"status": 400
}{
"detail": "Unauthorized",
"status": 401
}{
"detail": "You do not have permission to perform this action",
"status": 403
}{
"detail": "Model not found",
"status": 404
}{
"error": "<response_code>",
"message": "<error_reason>"
}Authorizations
Can be either an Organization API Key or Personal Access Token (PAT).
Include in the Authorization header as: Bearer YOUR_TOKEN
Body
The CSV file to upload, which must have a .csv extension
UUID of the model to create the view in
"880e8400-e29b-41d4-a716-446655440003"
UUID of the branch to create the view in. Mutually exclusive with branchName.
"990e8400-e29b-41d4-a716-446655440004"
Name of the branch to create the view in. Mutually exclusive with branchId.
"my-branch"
Override the view name. Defaults to sanitized file name.
"custom_view_name"
Response
CSV file uploaded successfully and view created.
Unique identifier for the upload
Original file name
Name of the view created
ID of the model the view was created in
Database table name in the scratch schema
Number of rows in the uploaded file
Whether the file was truncated due to row limit (500,000 rows)
Whether a view was created in the model
Was this page helpful?

