Cookbook
Sample operations for inventory sync, order sync and webhooks with the Admin API. The sync recipes send only a restricted key in District-Client-Authorization with no Authorization header; see Authentication. Run each one with the credentials that it names, or open it in the explorer to change it.
The publishable key stays in this browser. The access token stays in the memory of this tab, and a reload clears it. They go only to admin.api.district.net, in the District-Client-Authorization and Authorization headers.
List your listings, page by page
List listings updated since a timestamp, oldest change first. Send pageInfo.endCursor as after for the next page.
query ListListings($updatedSince: DateTime, $after: String) {
products(
first: 50
after: $after
includeDeleted: true
where: {updatedAt: {from: $updatedSince}}
sort: {field: UPDATED_AT, direction: ASC}
) {
edges {
node {
id
title
lifecycle
visibility
updatedAt
variants(first: 20) {
edges {
node {
id
title
sku
price {
amount
currencyCode
}
availableQuantity
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}{
"updatedSince": "2026-11-01T00:00:00Z"
}Create a listing
Create a fixed-price listing with one variant and flat-rate US shipping. Reuse idempotencyKey on retries.
mutation CreateListing($input: CreateProductInput!) {
createProduct(input: $input) {
__typename
... on CreateProductSuccess {
product {
id
title
visibility
variants(first: 10) {
edges {
node {
id
sku
price {
amount
currencyCode
}
availableQuantity
}
}
}
}
}
... on ProductValidationError {
message
issues {
field
code
message
}
}
... on Error {
message
}
}
}{
"input": {
"idempotencyKey": "sync-create-sku-001",
"title": "1993 holographic trading card",
"description": "Near mint condition, sleeved.",
"saleMode": {
"buyNow": {
"offersEnabled": false
}
},
"visibility": "PUBLIC",
"variants": [
{
"sku": "CARD-1993-001",
"price": {
"amount": "24.99",
"currencyCode": "USD"
},
"availableQuantity": 3
}
],
"shipping": {
"custom": {
"settings": [
{
"country": "US",
"type": "FIXED",
"price": {
"amount": "5.00",
"currencyCode": "USD"
}
}
]
}
}
}
}Change a listing's stock
Add or remove stock on one or more variants by delta. Reuse idempotencyKey on retries.
mutation AdjustListingStock($input: AdjustProductVariantQuantitiesInput!) {
adjustProductVariantQuantities(input: $input) {
__typename
... on AdjustProductVariantQuantitiesSuccess {
results {
productVariantId
outcome {
__typename
... on AdjustProductVariantQuantityItemSuccess {
quantityChange {
delta
quantityAfter
}
}
... on Error {
message
}
}
}
}
... on Error {
message
}
}
}{
"input": {
"idempotencyKey": "sync-stock-001",
"productVariants": [
{
"productVariantId": "pv_example",
"delta": -1,
"reason": "Sold in external store"
}
]
}
}Change a listing's price or details
Change a listing title, description or variant price. variantChanges keeps every variant that you do not name.
mutation UpdateListing($input: UpdateProductInput!) {
updateProduct(input: $input) {
__typename
... on UpdateProductSuccess {
product {
id
title
updatedAt
variants(first: 10) {
edges {
node {
id
price {
amount
currencyCode
}
}
}
}
}
}
... on ProductValidationError {
message
issues {
field
code
message
}
}
... on Error {
message
}
}
}{
"input": {
"productId": "product_example",
"title": "1993 holographic trading card (graded)",
"variantChanges": {
"change": [
{
"productVariantId": "pv_example",
"price": {
"amount": "29.99",
"currencyCode": "USD"
}
}
]
}
}
}Remove listings
Delete up to 100 listings in one call. Each ID gets its own result so one failure does not stop the rest.
mutation DeleteListings($input: DeleteProductsInput!) {
deleteProducts(input: $input) {
__typename
... on DeleteProductsSuccess {
results {
productId
outcome {
__typename
... on DeleteProductItemSuccess {
deletedProductId
}
... on Error {
message
}
}
}
}
... on Error {
message
}
}
}{
"input": {
"productIds": [
"product_example"
]
}
}List paid orders that wait for shipping
List paid, unfulfilled orders with their items and shipment IDs, oldest first. Send pageInfo.endCursor as after for the next page.
query OrdersToShip($after: String) {
orders(
first: 50
after: $after
where: {paymentStatus: [PAID], fulfillmentStatus: [NOT_FULFILLED]}
sort: {field: CREATED_AT, direction: ASC}
) {
edges {
node {
id
receiptId
paymentStatus
fulfillmentStatus
createdAt
total {
amount
currencyCode
}
items(first: 20) {
edges {
node {
title
variantTitle
quantity
lineTotal {
amount
currencyCode
}
}
}
}
shipment {
id
status
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}Add a tracking number to a shipment
Attach a carrier tracking number (USPS, UPS, FEDEX, CANADA_POST or CUSTOM) to a shipment. Standard carriers update from scans; CUSTOM marks it shipped at once.
mutation AddShipmentTrackingNumber($input: AddShipmentTrackingNumberInput!) {
addShipmentTrackingNumber(input: $input) {
__typename
... on AddShipmentTrackingNumberSuccess {
shipment {
id
status
shippedAt
tracking {
carrier
trackingNumber
trackingUrl
}
}
}
... on Error {
message
}
}
}{
"input": {
"shipmentId": "shipment_example",
"carrier": "USPS",
"trackingNumber": "9400111899223100000001"
}
}Mark a shipment shipped without tracking
Mark a seller-delivered shipment as shipped when no tracking number is available.
mutation MarkShipmentShipped($input: MarkShipmentShippedInput!) {
markShipmentShipped(input: $input) {
__typename
... on MarkShipmentShippedSuccess {
shipment {
id
status
shippedAt
}
}
... on Error {
message
}
}
}{
"input": {
"shipmentId": "shipment_example"
}
}Read the object a webhook names
Read the current object for a webhook data.id (product_, order_, live_ or user_) with your publishable key and the access token of the member in user_id.
query WebhookNode($id: ID!) {
node(id: $id) {
__typename
id
... on Product {
title
lifecycle
visibility
availableQuantity
updatedAt
}
... on Order {
receiptId
paymentStatus
fulfillmentStatus
total {
amount
currencyCode
}
updatedAt
}
... on Livestream {
title
status
startAt
endedAt
}
... on User {
username
displayName
}
}
}{
"id": "order_example"
}