API Documentation

Welcome to the PricingHunter's API Documentation! Integrate competitor prices seamlessly, optimize decisions, and gain a competitive edge. Retrieve data, automate processes, and unlock new possibilities for your business.


Introduction

What is an API?

An API (Application Programming Interface) is a set of rules and protocols that allows different software applications to communicate and interact with each other. It defines the methods, data structures, and conventions for building software components that can be easily integrated into other systems.


What is a RESTful API?

A RESTful API (Representational State Transfer) is a type of API that follows the principles of the REST architectural style. It uses standard HTTP methods like GET, POST to perform operations on resources. RESTful APIs are stateless, meaning each request is independent and doesn't rely on previous requests or session information.


What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language.


Types of Requests:

Our API supports the following HTTP methods:

  • GET: Used to retrieve data from the server. For example, you can use a GET request to fetch information about a specific resource.
  • POST: Used to send data to the server for creating new resources. This request is commonly used for submitting forms or uploading files.

Responses

When making requests to our API, you can expect the following HTTP status codes in the responses:

  • 200 OK: The request was successful, and the server returned the requested data.
  • 201 Created: The request to create a new resource was successful.
  • 400 Bad Request: The request was invalid or malformed. Additional information about the error can be found in the response body.
  • 404 Not Found: The requested resource was not found on the server.
  • 500 Internal Server Error: An unexpected error occurred on the server.

Authentication

API Token

To authenticate your requests, you need to pass your API Token in the Authorization header. You can find your API Token in your account settings.

Headers

Key Value
Accept
application/json
Authorization
Bearer YOUR_API_TOKEN

Rate Limit

The API is limited to 3600 requests per hour. If you exceed this limit, you will receive a 429 Too Many Requests response.


Endpoints

All Products

This route will return all client products where `page` is the pagination number.

This endpoint returns both active and deactivated products.

GET Request

/api/all-products?page=1

Expected Response

Status Body
200 OK
{
    "page": 1,
    "total_pages": 1,
    "total_products": 2,
    "products_per_page": 200,
    "all-products": [
        {
            "product_id": "1A",
            "name": "Product 1",
            "url": "https://www.product.com/1",
            "brand": "Brand 1",
            "category_1": "Category 1",
            "category_2": "Category 2",
            "tags": "Tag 1, Tag 2, Tag 3",
            "status": "Avaliable",
            "sell_price": "306.00",
            "cost_price": "429.00"
        },
        {
            "product_id": "2A",
            "name": "Product 2",
            "url": "https://www.product.com/2",
            "brand": "Brand 2",
            "category_1": "Category 1",
            "category_2": "Category 2",
            "tags": "Tag 1, Tag 2, Tag 3",
            "status": "Avaliable",
            "sell_price": "743.00",
            "cost_price": "887.00"
        },
    ],
}
400 Bad Request
{"Warning":"Bad Request!","Missing/Invalid":"page"}

Please note that all endpoints other than /all-products will return only active products.

curl GET

https://www.pricinghunter.com/api/all-products?page=1

Key Value
page
1

This route will return all products with `products_id` or `name` like XXX

GET Request

/api/product-search?search-term=XXX

Expected Response

Status Body
200 OK
{
    "total_products": 5,
    "products": [
        {
            "product_id": "1A",
            "name": "Product 1",
            "url": "https://www.product.com/1",
            "brand": "Brand 1",
            "category_1": "Category 1",
            "category_2": "Category 2",
            "tags": "Tag 1, Tag 2, Tag 3",
            "status": "Avaliable",
            "sell_price": "306.00",
            "cost_price": "429.00"
        },
        {
            "product_id": "11A",
            "name": "Product 11",
            "url": "https://www.product.com/11",
            "brand": "Brand 11",
            "category_1": "Category 1",
            "category_2": "Category 2",
            "tags": "Tag 1, Tag 2, Tag 3",
            "status": "Avaliable",
            "sell_price": "471.00",
            "cost_price": "343.00"
        },
    ]
}
400 Bad Request
{"Warning":"Bad Request!","Missing":"search-term"}

