Overview

Documentation for SquarePrice API 1.0

Before you start

The SquarePrice API is designed for developers, engineers or anyone else who likes to create custom solutions for RESTful APIs.

Resources

http://squareprice.co.uk/api

For example to call the price api endpoint the URL would be http://squareprice.co.uk/api/price to use the API you must first have authenticated and hold a valid API key which is available in your account.

Authenticate

Prior to calling any other route, you must authenticate. The token provided in the response is valid for 24 hours.

HTTP method Endpoint Function
POST /authenticate API Authentication token
Response Code Message
200 Successfully authorised
400 Invalid parameters
403 Failed to authenticate
Rate limit amount
5 Per hour

Price

HTTP method Endpoint Function
POST /price Price Match
Response Code Message
200 Price matched and found
204 Product found but no match against retailer list
206 Product found but no retailers found
404 Product could not be found from GTIN/Barcode reference
429 Account limit hit
Rate limit amount account
Requests 5 Per second All
Queries Custom per account (see X-Rate-Sp-Interval-Reset) Packaged accounts

Rate limit response headers

Header Definition
X-Rate-Sp-Interval-Reset Interval in milliseconds between requests
X-Rate-Sp-Limit Number of price matches in credit on your account
X-Rate-Sp-Reset Time in milliseconds when your balance is reset
X-Rate-Sp-Remaining Remaining credits on for the current period
X-RateLimit-Limit Authentication requests limit
X-RateLimit-Remaining Remaining authentication requests

There is a limit on the number of requests allowing 5 requests every 1 second, with a default delay of 1 second between requests

You may also be limited if you have reached your account limit (the number of products allowed per time period e.g 24 hours), queries remaining on your account will be shown in the response header as X-Rate-Sp-Remaining. This is the number of price matches that you have left

The 429 response deals with 2 conditions the above and the interval you must leave between requests, you can get the correct interval you need to leave between requests by using the X-Rate-Sp-Interval-Reset header that is returned in the case of a 429 response, delay your next request by this amount of time

General Codes

Response Code Message
401 No authentication token provided
429 Too many requests, throttle your requests to API limits
500 Internal server error