Developers

Zhopwe API reference

A store-scoped REST API for your own integrations and for approved apps. Generated from the code that serves it.

The basics

  • Base URL https://zhopwe.com/api/v1. Send a merchant API key (zk_…) or an app access token (zat_…) as Authorization: Bearer <token>. Every credential belongs to exactly one store.
  • The version is in the path (/api/v1). If you send an Accept-Version header it must be 1 or v1; anything else is refused with 406.
  • Every write needs an Idempotency-Key header (8–100 characters). Retrying with the same key and body returns the first response with Idempotent-Replayed: true; the same key with a different body is refused.
  • Errors are always JSON: {"error": code, "message": text, "request_id": id}, plus "fields" for validation errors.
  • Each key or app install has a per-minute limit, reported in X-RateLimit-Limit and X-RateLimit-Remaining. Over it you get 429 with Retry-After.
  • Amounts in responses are integer minor units (cents) with a currency; amounts you send are decimal strings such as "1250.00".

Your credential

GET /api/v1/me

The key or token in use, its scopes and its shop

Scope: any valid credential

Products

GET /api/v1/products

List products, newest first

Scope: products:read

Query parameters

page
integer
per_page
integer (max 100)
status
draft | active | archived

GET /api/v1/products/{id}

One product with its variants

Scope: products:read

POST /api/v1/products

Create a product

Scope: products:write · requires Idempotency-Key

JSON body

title
string, required
price
decimal string, required
slug
string
status
draft | active
sku
string
stock
integer
track_inventory
boolean
compare_at
decimal string
low_stock_threshold
integer
subtitle
string
description
string

PATCH /api/v1/products/{id}

Change a product's price, stock, status or details

Scope: products:write · requires Idempotency-Key

JSON body

price
decimal string
stock
integer
status
draft | active
title
string
sku
string

Orders

GET /api/v1/orders

List orders, newest first

Scope: orders:read

Query parameters

page
integer
per_page
integer (max 100)
payment_status
pending | authorized | paid | partially_refunded | refunded | failed | canceled | expired
updated_since
ISO-8601 date-time (2026-10-22T10:00:00Z) or "Y-m-d H:i:s" in UTC; INCLUSIVE (updated_at >= since). 422 when unreadable.
sort
updated_asc: oldest change first (updated_at, then id). Omitted: newest first.

GET /api/v1/orders/{id}

One order with its lines

Scope: orders:read

GET /api/v1/orders/{id}/payment-proofs/{proof}

One payment screenshot of an order, once staff have verified the payment

Scope: orders:read

POST /api/v1/orders/{id}/payments

Record a payment against an order

Scope: orders:write · requires Idempotency-Key

JSON body

amount
decimal string, required
reference
string

POST /api/v1/orders/{id}/fulfillments

Mark items as sent, with courier and tracking number

Scope: orders:write · requires Idempotency-Key

JSON body

items
[{item_id, quantity}]
carrier
string
tracking_number
string
notify_customer
boolean

POST /api/v1/orders/{id}/cancel

Cancel an order that has not been sent

Scope: orders:write · requires Idempotency-Key

JSON body

reason
string
restock
boolean
note
string

Customers

GET /api/v1/customers

List customers, newest first

Scope: customers:read

Query parameters

page
integer
per_page
integer (max 100)
email
exact address

GET /api/v1/customers/{id}

One customer

Scope: customers:read

POST /api/v1/customers

Create a customer

Scope: customers:write · requires Idempotency-Key

JSON body

email
string, required
first_name
string
last_name
string
phone
string
accepts_marketing
boolean
locale
en | si | ta

PATCH /api/v1/customers/{id}

Change a customer's details or status

Scope: customers:write · requires Idempotency-Key

JSON body

first_name
string
last_name
string
phone
string
accepts_marketing
boolean
status
active | disabled

Stock

GET /api/v1/inventory

Stock on hand, reserved and available, per variant

Scope: inventory:read

Query parameters

page
integer
per_page
integer (max 100)

GET /api/v1/inventory/{id}

Stock for one variant

Scope: inventory:read

POST /api/v1/inventory/{id}/adjustments

Adjust a variant's stock, with a reason

Scope: inventory:write · requires Idempotency-Key

JSON body

delta
integer
on_hand
integer
note
string

Returns

GET /api/v1/returns

List return requests, newest first

Scope: returns:read

Query parameters

page
integer
per_page
integer (max 100)
status
requested | approved | rejected | in_transit | received | completed | canceled

GET /api/v1/returns/{id}

One return request with its lines

Scope: returns:read

Scopes

products:read
Read your products, their variants, prices and stock levels.
products:write
Create products and change their price, stock, status and details.
orders:read
Read your orders and their lines, including the customer's name, email and phone.
orders:write
Record payments (including part-payments) against orders, mark orders sent, and cancel unsent orders.
customers:read
Read your customers: name, email, phone, marketing consent and order totals.
customers:write
Create customer records and change their details or disable them.
inventory:read
Read stock on hand, reserved and available for every variant.
inventory:write
Change stock levels.
returns:read
Read return requests and their lines.

Webhook events

Subscribe an HTTPS endpoint in Dashboard → Integrations. Each delivery is signed with your endpoint secret; the payload carries event, payload_version, occurred_at, store and data.

order.created
Sent when a shopper completes checkout and an order is created.
order.fulfilled
Sent when items are marked as sent.
refund.recorded
Sent when a refund is recorded against an order.
order.cancelled
Sent when an order is cancelled.
order.paid
Sent when an order becomes fully paid.
customer.created
Sent when a customer record is created.
customer.updated
Sent when a customer's details or status change.
return.requested
Sent when a return is requested.
return.approved
Sent when a return is approved.
return.received
Sent when returned items are recorded as received (at approval).
inventory.low
Sent when a variant's stock falls to or below its low-stock threshold.
product.updated
Sent when a product is created or changed.

Inbound webhooks (ERP / CRM)

Create an inbound endpoint in Dashboard → Integrations. POST JSON {"action": …, "data": {…}} to its URL with headers X-Zhopwe-Event-Id, X-Zhopwe-Timestamp (unix seconds, within 5 minutes) and X-Zhopwe-Signature: v1=hex(HMAC-SHA256(secret, timestamp + "." + body)). Each event id is processed once. Actions: inventory.set, inventory.adjust, order.payment.

Apps (OAuth 2.0)

Approved apps use the authorization-code flow with PKCE (S256): send the merchant to https://zhopwe.com/oauth/authorize?client_id=…&redirect_uri=…&scope=…&state=…&code_challenge=…&code_challenge_method=S256, then POST to https://zhopwe.com/oauth/token. Access tokens last one hour; refresh tokens rotate on every use.