curl GET

https://www.pricinghunter.com/api/product-search?search-term=XXX

Key Value
search-term
PRODUCT_ID OR NAME
Single Product

This route will return a product where {productId} is product id/SKU

GET Request

 /api/product?product_id=XXX

Expected Response

Status Body
200 OK
{
    "product": {
        "product_id": "1A",
        "name": "Product 1",
        "url": "https://www.product.com/1",
        "brand": "Brand 1",
        "category_1": "Category 1",
        "category_2": "Category 2",
        "tags": "Tag 1, Tag 2, Tag 3",
        "status": "Avaliable",
        "sell_price": "306.00",
        "cost_price": "429.00",
        "matches": [
            {
                "website": "example.com",
                "url": "https://www.example.com/A4",
                "price": "9.00",
                "product_name": "A4"
            },
            {
                "website": "example.com",
                "url": "https://www.example.com/A5",
                "price": "10.00",
                "product_name": "A5"
            },
        ]
    }
}
400 Bad Request
{"Warning":"Bad Request!","Missing":"product_id"}
404 Not Found
{"Warning":"Not Found!","Invalid":"product_id"}

curl GET

https://www.pricinghunter.com/api/product?product_id=XXX

Key Value
product_id
PRODUCT_ID
Add Product

This route will add product. Body must contain the following fields:

product_id must be unique within your account. If you submit a duplicate product_id, the request will be rejected with a conflict error.

  • product_id * (string)
  • name * (string)
  • url (string)
  • sell_price * (decimal)
  • cost_price (decimal)
  • brand (string)
  • category_1 (string)
  • category_2 (string)
  • tags (string)
  • status (string)

POST Request

/api/add-product

Expected Response

Status Body
200 OK
{"success":true,"message":"Product added successfully! "}
422 Unprocessable Content
{
    "message":"The product id field is required.",
    "errors":{"product_id":["The product id field is required."]}
}

curl POST

https://www.pricinghunter.com/api/add-product

Key Value
product_id
YOUR_PRODUCT_ID
name
YOUR_PRODUCT_NAME
url
https://www.your-site.com/product/1
sell_price
YOUR_PRODUCT_SELL_PRICE
cost_price
YOUR_PRODUCT_COST_PRICE
brand
YOUR_PRODUCT_BRAND
category_1
YOUR_PRODUCT_CATEGORY_1
category_2
YOUR_PRODUCT_CATEGORY_2
tags
YOUR_PRODUCT_TAGS
status
YOUR_PRODUCT_STATUS
Bulk Add Product

This route will add bulk products. Body must contain fields in the following format:

product_id must be unique within your account. If you submit a duplicate product_id, the request will be rejected with a conflict error.

  • product_id * (string)
  • name * (string)
  • url (string)
  • sell_price * (decimal)
  • cost_price (decimal)
  • brand (string)
  • category_1 (string)
  • category_2 (string)
  • tags (string)
  • status (string)

POST Request

/api/add-bulk-product

JSON format accepted:

{"products": [{"product_id": "1A","name": "Product 1","url": "https://www.your-site.com/product/1","brand": "Brand 1","category_1": "Category 1","category_2": "Category 2","tags": "Tag 1, Tag 2, Tag 3","status": "Avaliable","sell_price": "306.00","cost_price": "429.00"},{"product_id": "11A","name": "Product 11","url": "https://www.your-site.com/product/11A","brand": "Brand 11","category_1": "Category 1","category_2": "Category 2","tags": "Tag 1, Tag 2, Tag 3","status": "Avaliable","sell_price": "471.00","cost_price": "343.00"}]}

Expected Response

