curl --request POST \
--url https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriber_group_id": "01234567-89ab-cdef-0123-456789abcdef",
"file_name": "contacts.csv",
"consent_confirmed": true
}
'import requests
url = "https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url"
payload = {
"subscriber_group_id": "01234567-89ab-cdef-0123-456789abcdef",
"file_name": "contacts.csv",
"consent_confirmed": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriber_group_id: '01234567-89ab-cdef-0123-456789abcdef',
file_name: 'contacts.csv',
consent_confirmed: true
})
};
fetch('https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscriber_group_id\": \"01234567-89ab-cdef-0123-456789abcdef\",\n \"file_name\": \"contacts.csv\",\n \"consent_confirmed\": true\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url",
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([
'subscriber_group_id' => '01234567-89ab-cdef-0123-456789abcdef',
'file_name' => 'contacts.csv',
'consent_confirmed' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url"
payload := strings.NewReader("{\n \"subscriber_group_id\": \"01234567-89ab-cdef-0123-456789abcdef\",\n \"file_name\": \"contacts.csv\",\n \"consent_confirmed\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"upload_url": "https://uploads.example.com/subscriber-imports/contacts.csv?signature=abc123",
"content_type": "text/csv",
"file_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"statusCode": 400,
"error": "Bad Request",
"message": "limit: must be at most 50",
"code": "VALIDATION_ERROR"
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Missing Authorization header"
}{
"statusCode": 402,
"error": "Payment Required",
"message": "Workspace does not have an active paid plan"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Workspace suspended due to a high bounce or spam complaint rate. Please contact support.",
"code": "WORKSPACE_SUSPENDED"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Not found",
"code": "NOT_FOUND"
}{
"statusCode": 408,
"error": "Request Timeout",
"message": "An internal error occurred"
}{
"statusCode": 409,
"error": "Conflict",
"message": "The resource has changed. Reload it and try again.",
"code": "CONFLICT"
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Rate limit exceeded"
}{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal error occurred"
}Get a CSV upload URL
Starts a CSV import into a subscriber group. (1) Call this endpoint. (2) PUT your file to upload_url with content_type as the Content-Type header, within 5 minutes. (3) To track the import, list the group’s imports and match file_id: the import appears only after the upload is processed, and one upload can produce more than one import with that file_id (take the newest). Emails already in the group are skipped, not updated.
The file is a CSV with a header row, up to 500 MB and 5,000,000 rows; a larger file fails to import. Headers are matched without regard to case: an email column is required (email, email_address, emailaddress, e-mail or mail); first and last name columns are optional (for example first_name, firstname, last_name, surname). An optional status column (for example is_subscribed, subscribed, subscription, accepts_marketing, opt_in, consent) keeps a row subscribed only when it is empty or one of true, 1, yes, y, subscribed, active, opt-in, optin or consent; any other value imports the row as unsubscribed. With no status header, a column whose first rows contain “yes” is read as the status column. Other columns are stored on the subscriber as metadata.
Requires one of the following scopes: email_marketing_subscriber_group_imports:create, email_marketing_subscriber_group_imports:all, all:create, all:all
curl --request POST \
--url https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriber_group_id": "01234567-89ab-cdef-0123-456789abcdef",
"file_name": "contacts.csv",
"consent_confirmed": true
}
'import requests
url = "https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url"
payload = {
"subscriber_group_id": "01234567-89ab-cdef-0123-456789abcdef",
"file_name": "contacts.csv",
"consent_confirmed": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriber_group_id: '01234567-89ab-cdef-0123-456789abcdef',
file_name: 'contacts.csv',
consent_confirmed: true
})
};
fetch('https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscriber_group_id\": \"01234567-89ab-cdef-0123-456789abcdef\",\n \"file_name\": \"contacts.csv\",\n \"consent_confirmed\": true\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url",
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([
'subscriber_group_id' => '01234567-89ab-cdef-0123-456789abcdef',
'file_name' => 'contacts.csv',
'consent_confirmed' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.instantly.ai/api/v2/email-marketing/subscriber-group-imports/upload-url"
payload := strings.NewReader("{\n \"subscriber_group_id\": \"01234567-89ab-cdef-0123-456789abcdef\",\n \"file_name\": \"contacts.csv\",\n \"consent_confirmed\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"upload_url": "https://uploads.example.com/subscriber-imports/contacts.csv?signature=abc123",
"content_type": "text/csv",
"file_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"statusCode": 400,
"error": "Bad Request",
"message": "limit: must be at most 50",
"code": "VALIDATION_ERROR"
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Missing Authorization header"
}{
"statusCode": 402,
"error": "Payment Required",
"message": "Workspace does not have an active paid plan"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Workspace suspended due to a high bounce or spam complaint rate. Please contact support.",
"code": "WORKSPACE_SUSPENDED"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Not found",
"code": "NOT_FOUND"
}{
"statusCode": 408,
"error": "Request Timeout",
"message": "An internal error occurred"
}{
"statusCode": 409,
"error": "Conflict",
"message": "The resource has changed. Reload it and try again.",
"code": "CONFLICT"
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Rate limit exceeded"
}{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal error occurred"
}Authorizations
Body
Response
The URL to upload the CSV file to