Compare generated and public codes

Resolve merchant identity once, then batch offer queries. Source describes where each offer came from; probability describes its reported reliability. A partnership flag is merchant context, so read the source of each item rather than treating every offer at a partnered merchant as generated.

Response examples are illustrative unless labelled as a synthetic fixture. They preserve the API envelope but do not represent current availability, measured performance or checkout verification. Example codes cannot be redeemed; example links omit live attribution. Use the URLs returned by your real request.

What to inspect

source
generated is created through an integration; merchant_issued is a configured merchant offer; observed is a public code.
probability
Use the returned score for observed codes. The 0.01 below is an illustrative low-confidence case, not a prediction for your next request.
apply_count + success_count
Available checkout evidence can be null. The probability uses weighted recent evidence and need not equal the all-time success ratio.
query_id
Correlate each result with your request; the two merchants remain distinct throughout the batch.

Step 1 / POST /v1/merchants/codes

Request both sources in one batch

These are known merchant IDs; resolve domains with merchant search in a new integration. No min_probability is set so a low-confidence public code can be inspected. Live results may be empty or have different values.

Set OPENSTOCK_API_KEY in your environment before running this request.

cURL request

curl -sS -X POST 'https://api.openstock.sh/v1/merchants/codes' \
  -H "Authorization: Bearer $OPENSTOCK_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"queries":[{"query_id":"brooklinen","merchant_id":"01g4s5d0h956te86ff90h6xts4","idempotency_key":"replace-with-your-shopper-session-key","limit":1},{"query_id":"nike","merchant_id":"01g4s4gvb1kdc8kz69cm5q2b4f","idempotency_key":"replace-with-your-nike-session-key","limit":1}]}'

Request JSON

{
  "queries": [
    {
      "query_id": "brooklinen",
      "merchant_id": "01g4s5d0h956te86ff90h6xts4",
      "idempotency_key": "replace-with-your-shopper-session-key",
      "limit": 1
    },
    {
      "query_id": "nike",
      "merchant_id": "01g4s4gvb1kdc8kz69cm5q2b4f",
      "idempotency_key": "replace-with-your-nike-session-key",
      "limit": 1
    }
  ]
}

Illustrative full response

{
  "results": [
    {
      "query_id": "brooklinen",
      "cashback": {
        "value_type": "percent",
        "value_amount": 3
      },
      "partnered": true,
      "activation_url": "https://api.openstock.sh/mr/01g4s5d0h956te86ff90h6xts4",
      "suppressed_code_count": 0,
      "items": [
        {
          "code": "EXAMPLE-NOT-REDEEMABLE",
          "source": "generated",
          "probability": 1,
          "single_use": true,
          "value_type": "percent",
          "value_amount": 15,
          "currency": null,
          "conditions": [],
          "redirect_url": "https://api.openstock.sh/mr/01g4s5d0h956te86ff90h6xts4?code=EXAMPLE-NOT-REDEEMABLE",
          "expires_at": null,
          "last_success": null,
          "description": "15% off",
          "apply_count": null,
          "success_count": null
        }
      ]
    },
    {
      "query_id": "nike",
      "cashback": {
        "value_type": "percent",
        "value_amount": 3
      },
      "partnered": false,
      "activation_url": "https://api.openstock.sh/mr/01g4s4gvb1kdc8kz69cm5q2b4f",
      "suppressed_code_count": 0,
      "items": [
        {
          "code": "EXAMPLE-PUBLIC-CODE",
          "source": "observed",
          "probability": 0.01,
          "single_use": false,
          "value_type": "percent",
          "value_amount": 10,
          "currency": null,
          "conditions": [],
          "redirect_url": "https://api.openstock.sh/mr/01g4s4gvb1kdc8kz69cm5q2b4f?code=EXAMPLE-PUBLIC-CODE",
          "expires_at": null,
          "last_success": null,
          "description": "10% off",
          "apply_count": 12,
          "success_count": 0
        }
      ]
    }
  ]
}