List imports

Returns the org's imports, newest first, each with its report.

GET /v1/marketing/imports

Addresshttps://api.hanzo.ai/v1/marketing/imports
MethodGET
Operationget_marketing_imports
AuthAuthorization: Bearer $HANZO_API_KEY

Returns the org's imports, newest first, each with its report.

Request

2 fields.

FieldInTypeRequiredDescription
listquerystring—List keeps one list's imports, by id or slug.
limitqueryinteger—Limit is the page size, 50 by default and at most 200.

Response

StatusBodyMeaning
200marketing.ImportPageok
defaultproblem-detailsrefused

200 body — 60 fields.

FieldInTypeAlwaysDescription
databodymarketing.Import[]—Data is the page.
data[].bybodystring—By is who created it.
data[].createdAtbodyinteger (int64)—CreatedAt, UpdatedAt and FinishedAt are unix seconds.
data[].errorbodystring—Error is why a failed import stopped.
data[].finishedAtbodyinteger (int64)—FinishedAt is when it ended; 0 while it runs.
data[].idbodystring—ID is the import's id ("imp_" and 96 random bits in hex): the batch every subscriber it adds records as its source ref.
data[].listbodystring—List is the list it fills.
data[].optionsbodymarketing.ImportOptions—
data[].options.basisbodystring—Basis is the consent basis recorded for every row: explicit, legitimate_interest or unverified (the default).
data[].options.dryRunbodyboolean—DryRun reads and judges every row and writes nothing.
data[].options.formatbodystring—Format is csv or json; ignored for a source.
data[].options.frombodystring—From is a source to read instead of a file, as the host offers them: commerce (the org's commerce form subscribers) or crm (the confirmations the retired newsletter filed in the org's CRM).
data[].options.keybodystring—Key makes creating the import idempotent: a second create with the same key answers the first import.
data[].options.mapbodymarketing.Mapping—
data[].options.map.consentAtbodystring—ConsentAt is a column holding when the person subscribed.
data[].options.map.emailbodystring—Email is the column holding the address.
data[].options.map.fieldsbodyobject—Fields maps a custom field key to the column holding it.
data[].options.map.fields.*bodystring—
data[].options.map.firstbodystring—First and Last are columns holding the name in two parts.
data[].options.map.languagebodystring—Language is a column holding a language or locale.
data[].options.map.lastbodystring—Last is the family name's column.
data[].options.map.namebodystring—Name is a column holding the whole name.
data[].options.map.statusbodystring—Status is a column holding a status from another provider (subscribed, unsubscribed, cleaned, bounced, complained and their usual spellings).
data[].options.map.tagsbodystring—Tags is a column of tags separated by commas or semicolons.
data[].options.namebodystring—Name is the file's name, for the record.
data[].options.sizebodyinteger (int64)—Size is the file's size in bytes, when known; the upload is refused past it.
data[].options.statusbodystring—Status is what a new row becomes: subscribed (the default), unsubscribed, bounced, complained or cleaned, as an export from another provider records.
data[].options.tagsbodystring[]—Tags are put on every row the import writes.
data[].options.verifybodyboolean—Verify checks each address deliverable before writing it.
data[].parsedbodyinteger (int64)—Parsed is how many bytes of the file the worker has read and judged.
data[].receivedbodyinteger (int64)—Received is how many bytes of the file have arrived; the next piece starts here.
data[].reportbodymarketing.Report—
data[].report.basesbodyobject—Bases count the rows written by the consent basis recorded for them.
data[].report.bases.*bodyinteger (int64)—
data[].report.columnsbodystring[]—Columns are the file's columns, as its header named them.
data[].report.importedbodyinteger (int64)—Imported is how many rows became new subscribers.
data[].report.invalidbodyinteger (int64)—Invalid is how many could not be read as an address, for the reasons in Reasons.
data[].report.mapbodymarketing.Mapping—
data[].report.map.consentAtbodystring—ConsentAt is a column holding when the person subscribed.
data[].report.map.emailbodystring—Email is the column holding the address.
data[].report.map.fieldsbodyobject—Fields maps a custom field key to the column holding it.
data[].report.map.fields.*bodystring—
data[].report.map.firstbodystring—First and Last are columns holding the name in two parts.
data[].report.map.languagebodystring—Language is a column holding a language or locale.
data[].report.map.lastbodystring—Last is the family name's column.
data[].report.map.namebodystring—Name is a column holding the whole name.
data[].report.map.statusbodystring—Status is a column holding a status from another provider (subscribed, unsubscribed, cleaned, bounced, complained and their usual spellings).
data[].report.map.tagsbodystring—Tags is a column of tags separated by commas or semicolons.
data[].report.reasonsbodyobject—Reasons count the skipped and invalid rows by why.
data[].report.reasons.*bodyinteger (int64)—
data[].report.rowsbodyinteger (int64)—Rows is how many rows were read.
data[].report.samplesbodymarketing.Sample[]—Samples are the first rejected rows: their row number and the reason.
data[].report.samples[].reasonbodystring—Reason is why it was rejected.
data[].report.samples[].rowbodyinteger (int64)—Row is the row's number in the file, the header not counted.
data[].report.skippedbodyinteger (int64)—Skipped is how many were left as they were, for the reasons in Reasons.
data[].report.statusesbodyobject—Statuses count the rows written by the status they were written with.
data[].report.statuses.*bodyinteger (int64)—
data[].report.updatedbodyinteger (int64)—Updated is how many were already on the list and gained a name, tags or fields, or a status that leaves the list.
data[].statebodystring—State is receiving (waiting for its bytes), queued, processing, done, failed or cancelled.
data[].updatedAtbodyinteger (int64)—UpdatedAt is the last progress.

Failure carries the platform error shape — see Errors.

Examples

hanzo marketing imports list
import { Configuration, MarketingApi } from 'hanzoai';

const api = new MarketingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getMarketingImports();
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import MarketingApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = MarketingApi(client).get_marketing_imports()
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MarketingAPI.GetMarketingImports(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, marketing_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = marketing_api::get_marketing_imports(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.MarketingApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new MarketingApi(client).getMarketingImports();

The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →

curl https://api.hanzo.ai/v1/marketing/imports \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches marketing through the marketing tool, which names its 82 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_marketing_audiences"
         }
       }
     }'

Marketing API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.