API documentation

Basics

You can authenticate with our API by providing your API key either in the Authorization header, like this:

curl -H "Authorization: api_key YOUR_API_KEY" https://api.discountapi.com/v2/deals

Or by including it in the URL in the api_key query parameter:

curl https://api.discountapi.com/v2/deals?api_key=YOUR_API_KEY

Finding deals

GET https://api.discountapi.com/v2/deals

Request parameters

Parameter Description
query Searches through deals based on the full deal text, including title, description and merchant name.
location Find deals near this specific location. You can pass an IP address, latitude and longitude coordinates or an actual (part of an) address. Note that if you specify the location, we will not patch 'online' deals.
radius Radius around the location where deals may be located. Defaults to 10.
online Indicates whether to return online-only deals in the results, such as online shopping discounts. Accepts true/false or 1/0. If a location parameter is specified, this value will be set to false.
category_slugs Only return deals with the specified categories. Accepts a comma-separated list of category slugs. See the category API below to retrieve the full list of categories.
provider_slugs Only return deals from the specified providers. Accepts a comma-separated list of providers slugs. See the provider API below to retrieve a full list of providers.
updated_after Return only deals that were updated after a certain time. Useful if you want to get the delta since the last time you searched. Times are in UTC. Accepts a human-readable ISO 8601 string.
page Results page to return, defaults to 1.
per_page Number of results to include per page, defaults to 10 and has a maximum of 100.
order Optionally order the deals by attributes: number_sold, price, value, expires_at, updated_at and commission. Use descending order by adding the suffix _desc (e.g., price_desc). When searching using the location parameter you can also order results ascending by distance. By default, results come back in order of relevance by query and location.
split_options Optional parameter to specify that you want each deal option to be returned as a separate deal. For example, a deal with a '2 nights' and a '3 nights' option will be returned as two separate deals. By default this is set to false.

Response

                            
{
  "query": {
    "total": 23,
    "page": 1,
    "per_page": 1,
    "query": "training",
    "location": {
      "latitude": 39.151958,
      "longitude": -84.477405
    },
    "radius": 10
  },
  "deals": [
    {
      "deal": {
        "id": 245099,
        "title": "Three or Six 60-Minute Personal Training Sessions for One or Two...",
        "description": "Choose from Four Options $45 for three 60-minute personal...",
        "fine_print": "Limit 1 per person, may buy 1 additional as gift. Valid only...",
        "number_sold": 0,
        "url": "https://api.discountapi.com/v2/deals/245099/click",
        "price": 45,
        "value": 160,
        "discount_amount": 115,
        "discount_percentage": 0.71875,
        "provider_name": "Sample Provider",
        "provider_slug": "sample_provider",
        "category_name": "Personal Training",
        "category_slug": "personal-training",
        "image_url": "https://api.discountapi.com/v2/deals/245099/image",
        "online": false,
        "expires_at": "2018-06-16 00:00:00",
        "created_at": "2018-02-16 17:14:55",
        "updated_at": "2018-02-16 17:14:55",
        "merchant": {
          "id": 148546,
          "name": "JBM Elite Personal Training",
          "address": "2739 West McMicken Avenue",
          "locality": "Cincinnati",
          "region": "OH",
          "postal_code": "45225",
          "country": "US",
          "latitude": 39.1315994,
          "longitude": -84.5304956
        }
      }
    }
  ]
}
                            
                        

Retrieving a single deal

GET https://api.discountapi.com/v2/deals/:id

Response

                            
{
  "deal": {
    "id": 245099,
    "title": "Three or Six 60-Minute Personal Training Sessions for One or Two...",
    "description": "Choose from Four Options $45 for three 60-minute personal...",
    "fine_print": "Limit 1 per person, may buy 1 additional as gift. Valid only...",
    "number_sold": 0,
    "url": "https://api.discountapi.com/v2/deals/245099/click",
    "price": 45,
    "value": 160,
    "discount_amount": 115,
    "discount_percentage": 0.71875,
    "provider_name": "Sample Provider",
    "provider_slug": "sample_provider",
    "category_name": "Personal Training",
    "category_slug": "personal-training",
    "image_url": "https://api.discountapi.com/v2/deals/245099/image",
    "online": false,
    "expires_at": "2018-06-16 00:00:00",
    "created_at": "2018-02-16 17:14:55",
    "updated_at": "2018-02-16 17:14:55",
    "merchant": {
      "id": 148546,
      "name": "JBM Elite Personal Training",
      "address": "2739 West McMicken Avenue",
      "locality": "Cincinnati",
      "region": "OH",
      "postal_code": "45225",
      "country": "US",
      "latitude": 39.1315994,
      "longitude": -84.5304956
    }
  }
                                
                            

Deal image

GET https://api.discountapi.com/v2/deals/:id/image

Request parameters

Parameter Description
geometry The size and style of the image. Here are examples of the supported formats:
  • 500x200: Resize to up to 500x200 while maintaining the aspect ratio.
  • 500x200F: Force resize while ignoring the aspect ratio (may stretch the image)
  • 500x200L: Resize only if the image is at least this large (return the original if it's too small)
  • 500x200S: Resize only if the image is at least this small (return the original if it's too big)
  • 500x200C: Resize and crop if necessary to maintain aspect ratio (centre gravity)
  • 500x: Resize the width to 500 pixels, maintain aspect ratio.
  • x200: Resize the height to 200 pixels, maintain aspect ratio.
  • pixel: 1x1 transparent GIF to include for impression tracking

Response

                            
{
  "deal": {
    "id": 245099,
    "title": "Three or Six 60-Minute Personal Training Sessions for One or Two...",
    "description": "Choose from Four Options $45 for three 60-minute personal...",
    "fine_print": "Limit 1 per person, may buy 1 additional as gift. Valid only...",
    "number_sold": 0,
    "url": "https://api.discountapi.com/v2/deals/245099/click",
    "price": 45,
    "value": 160,
    "discount_amount": 115,
    "discount_percentage": 0.71875,
    "provider_name": "Sample Provider",
    "provider_slug": "sample_provider",
    "category_name": "Personal Training",
    "category_slug": "personal-training",
    "image_url": "https://api.discountapi.com/v2/deals/245099/image",
    "online": false,
    "expires_at": "2018-06-16 00:00:00",
    "created_at": "2018-02-16 17:14:55",
    "updated_at": "2018-02-16 17:14:55",
    "merchant": {
      "id": 148546,
      "name": "JBM Elite Personal Training",
      "address": "2739 West McMicken Avenue",
      "locality": "Cincinnati",
      "region": "OH",
      "postal_code": "45225",
      "country": "US",
      "latitude": 39.1315994,
      "longitude": -84.5304956
    }
  }
                                
                            

Providers

GET https://api.discountapi.com/v2/providers

Response

                            
{
  "providers": [
    {
      "provider": {
        "slug": "woot",
        "name": "Woot"
      }
    },
    // more
  ]
}
                                
                            

Categories

GET https://api.discountapi.com/v2/categories

Response

                            
{
  "categories": [
    {
      "category": {
        "slug": "product",
        "name": "Product",
        "parent_slug": null
      }
    },
    {
      "category": {
        "slug": "audio",
        "name": "Audio & Accessories",
        "parent_slug": "product"
      }
    },
    // more
  ]
}