EDD REST API - Endpoints

The  EDD REST API includes six endpoints for accessing information, each for performing a specific kind of request:

  • stats - For retrieving earnings / sales stats specific dates, date ranges, and specific products.
  • products - For retrieving info about store products.
  • customers - For retrieving customer stats.
  • sales - For retrieving recent sales and info about each sale (items purchased, buyer, amount, etc).
  • discounts - For retrieving info about all available discounts.
  • download-logs - For retrieving logs of file downloads.

The endpoints are used like so:

http://example.com/edd-api/<endpoint>/

For example:

http://example.com/edd-api/sales/

When combined with the API key and token, the complete URL looks like this:

http://example.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70

Visibility

All endpoints require the API key and token except for the products endpoint. This is because products are intended to be public at all times by default.

Response Format

The response given by the EDD API is available in two formats:

To specify the format returned (jSON will be used if none is specified), simply add the  format argument to the URL:

http://yoursite.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&format=xml

A sample JSON response looks like this:

{
    "sales": [
        {
            "ID": 611,
            "subtotal": "20",
            "tax": 0,
            "fees": false,
            "total": "20",
            "gateway": "manual",
            "email": "johntest23@test.com",
            "date": "2013-02-25 11:42:05",
            "products": [
                {
                    "name": "Simple Notices Pro",
                    "price": "20",
                    "price_name": "Price one"
                }
            ]
        }
    ]
}

A sample XML response (for the same query) looks like this:

<edd>
  <sales>
    <ID>611</ID>
    <subtotal>20</subtotal>
    <tax>0</tax>
    <fees>false</fees>
    <total>20</total>
    <gateway>manual</gateway>
    <email>johntest23@test.com</email>
    <date>2013-02-25 11:42:05</date>
    <products>
      <name>Simple Notices Pro</name>
      <price>20</price>
      <price_name>Price one</price_name>
    </products>
  </sales>
</edd>

Optional URL Variables

You can add additional URL variables in order to adjust the output that is given. Here a few examples of ways you can do that.

  • Number: By default, the API will show 10 results per page, if that's what you have set under your Reading settings in WordPress. But if you want to change that for a specific API call, you can add "&number=11" to the URL to get a different number of results per page. In this example you would get 11 results.
  • Page: By default, the API will show page number 1 of results. If you want to change that for a specific API call, you can add "&page=2" to the URL to get a different page of results.