tanqoryExtPurchaseOrderFilesAdd
- Mutation
- Inventory and fulfillment
Attaches files to a purchase order (the supplier's invoice: a scan or a PDF), in any status. Each is a staged upload of this store (stagedUploadsCreate, resource FILE or IMAGE: PUT the bytes, then pass the target's key parameter as stagedUploadPath). Before anything is kept: at most 10 files on the purchase order (TOO_MANY_FILES), the upload must exist (FILE_NOT_FOUND), at most 20 MB (FILE_TOO_LARGE), the malware scan (MALWARE_DETECTED, MALWARE_SCAN_UNAVAILABLE), a PDF, JPEG, PNG, WebP or HEIC by its bytes (FILE_TYPE_UNSUPPORTED), metadata removed (a photo's location and camera; a PDF's author, annotations and attachments; FILE_UNREADABLE when that cannot be done, e.g. an encrypted PDF). The files are private: never in Files and never on the media CDN; url is a signed link.
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
files | [TanqoryExtPurchaseOrderFileInput!]! | Required | |
id | ID! | Required |
Returns
TanqoryExtPurchaseOrderPayload
| Field | Type | Description |
|---|---|---|
purchaseOrder | InventoryPurchaseOrder | |
userErrors | [TanqoryExtPurchaseOrderUserError!]! |
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 TanqoryExtPurchaseOrderFilesAdd($files: [TanqoryExtPurchaseOrderFileInput!]!, $id: ID!) {\n tanqoryExtPurchaseOrderFilesAdd(files: $files, id: $id) {\n purchaseOrder { id }\n userErrors {\n code\n field\n message\n }\n }\n}","variables":{"files":[],"id":"gid://tanqory/Type/id"}}'// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `mutation TanqoryExtPurchaseOrderFilesAdd(\$files: [TanqoryExtPurchaseOrderFileInput!]!, \$id: ID!) {
tanqoryExtPurchaseOrderFilesAdd(files: \$files, id: \$id) {
purchaseOrder { id }
userErrors {
code
field
message
}
}
}`;
const variables = {
"files": [],
"id": "gid://tanqory/Type/id"
};
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 TanqoryExtPurchaseOrderFilesAdd($files: [TanqoryExtPurchaseOrderFileInput!]!, $id: ID!) {
tanqoryExtPurchaseOrderFilesAdd(files: $files, id: $id) {
purchaseOrder { id }
userErrors {
code
field
message
}
}
}"""
variables = json.loads("""{
"files": [],
"id": "gid://tanqory/Type/id"
}""")
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))