Skip to main content
POST
/
projects
/
{project_name}
/
tables
/
{table_id}
/
files
Upload a new file into a table
curl --request POST \
  --url https://api.cloudsquid.io/api/projects/{project_name}/tables/{table_id}/files \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "filename": "<string>",
  "file": "<string>"
}
'
import requests

url = "https://api.cloudsquid.io/api/projects/{project_name}/tables/{table_id}/files"

payload = {
"filename": "<string>",
"file": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({filename: '<string>', file: '<string>'})
};

fetch('https://api.cloudsquid.io/api/projects/{project_name}/tables/{table_id}/files', 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://api.cloudsquid.io/api/projects/{project_name}/tables/{table_id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filename' => '<string>',
'file' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$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://api.cloudsquid.io/api/projects/{project_name}/tables/{table_id}/files"

payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.cloudsquid.io/api/projects/{project_name}/tables/{table_id}/files")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.cloudsquid.io/api/projects/{project_name}/tables/{table_id}/files")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "row_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
{
"errorMessage": "<string>"
}
{
"errorMessage": "<string>"
}
This is step 1 of 3 in the async run pattern. After uploading, use the returned row_id to start a run, then poll for results.For a single blocking call that handles everything, see synchronous extraction.

What this does

Creates a row in the extraction table linked to the uploaded file, but does not start processing. The returned row_id is required for all subsequent operations on this file.

Example

cURL
curl -X POST \
  "https://api.cloudsquid.io/api/projects/my-project/tables/TABLE_ID/files" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file": "'$(base64 -i invoice.pdf)'",
    "filename": "invoice.pdf",
    "mimetype": "application/pdf",
    "file_type": "binary"
  }'
Response:
{ "row_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }
Pass this row_id to POST /run to start extraction.

Authorizations

X-API-Key
string
header
required

Path Parameters

project_name
string
required

The name of the project

table_id
string<uuid>
required

The ID of the table

Body

application/json
mimetype
enum<string>
required

the mimetype of the document being uploaded

Available options:
application/pdf,
application/json,
image/jpg,
image/jpeg,
image/png,
text/csv,
text/plain,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
application/vnd.ms-excel,
video/mp4,
audio/mp3,
audio/wav,
audio/ogg,
multipart/related,
message/rfc822
filename
string
required

the name of the file being uploaded

file_type
enum<string>
required

Indicates whether the file is a binary upload or a signed link to the document.

Available options:
uri,
binary,
multipart
file
required

A signed URL to the file.

Response

Created extraction job for the uploaded file

row_id
string<uuid>
required

the extraction row created for the uploaded file