Weguns Back to home
API live · sandbox open

Plant‑based mode, as an API.

Send the food someone planned, logged or added to a list. Get back plant-based products from partner brands, each with a checkout link that is already tracked. Your app earns a share of every sale it sends.

Book a 30-min pilot call Try the demo
Get/v1/swaps?item=whey protein&limit=1
{
  "query": "whey protein",
  "count": 1,
  "swaps": [
    {
      "swap_id": "7c1e2a90-5b3d-4f6e-9a12-3d4b5c6e7f80",
      "rank": 1,
      "product_id": "f8bc9f85-57ed-47fb-b81a-2640261794b5",
      "title": "Vegan Protein Neutral (540g/BIO)",
      "brand": "Vetain",
      "category": "protein_powder",
      "price": 29.99,
      "sale_price": 26.99,
      "currency": "EUR",
      "unit_size": "540.0g",
      "purchase_channels": ["online"],
      "confidence": 1,
      "wallet_reward_points": null,
      "checkout_url": "https://api.weguns.eu/v1/go/7c1e2a90-5b3d-4f6e-9a12-3d4b5c6e7f80",
      "subid": "7c1e2a90-5b3d-4f6e-9a12-3d4b5c6e7f80"
    }
  ]
}
Quick start

Two minutes, once you have a key.

Sandbox keys are free and return the live catalogue. Email us for one.

Base URLhttps://api.weguns.eu/v1
Authx-api-key: <your key>
Sandbox keyOn request: japjot@weguns.eu
FormatJSON 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.
Swaps

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.

ParameterRequiredWhat it does
itemyesThe food that was logged or planned. Hähnchenbrust 200g, whey protein, Schokoriegel.
limitnoHow many swaps to return. Default 3, maximum 10.
placementnoWhere in your app the card appears, such as meal_plan or basket. Flows into reporting.
user_refnoYour own anonymous reference for the user. Never send a name or an email.
channelnoOnly products sold there: online or in_store. Leave it out for every channel.
momentnoThe meal moment: breakfast, lunch, dinner, snack, pre_workout, post_workout or other.
intentnoWhat the user was doing: logged, planned, shopping or other.
goalnoThe user's goal in your app: lose_weight, maintain, gain_muscle, eat_healthier, performance or other.
utc_offset_minutesnoThe 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.

Catalogue

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

Events

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_url records them, and a click event is refused with click_is_automatic.
  • The older format without swap_id (click, impression, accepted) still works, but new integrations should use swap_id.
Attribution

Counted by the brand, not by us.

  1. 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.

  2. 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.

  3. 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_ref that you generate, or leave it out entirely.
Errors

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"
  }
}
StatusCodeMeaning
401missing_api_keyNo key was sent.
401invalid_api_keyThe key is not recognised, or it is disabled.
401key_in_urlA live key was passed in the URL. Use the header.
400missing_itemThe item parameter is empty.
400bad_channelThe channel is not online or in_store.
400bad_typeThe event type is not shown, declined or accepted.
400click_is_automaticA click was sent as an event. Clicks are recorded by checkout_url.
404unknown_swapNo swap with that swap_id for your app, or the id is malformed.
404not_foundNo endpoint at that path.
405method_not_allowedA checkout link was opened with something other than GET.
500lookup_failed
catalogue_failed
event_failed
click_failed
Something went wrong on our side. Safe to retry.
Book a 30-min pilot call
Or write directly to japjot@weguns.eu.