CopyHero

Get Store Revenue

GET
/api/v1/analytics/store-revenue

Authorization

HTTPBearer
headerAuthorizationBearer <token>

Query Parameters

date_from*Date From

First shop calendar day of the period (inclusive).

Formatdate
date_to*Date To

Last shop calendar day of the period (inclusive); at most tomorrow (UTC); the period is at most 366 days inclusive.

Formatdate
currency?|

Currency to convert all stores into; defaults to the organization's default currency, else the most common shop currency.

store_ids?array<integer>|

Only these organization stores; an unknown, foreign or deleted id answers 404. Repeated values: ?store_ids=12&store_ids=17

tags?array<string>|

Only sales of linked products with any of these tags (OR within field)

vendor?array<string>|

Only sales of linked products with any of these vendors (OR within field)

product_type?array<string>|

Only sales of linked products with any of these product types (OR within field)

include_costs?Include Costs

Add the costs block (CJ supplier costs: product and shipping, see costs.state).

Defaultfalse
subtract_refunds?Subtract Refunds

Subtract refunds (RETURN sales) on the day of the refund. False: RETURN sales count in no amount; orders and units are unchanged.

Defaulttrue
include?array<>

Components counted in net besides products. Repeated values: ?include=shipping&include=tip. Ignored with a product filter. components always carries all of them.

Default[]

Response Body

Successful Response

application/json
  1. response

Net revenue of the filtered stores in the period, converted into currency at today's rate.

currency*|null
currency_options*array<>
kpis*
stores*array<>
components_series*array<>

Per bucket start (as stores[].series), components summed over all filtered stores; no per-store series.

bucket*Bucket

Bucket size of every stores[].series and of costs.series: the finest of hour, day, week with at most 200 buckets in the period.

Value in"hour""day""week"
costs_connected*Costs Connected

The organization has a supplier connection with status active.

costs?|

Only with include_costs.

Example Request
curl -X GET 'https://app.copyhero.app/api/v1/analytics/store-revenue?date_from=2019-08-24&date_to=2019-08-24'
Example Response
{  "currency": "AED",  "currency_options": [    "AED"  ],  "kpis": {    "current": {      "net": "string",      "components": {        "property1": "string",        "property2": "string"      },      "orders": 0,      "units": 0,      "average_order_value": "string"    },    "previous": {      "net": "string",      "components": {        "property1": "string",        "property2": "string"      },      "orders": 0,      "units": 0,      "average_order_value": "string"    },    "forecast": {      "net": "string",      "orders": 0,      "units": 0    }  },  "stores": [    {      "store_id": 0,      "status": "backfilling",      "data_since": "2019-08-24",      "net": "string",      "components": {        "property1": "string",        "property2": "string"      },      "series": [        {          "start": "2019-08-24T14:15:22Z",          "net": "string",          "forecast_net": "string"        }      ]    }  ],  "components_series": [    {      "start": "2019-08-24T14:15:22Z",      "components": {        "property1": "string",        "property2": "string"      }    }  ],  "bucket": "hour",  "costs_connected": true,  "costs": {    "state": "available",    "kpis": {      "current": {        "product_cost": "string",        "shipping_cost": "string",        "unpaid_product_cost": "string",        "orders_cost_missing": 0      },      "previous": {        "product_cost": "string",        "shipping_cost": "string",        "unpaid_product_cost": "string",        "orders_cost_missing": 0      }    },    "series": [      {        "start": "2019-08-24T14:15:22Z",        "product_cost": "string",        "shipping_cost": "string"      }    ],    "last_synced_at": "2019-08-24T14:15:22Z",    "stores_without_supplier_shop": [      {        "store_id": 0,        "name": "string",        "handle": "string"      }    ],    "supplier_store_ids": [      0    ],    "costs_since": "2019-08-24"  }}