Two minutes, once you have a key.
Sandbox keys are free and return the live catalogue. Email us for one.
| Base URL | https://api.weguns.eu/v1 |
|---|---|
| Auth | x-api-key: <your key> |
| Sandbox key | On request: japjot@weguns.eu |
| Format | JSON in, JSON out. UTF-8 throughout. |
curl "https://api.weguns.eu/v1/swaps?item=whey%20protein" \ -H "x-api-key: YOUR_SANDBOX_KEY"
- Sandbox keys also work as
?key=in the URL, so you can try any endpoint from a browser. - Live keys must use the header.
- No SDK and no script to embed. One quick redirect,
GET /v1/go/{swap_id}, records the click; it needs no key, because it runs in the person's browser.
One call does the work.
Pass whatever the user actually typed or selected. Matching handles German and English, casing, umlauts and extra words like quantities.
GET /v1/swaps · POST /v1/swaps
Returns ranked plant-based alternatives, best match first.
| Parameter | Required | What it does |
|---|---|---|
item | yes | The food that was logged or planned. Hähnchenbrust 200g, whey protein, Schokoriegel. |
limit | no | How many swaps to return. Default 3, maximum 10. |
placement | no | Where in your app the card appears, such as meal_plan or basket. Flows into reporting. |
user_ref | no | Your own anonymous reference for the user. Never send a name or an email. |
channel | no | Only products sold there: online or in_store. Leave it out for every channel. |
moment | no | The meal moment: breakfast, lunch, dinner, snack, pre_workout, post_workout or other. |
intent | no | What the user was doing: logged, planned, shopping or other. |
goal | no | The user's goal in your app: lose_weight, maintain, gain_muscle, eat_healthier, performance or other. |
utc_offset_minutes | no | The user's time zone offset, a whole number from -720 to 840. 120 for Berlin in summer. |
The context fields are optional. A value outside the lists is ignored and named in a warnings list; the call still succeeds.
Every result carries a confidence between 0 and 1. A direct replacement like fish oil to algae oil scores 1.0. A looser match like chicken to plant protein scores around 0.5, so you can set a threshold below which you show nothing.
Every result also says where it can be bought, in purchase_channels: online, in_store, or both.
Each result has its own swap_id. Use it to report what happened to the card (see Events). wallet_reward_points is the Weguns Wallet balance the person earns if they buy, or null when no reward is set for that product.
When nothing sensible matches, the response is count: 0 with an empty list. Bananas get no swap. That is deliberate.
The whole shelf, whenever you want it.
Every product available to your app, for a browse view or for pre-caching.
GET /v1/catalogue?category=protein_bar
All active products, or one category, each with its purchase_channels. Add channel=online or channel=in_store to keep only products sold there. Omit the parameters for everything.
Current categories: protein_powder protein_bar nut_butter collagen omega3 creatine electrolytes topping supplement bundle accessory digital
Tell us what happened.
Every swap you request is logged, and a click is recorded when someone opens its checkout_url. Tell us the rest: was the card shown, declined or accepted?
POST /v1/events
Send the swap_id with a type of shown, declined or accepted. Each is recorded once per swap; a repeat returns "duplicate": true.
curl -X POST "https://api.weguns.eu/v1/events" \
-H "x-api-key: YOUR_SANDBOX_KEY" \
-H "content-type: application/json" \
-d '{
"swap_id": "7c1e2a90-5b3d-4f6e-9a12-3d4b5c6e7f80",
"type": "shown"
}'- Don't send clicks. Opening
checkout_urlrecords them, and a click event is refused withclick_is_automatic. - The older format without
swap_id(click,impression,accepted) still works, but new integrations should useswap_id.
Counted by the brand, not by us.
You ask for swaps
Each swap gets a swap_id. Its checkout_url points at our short redirect, which sends the person on to the brand's own affiliate link with the swap_id as the subid.
The user opens it
In-app browser, system browser or a native sheet, whichever suits your app. The redirect records the click; nothing else is required on your side.
The brand reports the sale
The brand reports the sale against that subid, so we know which app and placement earned it, and your share is calculated from the brand's own numbers rather than ours.
- We store the food item and a keyed hash of your user reference, never the reference itself, names, emails or health data.
- Send an opaque
user_refthat you generate, or leave it out entirely.
Same shape every time.
A code you can branch on, and a message meant to be read by a person.
{
"error": {
"code": "missing_item",
"message": "Provide the food item, e.g. ?item=whey protein"
}
}| Status | Code | Meaning |
|---|---|---|
| 401 | missing_api_key | No key was sent. |
| 401 | invalid_api_key | The key is not recognised, or it is disabled. |
| 401 | key_in_url | A live key was passed in the URL. Use the header. |
| 400 | missing_item | The item parameter is empty. |
| 400 | bad_channel | The channel is not online or in_store. |
| 400 | bad_type | The event type is not shown, declined or accepted. |
| 400 | click_is_automatic | A click was sent as an event. Clicks are recorded by checkout_url. |
| 404 | unknown_swap | No swap with that swap_id for your app, or the id is malformed. |
| 404 | not_found | No endpoint at that path. |
| 405 | method_not_allowed | A checkout link was opened with something other than GET. |
| 500 | lookup_failedcatalogue_failedevent_failedclick_failed | Something went wrong on our side. Safe to retry. |
