Create a new headless import
Starts a headless import from an uploaded file or data payload using a saved or inline schema.
curl --request POST \
--url https://app.dromo.io/api/v1/headless/imports/ \
--header 'Content-Type: application/json' \
--header 'X-Dromo-License-Key: <api-key>' \
--data '
{
"fields": [
{
"key": "first_name",
"type": "string",
"label": "First Name",
"validators": []
},
{
"key": "last_name",
"type": "string",
"label": "Last Name",
"validators": []
}
],
"initial_data": [
{
"first_name": "Zeph",
"last_name": "paul.zeph@gmail.com"
}
],
"hooks": {
"rowHooks": [
"(record, mode) => { return { row: { first_name: { value: \"Updated from row hook\" } } }; }"
]
}
}
'import requests
url = "https://app.dromo.io/api/v1/headless/imports/"
payload = {
"fields": [
{
"key": "first_name",
"type": "string",
"label": "First Name",
"validators": []
},
{
"key": "last_name",
"type": "string",
"label": "Last Name",
"validators": []
}
],
"initial_data": [
{
"first_name": "Zeph",
"last_name": "paul.zeph@gmail.com"
}
],
"hooks": { "rowHooks": ["(record, mode) => { return { row: { first_name: { value: \"Updated from row hook\" } } }; }"] }
}
headers = {
"X-Dromo-License-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Dromo-License-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: [
{key: 'first_name', type: 'string', label: 'First Name', validators: []},
{key: 'last_name', type: 'string', label: 'Last Name', validators: []}
],
initial_data: [{first_name: 'Zeph', last_name: 'paul.zeph@gmail.com'}],
hooks: {
rowHooks: [
'(record, mode) => { return { row: { first_name: { value: "Updated from row hook" } } }; }'
]
}
})
};
fetch('https://app.dromo.io/api/v1/headless/imports/', 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://app.dromo.io/api/v1/headless/imports/",
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([
'fields' => [
[
'key' => 'first_name',
'type' => 'string',
'label' => 'First Name',
'validators' => [
]
],
[
'key' => 'last_name',
'type' => 'string',
'label' => 'Last Name',
'validators' => [
]
]
],
'initial_data' => [
[
'first_name' => 'Zeph',
'last_name' => 'paul.zeph@gmail.com'
]
],
'hooks' => [
'rowHooks' => [
'(record, mode) => { return { row: { first_name: { value: "Updated from row hook" } } }; }'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Dromo-License-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://app.dromo.io/api/v1/headless/imports/"
payload := strings.NewReader("{\n \"fields\": [\n {\n \"key\": \"first_name\",\n \"type\": \"string\",\n \"label\": \"First Name\",\n \"validators\": []\n },\n {\n \"key\": \"last_name\",\n \"type\": \"string\",\n \"label\": \"Last Name\",\n \"validators\": []\n }\n ],\n \"initial_data\": [\n {\n \"first_name\": \"Zeph\",\n \"last_name\": \"paul.zeph@gmail.com\"\n }\n ],\n \"hooks\": {\n \"rowHooks\": [\n \"(record, mode) => { return { row: { first_name: { value: \\\"Updated from row hook\\\" } } }; }\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Dromo-License-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://app.dromo.io/api/v1/headless/imports/")
.header("X-Dromo-License-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": [\n {\n \"key\": \"first_name\",\n \"type\": \"string\",\n \"label\": \"First Name\",\n \"validators\": []\n },\n {\n \"key\": \"last_name\",\n \"type\": \"string\",\n \"label\": \"Last Name\",\n \"validators\": []\n }\n ],\n \"initial_data\": [\n {\n \"first_name\": \"Zeph\",\n \"last_name\": \"paul.zeph@gmail.com\"\n }\n ],\n \"hooks\": {\n \"rowHooks\": [\n \"(record, mode) => { return { row: { first_name: { value: \\\"Updated from row hook\\\" } } }; }\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dromo.io/api/v1/headless/imports/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Dromo-License-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": [\n {\n \"key\": \"first_name\",\n \"type\": \"string\",\n \"label\": \"First Name\",\n \"validators\": []\n },\n {\n \"key\": \"last_name\",\n \"type\": \"string\",\n \"label\": \"Last Name\",\n \"validators\": []\n }\n ],\n \"initial_data\": [\n {\n \"first_name\": \"Zeph\",\n \"last_name\": \"paul.zeph@gmail.com\"\n }\n ],\n \"hooks\": {\n \"rowHooks\": [\n \"(record, mode) => { return { row: { first_name: { value: \\\"Updated from row hook\\\" } } }; }\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "94187d21-9820-420f-b08c-a80cbbf52604",
"schema_id": "94187d21-9820-420f-b08c-a80cbbf52604",
"status": "AWAITING_UPLOAD",
"original_filename": "user_data.csv",
"created_date": "2023-11-07T05:31:56Z",
"modified_date": "2023-11-07T05:31:56Z",
"upload": "https://dromo-headless-imports-prod.s3.us-west-2.amazonaws.com/test-key-123?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20230227%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230227T160315Z&X-Amz-Expires=1800&X-Amz-SignedHeaders=host&X-Amz-Signature=example1234567890abcdef1234567890abcdef1234567890abcdef12345678",
"review_url": "https://app.dromo.io/headless/94187d21-9820-420f-b08c-a80cbbf52604/",
"result_metadata": null,
"import_errors": null
}Authorizations
This backend API key is different than your frontend license key. Please use the "Backend" license key from your Dromo Dashboard.
Body
ID of a saved schema. Mutually exclusive with fields — provide schema_id or fields, not both. When provided alongside settings or hooks, those values are merged on top of the saved schema for this import only.
"94187d21-9820-420f-b08c-a80cbbf52604"
Inline schema field definitions. Required when schema_id is omitted; mutually exclusive with schema_id. Accepts the same field definitions as a saved schema.
Show child attributes
Show child attributes
[
{
"key": "first_name",
"type": "string",
"label": "First Name",
"validators": []
},
{
"key": "last_name",
"type": "string",
"label": "Last Name",
"validators": []
}
]
Import settings. When used with schema_id, merged on top of the saved schema (provided keys overwrite; omitted keys are unchanged). When used without schema_id, defines settings for the inline schema.
Show child attributes
Show child attributes
{
"importIdentifier": "contacts-import",
"invalidDataBehavior": "BLOCK_SUBMIT"
}
Import hooks. When used with schema_id, merged on top of the saved schema. When used without schema_id, defines hooks for the inline schema.
Show child attributes
Show child attributes
{
"rowHooks": [
"(record, mode) => { return { row: { first_name: { value: \"Updated from row hook\" } } }; }"
]
}
Name of the file being imported (exclude if using initial_data)
"user.csv"
Complete JSON data to be imported, max size 15MB (exclude if using a file)
[
{
"first_name": "Zeph",
"last_name": "paul.zeph@gmail.com"
}
]
Show child attributes
Show child attributes
{
"user": {
"id": "jeff_id",
"name": "Jeff",
"email": "jeff@dromo.io",
"companyName": "Dromo",
"companyId": "dromo_id"
}
}
Response
Import successfully initialized
"94187d21-9820-420f-b08c-a80cbbf52604"
"94187d21-9820-420f-b08c-a80cbbf52604"
AWAITING_UPLOAD, RUNNING, SUCCESSFUL, FAILED, NEEDS_REVIEW "AWAITING_UPLOAD"
"user_data.csv"
"https://dromo-headless-imports-prod.s3.us-west-2.amazonaws.com/test-key-123?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20230227%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230227T160315Z&X-Amz-Expires=1800&X-Amz-SignedHeaders=host&X-Amz-Signature=example1234567890abcdef1234567890abcdef1234567890abcdef12345678"
"https://app.dromo.io/headless/94187d21-9820-420f-b08c-a80cbbf52604/"
null
null
curl --request POST \
--url https://app.dromo.io/api/v1/headless/imports/ \
--header 'Content-Type: application/json' \
--header 'X-Dromo-License-Key: <api-key>' \
--data '
{
"fields": [
{
"key": "first_name",
"type": "string",
"label": "First Name",
"validators": []
},
{
"key": "last_name",
"type": "string",
"label": "Last Name",
"validators": []
}
],
"initial_data": [
{
"first_name": "Zeph",
"last_name": "paul.zeph@gmail.com"
}
],
"hooks": {
"rowHooks": [
"(record, mode) => { return { row: { first_name: { value: \"Updated from row hook\" } } }; }"
]
}
}
'import requests
url = "https://app.dromo.io/api/v1/headless/imports/"
payload = {
"fields": [
{
"key": "first_name",
"type": "string",
"label": "First Name",
"validators": []
},
{
"key": "last_name",
"type": "string",
"label": "Last Name",
"validators": []
}
],
"initial_data": [
{
"first_name": "Zeph",
"last_name": "paul.zeph@gmail.com"
}
],
"hooks": { "rowHooks": ["(record, mode) => { return { row: { first_name: { value: \"Updated from row hook\" } } }; }"] }
}
headers = {
"X-Dromo-License-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Dromo-License-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: [
{key: 'first_name', type: 'string', label: 'First Name', validators: []},
{key: 'last_name', type: 'string', label: 'Last Name', validators: []}
],
initial_data: [{first_name: 'Zeph', last_name: 'paul.zeph@gmail.com'}],
hooks: {
rowHooks: [
'(record, mode) => { return { row: { first_name: { value: "Updated from row hook" } } }; }'
]
}
})
};
fetch('https://app.dromo.io/api/v1/headless/imports/', 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://app.dromo.io/api/v1/headless/imports/",
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([
'fields' => [
[
'key' => 'first_name',
'type' => 'string',
'label' => 'First Name',
'validators' => [
]
],
[
'key' => 'last_name',
'type' => 'string',
'label' => 'Last Name',
'validators' => [
]
]
],
'initial_data' => [
[
'first_name' => 'Zeph',
'last_name' => 'paul.zeph@gmail.com'
]
],
'hooks' => [
'rowHooks' => [
'(record, mode) => { return { row: { first_name: { value: "Updated from row hook" } } }; }'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Dromo-License-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://app.dromo.io/api/v1/headless/imports/"
payload := strings.NewReader("{\n \"fields\": [\n {\n \"key\": \"first_name\",\n \"type\": \"string\",\n \"label\": \"First Name\",\n \"validators\": []\n },\n {\n \"key\": \"last_name\",\n \"type\": \"string\",\n \"label\": \"Last Name\",\n \"validators\": []\n }\n ],\n \"initial_data\": [\n {\n \"first_name\": \"Zeph\",\n \"last_name\": \"paul.zeph@gmail.com\"\n }\n ],\n \"hooks\": {\n \"rowHooks\": [\n \"(record, mode) => { return { row: { first_name: { value: \\\"Updated from row hook\\\" } } }; }\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Dromo-License-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://app.dromo.io/api/v1/headless/imports/")
.header("X-Dromo-License-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": [\n {\n \"key\": \"first_name\",\n \"type\": \"string\",\n \"label\": \"First Name\",\n \"validators\": []\n },\n {\n \"key\": \"last_name\",\n \"type\": \"string\",\n \"label\": \"Last Name\",\n \"validators\": []\n }\n ],\n \"initial_data\": [\n {\n \"first_name\": \"Zeph\",\n \"last_name\": \"paul.zeph@gmail.com\"\n }\n ],\n \"hooks\": {\n \"rowHooks\": [\n \"(record, mode) => { return { row: { first_name: { value: \\\"Updated from row hook\\\" } } }; }\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dromo.io/api/v1/headless/imports/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Dromo-License-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": [\n {\n \"key\": \"first_name\",\n \"type\": \"string\",\n \"label\": \"First Name\",\n \"validators\": []\n },\n {\n \"key\": \"last_name\",\n \"type\": \"string\",\n \"label\": \"Last Name\",\n \"validators\": []\n }\n ],\n \"initial_data\": [\n {\n \"first_name\": \"Zeph\",\n \"last_name\": \"paul.zeph@gmail.com\"\n }\n ],\n \"hooks\": {\n \"rowHooks\": [\n \"(record, mode) => { return { row: { first_name: { value: \\\"Updated from row hook\\\" } } }; }\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "94187d21-9820-420f-b08c-a80cbbf52604",
"schema_id": "94187d21-9820-420f-b08c-a80cbbf52604",
"status": "AWAITING_UPLOAD",
"original_filename": "user_data.csv",
"created_date": "2023-11-07T05:31:56Z",
"modified_date": "2023-11-07T05:31:56Z",
"upload": "https://dromo-headless-imports-prod.s3.us-west-2.amazonaws.com/test-key-123?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20230227%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230227T160315Z&X-Amz-Expires=1800&X-Amz-SignedHeaders=host&X-Amz-Signature=example1234567890abcdef1234567890abcdef1234567890abcdef12345678",
"review_url": "https://app.dromo.io/headless/94187d21-9820-420f-b08c-a80cbbf52604/",
"result_metadata": null,
"import_errors": null
}