Skip to content
PubAdHub

Affiliate Product Search

Publisher API

The Affiliate Product Search API returns in-stock affiliate products for a search keyword. Authentication is performed by including your PublisherKey in the request header. Fire a GET request to /api/products/search on statsapi.pubadhub.com with the required keyword parameter. The optional domain parameter filters results to a single merchant brand. Each product includes a monetized redirect_url so clicks can be attributed to your publisher account. Successful searches, including empty result sets, return HTTP 200 — always inspect the response body.

Base URL https://statsapi.pubadhub.com
GET /api/products/search
warning

Tracking

Always use redirect_url from the response for Shop / Buy clicks so attribution is tracked. Do not send an AccessKey header on this endpoint.
lock

Authentication

Send PublisherKey as an HTTP request header. Contact your PubAdHub Account Manager to obtain your PublisherKey. Each publisher receives a unique key — do not reuse a key across publishers. Do not send an AccessKey header for this endpoint. Accept: application/json is recommended.

PublisherKey: {PublisherKey}

Headers

PublisherKey REQUIRED

{PublisherKey}

Your unique PubAdHub publisher key issued by your Account Manager. Do not reuse a key across publishers.

Accept

application/json

Recommended. Request a JSON response.

Query Parameters

Query-string parameters. Required: keyword (maximum 255 characters). Optional: domain, which filters results to a single merchant brand (for example walmart.com, bestbuy.com, target.com). Map your search UI values to these names and populate keyword before the request is fired.

keyword
string REQUIRED

Location: query

Search term used to find products. Maximum 255 characters.

Example: iphone

domain
string OPTIONAL

Location: query

Brand domain filter (for example walmart.com, bestbuy.com, target.com). When provided, results are limited to that merchant brand. Confirm the domain is a supported brand enabled for your account.

Example: walmart.com

API format

API Format
https://statsapi.pubadhub.com/api/products/search?keyword={keyword}&domain={domain}

Request example

curl --location --request GET 'https://statsapi.pubadhub.com/api/products/search?keyword=iphone&domain=walmart.com' \
--header 'PublisherKey: {PublisherKey}' \
--header 'Accept: application/json'

Response

HTTP 200. Matching in-stock products are returned in results (maximum 20). Use redirect_url for the Shop / Buy button.

JSON
{
    "keyword": "iphone",
    "results": [
        {
            "id": "123456",
            "name": "Apple iPhone 15 128GB",
            "image_url": "https://...",
            "currency": "USD",
            "regular_price": 799,
            "final_price": 749,
            "on_sale": true,
            "availability": "InStock",
            "merchant": {
                "name": "Walmart"
            },
            "redirect_url": "https://ck.pubadhub.com/track?encyp=...&dl=..."
        }
    ]
}

HTTP 200. When no products match, results is an empty array and message is No result found.

JSON
{
    "keyword": "iphone",
    "results": [],
    "message": "No result found"
}

HTTP 422. Returned when required fields are missing, for example a blank keyword.

JSON
{
    "error": "Validation failed",
    "messages": {
        "keyword": [
            "The keyword field is required."
        ]
    }
}

HTTP 401. PublisherKey is missing or not recognized.

JSON
{
    "error": "Unauthorized"
}

HTTP 500. The search could not be completed.

JSON
{
    "error": "Search failed.",
    "message": "something went wrong"
}

Response fields

keyword string

Echo of the search keyword.

Example: iphone

results array

List of matching in-stock products (maximum 20).

Example: []

message string (empty only)

Present when no products are returned: No result found.

Example: No result found

results[].id string

Product identifier. Shown in the success sample.

Example: 123456

results[].name string

Product title for display.

Example: Apple iPhone 15 128GB

results[].image_url URL

Product image URL.

Example: https://...

results[].final_price number

Current / sale price.

Example: 749.00

results[].regular_price number

Regular / list price.

Example: 799.00

results[].currency string

Currency code (for example USD).

Example: USD

results[].on_sale boolean

Whether the product is on sale. Shown in the success sample.

Example: true

results[].redirect_url URL

Monetized PubAdHub tracking link. Use this for the Shop / Buy button.

Example: https://ck.pubadhub.com/track?encyp=...&dl=...

results[].merchant.name string

Merchant / store name.

Example: Walmart

results[].availability string

Stock status (InStock).

Example: InStock

Errors

Validation Failed

The keyword field is required.

JSON
{
    "error": "Validation failed",
    "messages": {
        "keyword": [
            "The keyword field is required."
        ]
    }
}

Unauthorized

Unauthorized

JSON
{
    "error": "Unauthorized"
}

Search Failed

something went wrong

JSON
{
    "error": "Search failed.",
    "message": "something went wrong"
}

Notes

info
Call GET https://statsapi.pubadhub.com/api/products/search. Send parameters as query-string values. Always include the PublisherKey header. Do not send an AccessKey header.
info
Required parameter: keyword (maximum 255 characters, no blank values). Optional: domain, which limits results to one merchant brand enabled for your account (for example walmart.com, bestbuy.com, target.com).
info
The endpoint returns HTTP 200 for successful searches, including empty result sets. Always inspect the response body. When no products match, results is an empty array and message is No result found.
info
results contains at most 20 in-stock products. Use redirect_url for Shop / Buy clicks so attribution is tracked.
info
HTTP 422 is validation failure. HTTP 401 is unauthorized. HTTP 500 is search failure (error: Search failed.).
info
Set appropriate timeout values and implement proper error and timeout handling.
info
Integration checklist: obtain PublisherKey from your Account Manager; configure /api/products/search; set the PublisherKey header on every request; map keyword from your search UI; map optional domain where available; use redirect_url for Shop / Buy; test a success response with products in results; test empty response handling via message No result found; configure timeout and error handling.

Original PDF

This page is sourced from the official API PDF. The original file remains available.

PubAdHub Affiliate Product Search API.pdf

Related documentation

play_circle

Try it out

Fill the fields below, copy the generated cURL, or send a live request.

GET https://statsapi.pubadhub.com/api/products/search
cURL

        
Response Status: