Infer Schema From File
curl --request POST \
--url https://catalogapi.rastro.ai/api/public/infer-schema \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form 'prompt=<string>' \
--form generate_taxonomy=false \
--form max_sample_rows=20import requests
url = "https://catalogapi.rastro.ai/api/public/infer-schema"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"prompt": "<string>",
"generate_taxonomy": "false",
"max_sample_rows": "20"
}
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('prompt', '<string>');
form.append('generate_taxonomy', 'false');
form.append('max_sample_rows', '20');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://catalogapi.rastro.ai/api/public/infer-schema', 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://catalogapi.rastro.ai/api/public/infer-schema",
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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\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://catalogapi.rastro.ai/api/public/infer-schema"
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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\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://catalogapi.rastro.ai/api/public/infer-schema")
.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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://catalogapi.rastro.ai/api/public/infer-schema")
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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"file_name": "<string>",
"total_rows": 123,
"sample_rows_used": 123,
"suggested_schema": {},
"web_enrichment_fields": [
{
"name": "<string>",
"description": "<string>",
"type": "string",
"array_element_type": "<string>",
"unit": "<string>",
"enum": [
"<string>"
],
"items_enum": [
"<string>"
],
"sample_values": [
"<string>"
],
"required": true,
"merge": true,
"pattern": "<string>",
"pattern_message": "<string>",
"min_length": 123,
"max_length": 123,
"minimum": 123,
"maximum": 123,
"unique": true,
"semantic_type": "<string>"
}
],
"suggested_taxonomy": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Enrich
Infer Schema From File
Analyze an uploaded file and infer enrichment configuration.
Upload a CSV or Excel file, and get back:
- suggested_schema: JSON Schema with all fields (existing + suggested enrichments)
- web_enrichment_fields: Fields to use with /public/enrich endpoint
- suggested_taxonomy: Category hierarchy (if generate_taxonomy=true)
This endpoint helps you configure an enrichment pipeline without manual schema definition.
Example usage:
- Upload your data file with a description
- Use the returned
web_enrichment_fieldsasoutput_schemain/public/enrich - Use
suggested_taxonomywithpredict_taxonomy=truein/public/enrich
Supported file formats:
- CSV (.csv)
- Excel (.xlsx, .xls)
POST
/
public
/
infer-schema
Infer Schema From File
curl --request POST \
--url https://catalogapi.rastro.ai/api/public/infer-schema \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form 'prompt=<string>' \
--form generate_taxonomy=false \
--form max_sample_rows=20import requests
url = "https://catalogapi.rastro.ai/api/public/infer-schema"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"prompt": "<string>",
"generate_taxonomy": "false",
"max_sample_rows": "20"
}
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('prompt', '<string>');
form.append('generate_taxonomy', 'false');
form.append('max_sample_rows', '20');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://catalogapi.rastro.ai/api/public/infer-schema', 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://catalogapi.rastro.ai/api/public/infer-schema",
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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\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://catalogapi.rastro.ai/api/public/infer-schema"
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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\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://catalogapi.rastro.ai/api/public/infer-schema")
.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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://catalogapi.rastro.ai/api/public/infer-schema")
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=\"prompt\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"generate_taxonomy\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"max_sample_rows\"\r\n\r\n20\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"file_name": "<string>",
"total_rows": 123,
"sample_rows_used": 123,
"suggested_schema": {},
"web_enrichment_fields": [
{
"name": "<string>",
"description": "<string>",
"type": "string",
"array_element_type": "<string>",
"unit": "<string>",
"enum": [
"<string>"
],
"items_enum": [
"<string>"
],
"sample_values": [
"<string>"
],
"required": true,
"merge": true,
"pattern": "<string>",
"pattern_message": "<string>",
"min_length": 123,
"max_length": 123,
"minimum": 123,
"maximum": 123,
"unique": true,
"semantic_type": "<string>"
}
],
"suggested_taxonomy": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
multipart/form-data
Response
Successful Response
Response with inferred configuration for enrichment.