Store

Your own systems can work with your Store's orders, products, stock and discounts through Magpie's API.

The Store API lets a program you run, such as a warehouse or accounting system, work with your Store. It can read orders, add shipments and refunds, and change prices and stock. Webhooks send a signed POST to your address when orders, products or stock change, or a customer asks for a return.

Create account
Greenpoint Studio’s Store webhook to its warehouse system: the HTTPS address, on, the signing secret’s last characters, and the events it receives, such as store.order.paid.

API keys and Store permissions

Each request includes an API key. API keys need Pro on the account of the person who creates them, and a key's secret is shown once. The X-Magpie-Team-Id header chooses the team.

A key can do in Store what the person who created it can. A member who is not an admin needs the Store permission for each kind of request.

See orders
List and read orders and returns.
Ship and edit orders
Add shipments, notes and tags.
Refund and cancel orders
Refund orders.
Manage products and Manage stock
Read Products and change prices and SKUs; set stock and record stock changes.
Manage customers and Manage discounts
Read customers; list, create, change and deactivate discounts.
Webhooks
Only team admins can add and change webhooks.

Orders

List and read
Orders list newest first, filtered by search text, payment, fulfillment, sales channel, tag and dates. One order comes with its items, how many of each have shipped, shipments, refunds, returns, addresses and history.
Add a shipment
A shipment has the carrier, tracking number and link, and the items in it. Without items, everything left ships. Magpie will email the customer, as from the order's page.
Refund
A refund is an amount, or everything still refundable, with the items to put back into stock. An order paid through Stripe will be refunded in your Stripe account.
Sent once
With an Idempotency-Key header on a refund or shipment, a repeated request returns the first answer and is not carried out twice.

Products, stock, returns and customers

Products and prices
Your program can read each product with every variant's price, SKU and stock. It can change a variant's price, compare-at price or SKU.
Stock changes
Your program can set a variant's units on hand, recorded as a count correction. It can add or remove stock with a reason, such as received or damaged. A change can name a stock location and a cost per item.
Low stock
The inventory list gives units on hand, held for checkouts and available for each variant that tracks stock. It can list only those at or below their reorder point.
Returns and customers
Your program can read return requests, and customers with their order count, spending, tags and marketing consent.

Discounts

Create and change discounts with the same settings as a discount's page in Store.

A code or automatic
A discount is a code buyers enter, or an automatic discount with a title.
Kinds and limits
A discount is a percentage, a fixed amount, free shipping, or buy X get Y. It applies to everything or chosen products or collections. It can have a minimum, usage limits, a customer segment, and dates.
Draft until active
A new discount is a draft until it is sent with the active status. If one value in a change is refused, the answer names it and nothing is changed.
Deactivate
Deactivating archives a discount: it stops applying at checkout and keeps its history.

Webhook events

A webhook sends a POST to an HTTPS address when something happens in the Store. You add webhooks in Store settings, with no API key needed, or through the API. A Store can have up to 20, each with the events you choose.

store.order.paid
An order is paid, online or recorded by hand.
store.order.fulfilled
A shipment is added, once for each shipment.
store.order.ready_for_pickup
A pickup order is marked ready for pickup.
store.order.refunded and store.order.canceled
A refund succeeds, or an unpaid order is canceled.
store.product.updated
A Product or its prices change.
store.stock.low
A variant's stock reaches its reorder point.
store.return.requested
A customer asks to return items.

Signatures, retries and the delivery log

Each POST has the headers X-Magpie-Event, X-Magpie-Id, X-Magpie-Timestamp and X-Magpie-Signature. The signature is an HMAC-SHA256 of the timestamp, a full stop and the raw body, made with the webhook's signing secret. The secret is shown once and can be replaced with a new one. X-Magpie-Id stays the same when a delivery is sent again, so your program can ignore a repeat.

Your program answers with any 2xx status. Any other answer, or none, will be retried over about two days, up to 8 attempts. The webhook's page lists recent deliveries with their results, and Send again resends a failed one.

Amounts, pages and the API reference

Prices and totals are whole numbers in the smallest unit of the Store's currency: 1999 is 19.99 in dollars. Lists return up to 100 records a page. Orders and customers include names, email addresses, phone numbers and addresses, so treat what your program stores as customer data.

The API reference at /docs/api links to the OpenAPI file, which lists every field.

Connect your Store to your own systems.

Create a Magpie account and give your Store a name.

Create account