1What is the API?
Price2Spy tracks competitor prices online. The API (application programming interface) is a door through which your other software, such as your ERP, web shop or internal system, can talk to your Price2Spy account automatically, without anyone clicking through the application.
Through the API, your systems can read and change the data in your account:
- the products you track
- competitor links: pages in other shops where the price of your product is tracked
- the shops those links are on
- price history and current prices
- supporting lists such as brands, categories and suppliers
2What you need to get started
Price2Spy issues two values per account, similar to a username and password. Your Price2Spy contact also gives you the server address that requests are sent to.
Like a username
A public identifier that says "this is that account".
Like a password
A secret key. Never send it to anyone, not even to Price2Spy support.
Where to connect
The exact address your systems send their requests to.
Every request automatically sees only your account's data. There is no way to access someone else's data by accident.
3How Price2Spy knows a request really comes from you
Every request must be signed. Think of it as a seal on a document: your program takes the content of the request and the secret key, and calculates a unique signature from them.
Your system signs
It combines the request with your secret key to produce a signature.
The request travels
It is sent with the signature and the exact time it was created. The secret key itself is never sent.
Price2Spy checks
It repeats the same calculation. If the signatures match, the request is accepted.
If anyone tampers with the request along the way, changing even a single character, the signature no longer matches and the request is refused.
Key points
- The time must be correct. A signature is valid only within 15 minutes of Price2Spy's clock, so the clock on the server sending the requests must be set correctly.
- Every request is signed afresh. A signature is never used twice.
- The secret key stays on your server. It is never built into a web page or a mobile app, where anyone could read it.
4General rules
Data arrives in pages
When you ask for a list, for example all products, the answer arrives page by page, like Google search results. The default is 20 items per page, and you can ask for up to 500 (at most 50 for the current-prices view). Each page also says how many results there are in total and how many pages.
Four basic actions
| Action | Meaning | Note |
|---|---|---|
| Read GET | View data | Changes nothing in the account. |
| Create POST | Add a new record | For example, a new product or a new competitor link. |
| Update PATCH | Partial change | Only what you send is changed. Everything else stays as it was. |
| Delete DELETE | Remove a record | Deleting a product also deletes all its links and price history. It cannot be undone. |
Things to watch out for
Misspelled fields are ignored
If a program sends targetPrise instead of targetPrice, nothing changes and no error is shown. Always compare the response with what was sent.
Prices
From 0 to almost 10 billion, never negative, stored with two decimal places.
Currency
Prices are converted to your account currency when an exchange rate exists. Otherwise they stay in the shop's currency. The response always says which. Shipping costs and shelf prices are never converted.
Dates and time zones
A date sent without a time zone is read as Central European Time (Paris, Belgrade). This often explains why a date search returns fewer results than expected.
One year of history
Pricing data can be requested at most one year back, for a period no longer than one year.
Request limit
Each account may send a limited number of requests per second, for example 4. If it's exceeded, wait one second and try again. Ask your Price2Spy contact if you need more.
5What you can do
The API covers 8 areas with 43 functions in total.
| Area | What it allows, in plain words |
|---|---|
| Products | Search, add, change and delete the products you track. Each product can have a code (SKU), purchase and target price, upper and lower price limits, brand, category, supplier, 10 free fields and 2 comments. You also set how often prices are checked, in days or hours depending on your plan. |
| Links (URLs) | Add links to competitor pages for each product. A product can have only one link per shop. A link can be paused, changed or deleted. A "multiplier" handles cases such as a competitor selling a pack of 2. |
| Sites (shops) | The shops where you have at least one link. Give them your own name or a priority, or exclude them from email alerts. |
| Measurements | Each individual price check of one link: price, availability, promotion, shipping, stock status, seller and a screenshot of the page at the time of the check. |
| Pricing data | Three ready-made views: links whose price changed most recently, the full price history of one product, and the current picture of all products with current and previous prices and your own price. |
| Price buckets | How your products are spread across price ranges (for example €0–50, €50–100) and how many products fall in each. |
| Supporting lists | Brands, categories, suppliers and three lists of your own. View, add, change or delete entries, each with its own alert email addresses. An entry used by at least one product cannot be deleted. |
| Automatch | Price2Spy finds competitor pages that probably match your products. Accept a suggestion to make it a tracked link, reject it, or undo an acceptance made by mistake. |
6What error messages mean
When something fails, the system returns a number (status code) and a short message. These are the most important ones.
| Code | Meaning | What to do |
|---|---|---|
| 400 | The request is not valid: a wrong value, a bad date, or the clock is wrong | Correct the data or set the server clock. |
| 401 | Price2Spy did not recognise you: wrong signature or key, or the API is not enabled for the account | The developer checks the signature. If everything is correct, contact Price2Spy. |
| 403 | The record may not be changed | Don't try again. |
| 404 | The record does not exist in your account | Check the record's identifier (ID). |
| 409 | Conflict with existing data, such as a name already taken or a plan limit reached | Change the value or check your plan. |
| 429 | Too many requests per second | Wait a second and try again. |
| 500 | An error on Price2Spy's side | Try later. If it keeps happening, send Price2Spy the error ID from the message. |
A search that finds nothing is not an error. It simply returns an empty list.
7Key points
- Security is well designed. Every request is signed, limited to your account and valid only for a short time. Your only responsibility is to keep the secret key secret.
- The integration is complete. Everything done by hand in the application (products, links, prices, lists, automatic suggestions) can be automated.
- Deletion is permanent. Deleting a product or link also removes its price history. Control such actions carefully in the integration.
- There are limits. Requests per second, one year of history and plan rules. Keep them in mind when planning.
- Getting help. Send your Price2Spy contact a description of the request, the address and the time of the failed attempt, but never the secret key.