Build on the Partner API

View as Markdown

How it works

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.

The LivingSocial Partner API lets partners, creators and builders (and the AI coding assistants they build with) find eligible Groupon US offers with one search or list them on their own site from a synced copy of the catalog, mirror the shopper's cart at Groupon, and send the shopper to Groupon's checkout to pay. Only US inventory is exposed.

Still deciding what to build? Give your AI coding assistant for-builders.md: it works out with you what to build from the example sites, then sends it to their source code and the API reference.

text
Read https://agent.livingsocial.com/for-builders.md and follow it.

End-to-end flow

text
1. Get your key      Sign in to this portal, register a storefront, create an API key
2. Find offers       GET /partner_storefront/products/search?q=... -> the best matches now
                      or sync: GET /partner_storefront/products -> your database
                      (a full load, then a full resync every 8 hours; a delta every hour
                      is optional)
3. Shopper browses    Your site or agent shows the offers it found or stored
4. Add to cart        First item:  POST /partner_storefront/carts
                                    -> you receive cart `id` + `buyLink`
                       Later edits: POST/PATCH/DELETE on
                                    /partner_storefront/carts/{cartId}/items
5. Buy now             Your "Buy now" button href = the latest `buyLink` from any cart response
6. Pay at Groupon      Shopper pays on Groupon's checkout page
7. Return              Once Groupon approved your logo: Groupon redirects the
                        shopper to YOUR redirect URL with ?grouponOrderUuid=<uuid>;
                        any storefront: GET /partner_storefront/carts/{cartId} names it
8. Confirm             GET /partner_storefront/bookings/{bookingId}
                        -> status + one "View on Groupon" link per purchased unit

Each step has its guide: Get your API key, Searching the catalog, Syncing the catalog, Managing the cart, Checkout and order confirmation, and Handling errors for every failure. Every endpoint and field is in the API documentation.

Calling the API

Every path is relative to https://api-core.livingsocial.com. Call the API from your server only, with your key as a Bearer token:

bash
curl -s "https://api-core.livingsocial.com/partner_storefront/products?country=US&limit=10" \
  -H "Authorization: Bearer $GROUPON_API_KEY" \
  -H "x-request-id: $(uuidgen)"
HeaderWhenValue
AuthorizationAlwaysBearer followed by your API key
Content-TypePOST, PATCHapplication/json
User-AgentAlwaysA name for your app, such as my-storefront/1.0. It labels your calls; access depends on your key, never on the User-Agent: see Handling errors.
x-request-idRecommendedA UUID you make per request. An error echoes it as details.requestId: quote it to support.

Money is an integer in minor units: 2500 with currencyPrecision: 2 is $25.00.

Checkout, and earning commission with CJ

Buy now is the buyLink from the latest cart response, verbatim. Never build the checkout URL yourself.

The buyLink carries three UTM parameters on Groupon's checkout address: utm_source=LS_AI, utm_medium=partner and utm_campaign, your storefront's id. They let Groupon count the orders your shoppers place, next to CJ's own tracking. Keep the link exactly as it comes: the parameters are how those orders are counted.

Earning commission is optional and changes no code. Once your CJ (Commission Junction) publisher ID is on file (see Get your API key), the same buyLink becomes a CJ tracking link that leads to the same checkout, and commission is tracked and paid through CJ, per the CJ program terms. Inside that link the checkout carries utm_source=cj, utm_medium=afl and utm_campaign=LS_AI_partner_<your storefront id>, the form Groupon reports to CJ, and the same marker in utm_content, which CJ's redirect leaves as it is.

On the Partner API, the shopper must reach checkout through your buyLink; any other route earns nothing. This is the Partner API's rule; the open agent API has no commission.