Skip to main content

Download Scan Data

UAT token permissions

The UAT token needs to have access to the following permissions:

  • scans_download

The UAT token must be set in the header fields of all requests as described in Authentication & Tokens.

To download your Scan Data, you need to:

  1. Find the campaign ID
  2. Find the scm field keys (optional)
  3. Filter the scans: based on a time-range, †ags or SCM fields
  4. Download the scans in CSV format

Find your campaign ID

  1. Log on to the portal and click on CAMPAIGNS in the left hamburger menu
  2. On the campaign for which you want to download the data, click the DASHBOARD icon
  3. When the dashboard opens, the URL in the browser will show https://portal.scantrust.com/#/dashboard?tabIndex=0&campaignId=126&page=1
  4. The campaign-id needed is in the parameter campaignId

Find your campaign SCM Field Keys (optional)

  1. Log on to the portal and click on CAMPAIGNS in the left hamburger menu
  2. On the campaign for which you want to download the data, click the OPTION SPANEL icon
  3. Click the SCM T&T tab
  4. From the right pabel, copy the keys of each of the active fields (in brackets behind the label).
  5. Use these keys to filter the scan-results if required

Filter the scans

All of the filters used in the dashboard can also be user to filter the scans downloadsd. Some of the options are:

  • time-range (timeframe or date_from / date_to)
  • flags (counterfeit / genuine etc.)
  • code activation status (inactive / active / blacklisted)
  • SCM fields (as defined for the campaign, for example intended_market, case_no etc.)

GET: /api/v2/dashboard/scans/

ParameterRequired?Description
campaign_idrequiredID of the campaign
timeframeoptional-1y (year), -1m (month), -1w (week)
or
date_fromoptionalISO date (ie. 2018-12-21T23:59:59.549Z)
date_tooptionalISO date (ie. 2018-12-21T23:59:59.549Z)
flagsoptionalcounterfeit,out-of-market etc.
activation_statusoptionalinactive=0, active=1, blacklisted=2
{scm field}optionalAny SCM field key/value as a filter.
productoptionalproduct ID (not SKU)

Examples

Show all scans for campaign 195 which were flagged out-of-market and which have intended_market set to "China" (Zh):

/api/v2/dashboard/scans/?campaign=195&flags=out-of-market&limit=2000&offset=0&scm_intended_market=zh&timeframe=-1m

Show all scans for campaign 195 made between 2021-01-31 and 2021-05-18 for product 332:

/api/v2/dashboard/summary/?campaign=195&date_from=2021-01-31T16:00:00.000Z&date_to=2021-05-18T15:59:59.000Z&flags=&product=332

Show all scans for campaign 195 made in the past year which were for codes which are inactive (activation_status=0):

/v2/dashboard/summary/?activation_status=0&campaign=543&timeframe=-1y

Response (200): Status OK

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"uuid": "4ca631eb-d68a-40ec-8b24-17026f28df3b",
"utid": "e586c198-871f-11eb-a6d6-fa3f7f318d1b",
"user_id": null,
"user": {
"first_name": null,
"last_name": null,
"email": null
},
"install_id": null,
"consumer_email": "",
"app": "other",
"reason": "query",
"result": "ok",
"auth_failure_mode": "",
"is_blacklisted": false,
"status": "third-party",
"creation_date": "2021-03-17T12:54:23.219715Z",
"scan_timestamp": "2021-03-17T12:54:23.219715Z",
"mobile_scan_timestamp": null,
"device": {
"model": "IPHONE",
"model_name": "iPhone",
"os": "ios",
"brand": "Apple"
},
"scm_data": {
"tbox": "763C950618043SMPHGF3S4F94A13BE5",
"reel_id": "1",
"rcontainer": "C1",
"factory_date": "10/1/18",
"rza_test_run": "TR1",
"intended_market": "us",
"production_date": "1/1/18",
"shipment_number": "ship_1"
},
"country_name": "South Korea",
"country_code": "KR",
"province_name": "Seoul",
"city": "Seoul",
"lat": 37.5985,
"lng": 126.9783,
"serial_number": "EDZDSAEY",
"product_id": 1919,
"product_sku": "SS001",
"product_name": "SantiagoShoes2017",
"product_image": "c/446/product/blob-tjyztv.png",
"code_id": 7519082,
"code_message": "1CE523C048043SMPHGF3SF544215B1C",
"activation_status": 1,
"blacklist_reason": 0,
"computed_status": "verified",
"classification": 1,
"flags": []
}
]
}

There are several sections in the json; for a glossary of all the scan results fields see Scan Data Glossary

GET: /api/v2/dashboard/scans/csv

Retrieves a CSV-version of the scan-data.

Note: All parameters and filters applicable to /api/v2/dashboard/scans/ are identical (see above)

The response will be formatted as comma-separated non-quoted CSV with header. For an example see below.

There are several sections of the CSV which are broken up with dot-notation, for example: scan.computed, code.extended_id, etc. For a glossary of all the scan results fields see Scan Data Glossary

Response (200): Status OK

Example CSV:

scan.uuid,scan.datetime,scan.timestamp,scan.app,scan.reason,scan.result,scan.computed_status,scan.auth_failure_mode,scan.flags,scan.unique_user,scan.install_id,scan.utid,user.email,code.extended_id,code.serial_number,code.activation_status,code.blacklist_reason,product.id,product.sku,product.name,product.brand_name,device.imei,device.model,device.model_name,device.os,location.method,location.country_code,location.country,location.province,location.city,location.lat,location.lng,scm.case_number,scm.consumed_date,scm.distributor,scm.entry_port,scm.factory_date,scm.intended_market,scm.pallet_number,scm.production_batch,scm.production_date,scm.production_line,scm.qa_inspector,scm.rcontainer,scm.reel_id,scm.rfid,scm.rza_test_run,scm.sell_by_date,scm.shipment_number,scm.tbox
c08af33c-720b-4a3f-a89f-0f86f39d5152,2021-04-14T09:30:36.531580Z,1618392636,other,query,ok,failure,,blacklisted,118901e4-9d04-11eb-a54f-fa97856bd60e,,118901e4-9d04-11eb-a54f-fa97856bd60e,,B84EC06A80061SA7842119AA,GN3NYVYR,2,4,2017,12345678901234,SmartMilk ELN,SmartMilk,,MAC,other,other,ip_address,HK,Hong Kong,Central,Central,22.2795000,114.1460000,,,,,,,,,,,,,,,,,,
4ca631eb-d68a-40ec-8b24-17026f28df3b,2021-03-17T12:54:23.219715Z,1615985663,other,query,ok,verified,,,e586c198-871f-11eb-a6d6-fa3f7f318d1b,,e586c198-871f-11eb-a6d6-fa3f7f318d1b,,1CE523C048043SMPHGF3SF544215B1C,EDZDSAEY,1,0,1919,SS001,SantiagoShoes2017,JJ,,IPHONE,iPhone,ios,ip_address,KR,South Korea,Seoul,Seoul,37.5985000,126.9783000,,,,,10/1/18,us,,,1/1/18,,,C1,1,,TR1,,ship_1,763C950618043SMPHGF3S4F94A13BE5