Status Body
200 OK
{"success":true,"message":"Product added successfully! "}
200 PROBLEM
{
    "success":true,
    "problems": true,
    "message":"Products have been added successfully, but some issues were found.
               Please check /api/products-with-issues and make necessary corrections.
               Thank you!"
}
400 Bad Request
{
    "message":"Invalid url.",
    "success":false
}

curl POST

https://www.pricinghunter.com/api/add-bulk-product

Key Value
product_id
YOUR_PRODUCT_ID
name
YOUR_PRODUCT_NAME
url
https://www.your-site.com/product/1
sell_price
YOUR_PRODUCT_SELL_PRICE
cost_price
YOUR_PRODUCT_COST_PRICE
brand
YOUR_PRODUCT_BRAND
category_1
YOUR_PRODUCT_CATEGORY_1
category_2
YOUR_PRODUCT_CATEGORY_2
tags
YOUR_PRODUCT_TAGS
status
YOUR_PRODUCT_STATUS
Products with Issue

This route will return all product with issue. It is important to note that these products cannot be matched with until the underlying issues are resolved/edited.

GET Request

/api/products-with-issue

Expected Response

Status Body
200 OK
{
    "success": true,
    "products": [
        {
            "product_id": "SKU_8",
            "url": "your-website.com/product/8",
            "issue": "Invalid URL"
        },
        {
            "product_id": "1A",
            "url": "httwww.product.com/11",
            "issue": "Invalid URL"
        }
    ]
}

curl GET

https://www.pricinghunter.com/api/products-with-issue

Key Value
product_id
PRODUCT_ID
url
INVALID_URL
issue
ISSUE
Edit Product

This route will edit product. Body must contain the following fields:

  • product_id * (string)
  • name * (string)
  • url (string)
  • sell_price * (decimal)
  • cost_price (decimal)
  • brand (string)
  • category_1 (string)
  • category_2 (string)
  • tags (string)
  • status (string)

POST Request

/api/edit-product

Expected Response

Status Body
200 OK
{"success":true,"message":"The product has been successfully edited."}
422 Unprocessable Content
{
    "message":"The product id field is required.",
    "errors":{"product_id":["The product id field is required."]}
}

curl POST

https://www.pricinghunter.com/api/edit-product

Key Value
product_id
YOUR_PRODUCT_ID
name
YOUR_PRODUCT_NAME
url
https://www.your-site.com/product/1
sell_price
YOUR_PRODUCT_SELL_PRICE
cost_price
YOUR_PRODUCT_COST_PRICE
brand
YOUR_PRODUCT_BRAND
category_1
YOUR_PRODUCT_CATEGORY_1
category_2
YOUR_PRODUCT_CATEGORY_2
tags
YOUR_PRODUCT_TAGS
status
YOUR_PRODUCT_STATUS
Delete Product

This route will delete product. Body must contain the following fields:

  • product_id * (string)

POST Request

/api/delete-product

Expected Response

Status Body
200 OK
{"success":true,"message":"Product deleted successfully."}
422 Unprocessable Content
{
    "message": "The product id field is required.",
    "errors": {"product_id": ["The product id field is required."]}
}

curl POST

https://www.pricinghunter.com/api/delete-product

Key Value
product_id
PRODUCT_ID
All Matches

This route will return all matches where `page` is the pagination number.

GET Request

/api/all-matches?page=1

Expected Response

Status Body
200 OK
{
    "page": 1,
    "total_pages": 1,
    "total_products": 5,
    "products_per_page": 200,
    "all-matches": [
        {
            "match_id": 2,
            "product_id": 1,
            "website": "example.com",
            "url": "https://www.example.com/A2",
            "client_product": {
                "name": "Product 1",
                "url": "https://www.product.com/1",
                "brand": "Brand 1",
                "category_1": "Category 1",
                "category_2": "Category 2",
                "tags": "Tag 1, Tag 2, Tag 3",
                "status": "Avaliable"
            }
        },
        {
            "match_id": 3,
            "product_id": 1,
            "website": "example.com",
            "url": "https://www.example.com/A3",
            "client_product": {
                "name": "Product 1",
                "url": "https://www.product.com/1",
                "brand": "Brand 1",
                "category_1": "Category 1",
                "category_2": "Category 2",
                "tags": "Tag 1, Tag 2, Tag 3",
                "status": "Avaliable"
            }
        },
    ],
}
400 Bad Request
{"Warning":"Bad Request!","Missing/Invalid":"page"}

