STAGINGOpen PROD

Build on the Partner API

View as Markdown

Handling errors

Last updated

Nobody reads documentation.

Here are the instructions for your agent. Give it this prompt: it reads the guides and the API contract, then walks you through the integration step by step, what to do, where and how.

Download agent instructions

This guide is for builders of a website or app on the Partner API.

Every endpoint answers an error in one shape. Branch on details.error; code is the general class of the error.

json
{
  "code": "aborted",
  "message": "Displayed price no longer valid",
  "details": {
    "error": "PRICE_MISMATCH",
    "errorMessage": "Displayed price no longer valid",
    "requestId": "c0ffee00-...",
    "path": "$.items[0]",
    "expectedPrice": 4500,
    "currentPrice": 4900,
    "currency": "USD",
    "currencyPrecision": 2
  }
}

Error codes

details.errorHTTPWhat to do
BAD_REQUEST400A field is missing or invalid (errorMessage names it), or a cursor is bad. Fix the request, or restart the walk.
FORBIDDEN403Outside your inventory scope, or the storefront is closed. Do not retry.
INVALID_PRODUCT_ID404The product is gone: stop listing it. Or the cart has no such line: read the cart.
INVALID_CART_ID404Not a cart of your storefront. Create a new cart from your local copy.
INVALID_BOOKING_UUID404No such order placed from your carts. Show a neutral message.
PRODUCT_NOT_CARTABLE400Groupon's cart cannot take the offer: it needs a booked time slot, it is sold from a third party's inventory, it is a hotel stay booked by its dates on groupon.com, or it is sold in Canada, whose offers Groupon's cart does not take. details.bookingUrl is where it is bought instead: Groupon's booking page with the option chosen, or the offer's own page on groupon.com. Send the shopper there, and keep listing the product with the product's or the option's bookingUrl.
CART_ITEM_LIMIT400More than 20 different options in a cart.
CART_ABANDONED400You abandoned this cart, so it takes no change. Create a new cart with the same lines.
PRICE_MISMATCH409expectedPrice differs from the live price in details.currentPrice. Nothing was changed: update your price, ask the shopper to confirm, send it again.
RATE_LIMITED429More than the storefront's limit in a calendar minute (600 by default; Groupon raises it on request), counted across the storefront's keys. Wait details.retryAfterSeconds when the answer carries it; there is no Retry-After header.
UPSTREAM_UNAVAILABLE503Groupon could not answer, or the catalog cannot be read right now; errorMessage says which. Retry with backoff, except when adding cart items.
none401A missing, wrong, revoked or expired key; the message is the same for all four. Do not retry: alert an operator.

Name your client

Send a User-Agent header that names your agent or app on every call, so its calls can be told apart from others. Ordinary HTTP clients get through as they are, Python's urllib and a request with no User-Agent included: the User-Agent never decides access. In Python:

python
import urllib.request

request = urllib.request.Request(url, headers={"User-Agent": "my-agent/1.0"})

Retry policy

SituationRetry?
UPSTREAM_UNAVAILABLE, a network error, a timeout, or a 5xx with no Groupon codeYes, with exponential backoff, at most 5 tries
RATE_LIMITEDYes, after details.retryAfterSeconds; without it, back off
A failure while adding items to a cartNo. Read the cart and add only what is missing
A failure while creating a cartYes. A retry creates a separate new cart: use the id of the call that succeeded
Reading a cart or an orderYes. A read changes nothing
Every other codeNo