Webhooks
Get notified when orders and customers change, instead of polling. Subscribe a URL to an event and PrintNow POSTs the changed order or customer to it each time the event happens. This is also how the Zapier integration works.
Events
| Event | Fires when | Payload |
|---|---|---|
order_created | An order is placed on a storefront. | Order |
order_updated | An order changes in the storefront, the admin or the API: for example its status, shipping or items. | Order |
order_deleted | An order is deleted in the admin. | Order (its last state) |
customer_created | A customer account is created: storefront registration, the admin, the API, or a guest converted to an account. | Customer |
customer_updated | A customer's profile changes in the storefront, the admin or the API. | Customer |
customer_deleted | A customer is deleted through the API. | Customer (its last state) |
Deliveries
Each delivery is an HTTP POST to your target_url with Content-Type: application/json. The body is a JSON array holding one object: the order or customer in exactly the shape the Get Order and Get Customer endpoints return, so the same parsing works for both. The callbacks on the subscribe endpoint document each event's payload.
- Answer with any
2xxstatus to acknowledge the delivery. - Answer
410 Goneto unsubscribe: PrintNow removes the subscription. (Zapier uses this when a Zap is turned off.) - Your endpoint must be reachable from PrintNow. Firewalls are the most common reason deliveries don't arrive.
PrintNow's outgoing addresses
If your endpoint sits behind a firewall or VPN, allow these addresses. The list can change as PrintNow's infrastructure grows; contact PrintNow Support if you need it confirmed.
20.112.217.230 | 20.112.218.61 | 20.112.218.123 | 20.112.219.45 |
20.112.217.240 | 20.112.218.78 | 20.112.218.126 | 20.112.219.47 |
20.112.217.249 | 20.112.218.80 | 20.112.218.148 | 20.112.219.51 |
20.112.217.253 | 20.112.218.93 | 20.112.218.150 | 20.112.219.52 |
20.112.218.17 | 20.112.218.113 | 20.112.218.152 | 20.112.219.54 |
20.112.218.30 | 20.112.218.117 | 20.112.218.204 | 20.112.219.73 |
20.112.218.38 | 20.112.218.118 | 20.112.219.36 | 20.118.56.5 |
20.112.218.57 | 20.112.218.120 | 20.112.219.40 | 52.189.72.76 |
Subscriptions belong to an API key
Subscriptions are created, listed and removed per API key: each key sees and manages only its own. A target URL can be subscribed once per key, so use a different URL for each event you subscribe to.
Deactivating or deleting an API key (in the admin's Settings > API Keys) stops its subscriptions' deliveries. Reactivating the key resumes them.
Lifecycle
- Subscribe:
POST /api/v2/hookswithtarget_urlandevent. The response holds the subscription'sid. - Receive deliveries and answer
2xx. - Unsubscribe:
DELETE /api/v2/hooks/{id}, or answer a delivery with410 Gone.
List webhook subscriptions
Authorization
basic Your API token as the username and your API key as the password.
In: header
Response Body
application/json
application/json
application/json
application/json
curl -X GET "https://api.printnow.com/api/v2/hooks"[
{
"id": 1,
"target_url": "https://www.domain.com/new-customer",
"event": "customer_created"
},
{
"id": 2,
"target_url": "https://www.domain.com/new-order",
"event": "order_created"
}
]The key or token is missing, does not match, or the token is inactive or deleted.
{
"Message": "Invalid key or token."
}The message names the section, e.g. Orders, Customers, Products, Storefronts, Reports or Webhooks.
{
"Message": "Your license does not include the Orders API."
}Each license may make 100 calls per 10 seconds across all its API keys. Wait for the Retry-After header (seconds) before calling again.
{
"Message": "Rate limit exceeded: 100 calls per 10 seconds."
}Subscribe a URL to an event
Authorization
basic Your API token as the username and your API key as the password.
In: header
Request Body
application/json
The target URL and the event.
Required. The URL PrintNow POSTs the events to. It must be reachable from PrintNow; IP addresses in private, loopback or link-local ranges are refused.
Required. The event to subscribe to: order_created, order_updated, order_deleted, customer_created, customer_updated or customer_deleted.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.printnow.com/api/v2/hooks" \ -H "Content-Type: application/json" \ -d '{ "target_url": "https://www.domain.com/callback1.aspx", "event": "order_created" }'{
"id": 6,
"target_url": "https://www.domain.com/callback.aspx",
"event": "order_created"
}{
"Message": "Event name is invalid."
}The key or token is missing, does not match, or the token is inactive or deleted.
{
"Message": "Invalid key or token."
}The message names the section, e.g. Orders, Customers, Products, Storefronts, Reports or Webhooks.
{
"Message": "Your license does not include the Orders API."
}{
"Message": "Target url already exists."
}Each license may make 100 calls per 10 seconds across all its API keys. Wait for the Retry-After header (seconds) before calling again.
{
"Message": "Rate limit exceeded: 100 calls per 10 seconds."
}Unsubscribe
Authorization
basic Your API token as the username and your API key as the password.
In: header
Path Parameters
Subscription id, from the subscribe response or the list.
int64Response Body
application/json
application/json
application/json
application/json
curl -X DELETE "https://api.printnow.com/api/v2/hooks/0"The key or token is missing, does not match, or the token is inactive or deleted.
{
"Message": "Invalid key or token."
}The message names the section, e.g. Orders, Customers, Products, Storefronts, Reports or Webhooks.
{
"Message": "Your license does not include the Orders API."
}{
"Message": "Hook not found."
}Each license may make 100 calls per 10 seconds across all its API keys. Wait for the Retry-After header (seconds) before calling again.
{
"Message": "Rate limit exceeded: 100 calls per 10 seconds."
}