tanqoryExtCustomersImport
- Mutation
- Customers and B2B
Imports rows of a customer CSV. A row matches an existing customer of the store by its email (case-insensitive), else by its phone (in the store's country format). A row with no match creates a customer (with the row's default address); a match is updated from the row (its default address updated, or created when it has none) when overwrite is true, and skipped when it is false. Each row is saved on its own: a row that fails does not stop the others. At most 250 rows per call (userError on rows otherwise).
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
overwrite | Boolean! | Required | |
rows | [TanqoryExtCustomerImportRowInput!]! | Required |
Returns
TanqoryExtCustomersImportPayload Return type for tanqoryExtCustomersImport.
| Field | Type | Description |
|---|---|---|
results | [TanqoryExtCustomerImportRowResult!] | One result per row; null when the call itself was refused (see userErrors). |
userErrors | [UserError!]! |
Example request
A starting point: required arguments as variables and a few fields of the result. Replace the placeholders.
Set STORE_ID and TANQORY_ACCESS_TOKEN in your environment first (Make your first API call).
curl -X POST "https://api.tanqory.com/admin/2026-10/stores/$STORE_ID/graphql" \
-H "Authorization: Bearer $TANQORY_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data '{"query":"mutation TanqoryExtCustomersImport($overwrite: Boolean!, $rows: [TanqoryExtCustomerImportRowInput!]!) {\n tanqoryExtCustomersImport(overwrite: $overwrite, rows: $rows) {\n userErrors {\n field\n message\n }\n }\n}","variables":{"overwrite":false,"rows":[]}}'// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `mutation TanqoryExtCustomersImport(\$overwrite: Boolean!, \$rows: [TanqoryExtCustomerImportRowInput!]!) {
tanqoryExtCustomersImport(overwrite: \$overwrite, rows: \$rows) {
userErrors {
field
message
}
}
}`;
const variables = {
"overwrite": false,
"rows": []
};
const res = await fetch(`https://api.tanqory.com/admin/2026-10/stores/${process.env.STORE_ID}/graphql`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.TANQORY_ACCESS_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
});
console.log(res.status, JSON.stringify(await res.json(), null, 2));# Python 3, standard library only. Save as request.py and run: python3 request.py
import json, os, urllib.request
query = """mutation TanqoryExtCustomersImport($overwrite: Boolean!, $rows: [TanqoryExtCustomerImportRowInput!]!) {
tanqoryExtCustomersImport(overwrite: $overwrite, rows: $rows) {
userErrors {
field
message
}
}
}"""
variables = json.loads("""{
"overwrite": false,
"rows": []
}""")
req = urllib.request.Request(
"https://api.tanqory.com/admin/2026-10/stores/" + os.environ["STORE_ID"] + "/graphql",
data=json.dumps({"query": query, "variables": variables}).encode(),
headers={
"Authorization": "Bearer " + os.environ["TANQORY_ACCESS_TOKEN"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.status, json.dumps(json.load(res), indent=2))