curl GET

https://www.pricinghunter.com/api/all-matches?page=1

Key Value
page
1
Get a Match

This route will return a match where match_id is match id that comes from the API.

GET Request

/api/get-match?match_id=XXX

Expected Response

Status Body
200 OK
{
    "match": {
        "match_id": 2,
        "product_id": 1,
        "website": "example.com",
        "url": "https://www.example.com/A2",
        "client_product": {
            "name": "Product 1",
            "url": "https://www.product.com/1",
            "brand": "Brand 1",
            "category_1": "Category 1",
            "category_2": "Category 2",
            "tags": "Tag 1, Tag 2, Tag 3",
            "status": "Avaliable",
            "sell_price": "306.00",
            "cost_price": "429.00"
        }
    }
}
400 Bad Request
{"Warning":"Bad Request!","Missing":"match_id"}
404 Not Found
{"Warning":"Not Found","Missing":"match_id"}

curl GET

https://www.pricinghunter.com/api/get-match?match_id=2

Key Value
match_id
2
Add Match

This route will add a match. Body must contain the following fields:

  • url * (string)
  • product_id * (string)

POST Request

/api/add-match

Expected Response

Status Body
200 OK
{"success":true,"message":"The match has been successfully added."}
404 Not Found
{"Warning":"Not Found","Missing/Invalid":"product_id"}
422 Unprocessable Content
{
"message": "The product id field is required.",
"errors": {"product_id": ["The product id field is required."]}
}

Note that products with errors in their URL cannot be matched with until the underlying issues are resolved.**


curl POST

https://www.pricinghunter.com/api/add-match

Key Value
url
https://example.com/product/1
product_id
PRODUCT_ID
Edit Match

This route will edit a match. Body must contain the following fields:

  • match_id * (integer)
  • url * (string)

POST Request

/api/edit-match

Expected Response

Status Body
200 OK
{"success":true,"message":"The match has been successfully added."}
422 Unprocessable Content
{
    "message": "The match id field is required",
    "errors": {"product_id": ["The match id field is required"]}
}

curl POST

https://www.pricinghunter.com/api/edit-product

Key Value
match_id
YOUR_MATCH_ID
url
https://example.com/product/1
Delete Match

This route will delete a match. Body must contain the following fields:

  • match_id * (integer)

POST Request

/api/delete-match

Expected Response

Status Body
200 OK
{"success":true,"message":"Product deleted successfully. "}
422 Unprocessable Content
{
    "message": "The match id field is required",
    "errors": {"product_id": ["The match id field is required"]}
}

curl POST

https://www.pricinghunter.com/api/delete-match

Key Value
match_id
YOUR_MATCH_ID
All Brands

This route will return all brands.

GET Request

/api/all-brands

Expected Response

Status Body
200 OK
{
    "total-brands": 3,
    "brands": [
        {
            "brand": "Brand 1"
        },
        {
            "brand": "Brand 2"
        },
        {
            "brand": "Brand 3"
        },
  ]
}

curl GET

https://www.pricinghunter.com/api/all-matches?page=1

Key Value
page
1
All Categories

This route will return all categories.

GET Request

/api/all-categories

Expected Response

Status Body
200 OK
{
    "total-categories": 2,
    "categories": [
       {
            "category_1": "Category 1",
            "category_2": "Category 2"
       },
       {
            "category_1": null,
            "category_2": null
       }
    ]
}

* Field is required

curl GET

https://www.pricinghunter.com/api/all-categories

Key Value