Receipts
A service which allows to manage user receipts. All Receipts endpoints have path prefix /receipts-service.
Get receipt
Get user receipt list.
GET /receipts-service/user/receipt
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
chunk_id | string | Chunk Id |
Example Response
{
"receipts": [
{
"accuracy": "14,4549999237061",
"client_ip": "127.0.0.1",
"latitude": "-37838100",
"location_name": "Super store location",
"longitude": "144974760",
"receipt": [
"https://dev-cdn.shping.com/2019/1/28/5efe62a4-db8c-47ab-94ea-3f43e8cd62e7.jpg"
],
"receipt_id": "90c30fd6-0fd4-4161-aec4-6b8370525472",
"store_id": "Super store id",
"ts": "2019-06-11T20:25:14.703Z"
}
],
"next": "urn:authenticateit:receipts_chunk:7501d972-fe16-42ea-974b-a9d484fa3dae"
}
Add new receipt
Add new user receipt information.
POST /receipts-service/user/receipt
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
accuracy | string | Required: Accuracy |
longitude | string | Required: Longitude |
latitude | string | Required: Latitude |
receipt | array | Required: Array of images links |
store_id | string | Required: Store ID |
location_name | string | Required: Store name |
country_iso | string | Country ISO code |
Example body
{
"accuracy": "14,4549999237061",
"longitude": "144974757",
"latitude": "-37838094",
"receipt": [
"https://dev-cdn.shping.com/2019/1/28/5efe62a4-db8c-47ab-94ea-3f43e8cd62e7.jpg"
],
"store_id": "53ehdb5e67e67",
"location_name": "Store name",
"country_iso": "036"
}
Example Response
{
"id": "e2af5961-e74d-41ca-a998-a782a7a90807"
}
Delete receipt
Delete user receipt.
DELETE /receipts-service/user/receipt/:id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
id | string | user receipt id (guid) |
Example Response
{
"result": "ok"
}
List receipt groups
Get user receipt groups.
GET /receipts-service/user/groups
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
Example Response
{
"result": [
{
"name": "!Need attention",
"type": "need_attention",
"image": null,
"count": 1
},
{
"retailer_id": "coles",
"name": "coles",
"type": "retailer",
"image": "https://dev-cdn.shping.com/2022/1/25/0fedebb2-6542-450d-ab40-dba37f6a59fd.png",
"count": 1
},
{
"name": "Other",
"type": "other",
"image": null,
"count": 113
}
],
"total": 115
}
List actions
Get user actions
GET /receipts-service/user/actions
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
action | query | Optional: (String) Actions type |
Action types = ['need_attention']
Example request
```http request GET 'receipts-service/user/actions?action=need_attention'
##### Example Response
```json
{
"set_retailers": 0,
"set_products": 1,
"total": 1
}
Search receipts
POST /receipts-service/user/search
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
search_query | body | Optional: (String) |
status | body | Optional: (List) Enum |
retailer | body | Optional: (String) * is for all even not supported retailers |
page | body | Optional: (Int) default 0 |
page_size | body | Optional: (Int) default 10 |
Statuses:
- INITIAL,
- SET_RETAILERS,
- SET_RETAILERS_PENDING,
- SET_PRODUCTS,
- SET_PRODUCTS_PENDING, COMPLETED,
- FAILED,
- UNRECOGNIZED
Example request body
{
"search_query": "Health &",
"retailer": "coles"
}
Example Response
{
"receipts": [
{
"id": "14a0131d-3375-428e-b46a-db702ce3d953",
"images": [
"https://dev-cdn.shping.com/2022/3/11/c0695af7-0b15-4108-a880-7d317a8ee54b.jpg"
],
"ts": "2022-03-11T04:27:57.003Z",
"updated_at": "2022-03-11T04:29:40.000Z",
"status": "FAILED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 410000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 41220000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 410000000000000000
},
{
"id": "95bd278a-b4b6-4659-9885-dcbd5b16105d",
"images": [
"https://dev-cdn.shping.com/2022/3/11/aa821a2f-04da-4095-9ffc-a66a2b76c1fa.jpg"
],
"ts": "2022-03-11T03:44:56.399Z",
"updated_at": "2022-03-11T04:25:00.000Z",
"status": "FAILED",
"retailer_id": "coles",
"retailer_name": "Import participant Coles",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 410000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 41270000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 410000000000000000
},
{
"id": "2abb7c58-f780-431a-81d6-84b4de97c74d",
"images": [
"https://dev-cdn.shping.com/2022/3/10/2ba96e24-4409-4144-95fd-e4e9c40e4a23.jpg"
],
"ts": "2022-03-10T22:26:13.279Z",
"updated_at": "2022-03-11T03:35:11.000Z",
"status": "UNRECOGNIZED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 400000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 40220000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 400000000000000000
},
{
"id": "fc636193-6a57-4ac9-85b6-df2caf0e76b1",
"images": [
"https://dev-cdn.shping.com/2022/3/9/42204e0d-f645-42f5-a94f-f0623f86bedf.jpg"
],
"ts": "2022-03-09T00:03:01.158Z",
"updated_at": "2022-03-11T03:43:31.000Z",
"status": "UNRECOGNIZED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 420000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 42760000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 420000000000000000
},
{
"id": "93b31056-e520-4186-8d2c-aebd28ef9dc0",
"images": [
"https://dev-cdn.shping.com/2022/2/4/22aa2cb5-e611-40b8-9d5b-ca79f6a932f4.jpg",
"https://dev-cdn.shping.com/2022/2/4/78bf3ad2-ebf1-45f1-b385-52f0d5f179be.jpg",
"https://dev-cdn.shping.com/2022/2/4/2e250222-39c3-4c08-9277-efd56bd31949.jpg"
],
"ts": "2022-02-04T09:09:54.994Z",
"updated_at": "2022-02-28T23:07:40.000Z",
"status": "FAILED",
"country": "051",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 350000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 35720000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 350000000000000000
},
{
"id": "fc118357-2d89-4b6a-aed7-e3d454aa8d51",
"images": [
"https://dev-cdn.shping.com/2022/2/4/f37c2d81-ddf3-4f0e-87a4-7caf527bc77d.jpg"
],
"ts": "2022-02-04T08:05:38.431Z",
"updated_at": "2022-02-04T08:07:40.000Z",
"status": "FAILED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 360000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 36090000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 360000000000000000
},
{
"id": "955b3ea4-720b-43fb-955c-408880534e93",
"images": [
"https://dev-cdn.shping.com/2022/2/4/18e6a29d-31e4-4345-af45-e4407368a266.jpg"
],
"ts": "2022-02-04T07:59:21.815Z",
"updated_at": "2022-02-04T08:01:10.000Z",
"status": "FAILED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 360000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 36180000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 360000000000000000
},
{
"id": "9777b490-b6c4-401a-ba20-7139d7627517",
"images": [
"https://dev-cdn.shping.com/2022/2/4/e2e73786-3726-4529-b864-319d9a023825.jpg"
],
"ts": "2022-02-04T07:49:43.049Z",
"updated_at": "2022-02-04T07:51:30.000Z",
"status": "FAILED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 360000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 36180000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 360000000000000000
},
{
"id": "316196a8-9f77-43d9-9645-4ac68dedabef",
"images": [
"https://dev-cdn.shping.com/2022/2/4/43a12015-2feb-4c79-8ce3-dcafe52350ec.jpg"
],
"ts": "2022-02-04T07:30:06.469Z",
"updated_at": "2022-02-04T07:32:10.000Z",
"status": "FAILED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 360000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 36360000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 360000000000000000
},
{
"id": "58809364-8fea-49f1-b2c5-1cb518f7f3cc",
"images": [
"https://dev-cdn.shping.com/2022/2/4/3134111a-0e16-48ab-8be7-ea8a7cff1725.jpg"
],
"ts": "2022-02-04T07:19:30.892Z",
"updated_at": "2022-02-04T07:21:10.000Z",
"status": "FAILED",
"country": "036",
"ocr_done": 1,
"recognized_items": 0,
"unrecognized_items": 0,
"non_partner_brand_product_coins": 360000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 36360000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": 360000000000000000
}
],
"total": 132
}
List retailer receipts
POST /receipts-service/retailer/:retailer_id/list
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
retailer_id | params | Required: Retailer id |
user_id | body | Optional: User id filter |
receipt_code | body | Optional: Receipt unique number (field printed on receipt) |
receipt_uploaded_ts_from | body | Optional: upload date |
receipt_uploaded_ts_from | body | Optional: |
receipt_ts_from | body | Optional: timestamp printed on receipt |
receipt_ts_to | body | Optional: |
status | body | Optional: Array of statuses |
gtin | body | Optional: Gtin of recognised products on receipt |
total_from | body | Optional: |
total_to | body | Optional: |
page | body | Optional: default 0 |
page_size | body | Optional: default 10 |
sort_by | body | Optional: Object field, order |
User have to be system Statuses:
- INITIAL,
- SET_RETAILERS,
- SET_RETAILERS_PENDING,
- SET_PRODUCTS,
- SET_PRODUCTS_PENDING,
- COMPLETED,
- FAILED,
- UNRECOGNIZED,
- HIDDEN Sort by fields
- issued_at (date on receipt)
- ts (upload date)
- receipt_code
- status
- total
- user_id Order
- ASC
- DESC
Example request body
{
"receipt_code": "n1",
"page_size": 2,
"sort_by": {
"field": "status",
"order": "DESC"
}
}
Example Response
{
"total": 203,
"receipts": [
{
"id": "urn:authenticateit:user:username:1@3a7a4c1b-0afe-40cd-b3aa-e0552bd7b9b2",
"image": [
"https://dev-cdn.shping.com/2022/1/15/86025595-5781-4994-91e1-f9eebcf31892"
],
"issued_at": "2019-10-25T00:00:00Z",
"uploaded_at": "2022-01-15T13:18:23.547Z",
"products": 0,
"recognised": 0,
"receipt": "n1",
"status": "HIDDEN",
"retailer": "coles",
"total": "999909",
"user": "urn:authenticateit:user:username:1"
},
{
"id": "urn:authenticateit:user:username:1@48c118ac-34bf-46a9-b380-ba2e9f7dbb3d",
"image": [
"https://dev-cdn.shping.com/2022/4/26/4f68ad24-2a56-497b-ae96-416ba71e9a7b.jpg"
],
"issued_at": "2019-10-25T00:00:00Z",
"uploaded_at": "2022-04-26T06:41:03.959Z",
"products": 0,
"recognised": 0,
"receipt": "n1",
"status": "HIDDEN",
"retailer": "coles",
"total": "9999.09",
"user": "urn:authenticateit:user:username:1"
}
]
}
List receipts
POST /receipts-service/receipts/search
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
retailer_id | body | Optional: Retailer id |
user_id | body | Optional: User id filter |
receipt_code | body | Optional: Receipt unique number (field printed on receipt) |
receipt_uploaded_ts_from | body | Optional: upload date |
receipt_uploaded_ts_from | body | Optional: |
receipt_ts_from | body | Optional: timestamp printed on receipt |
receipt_ts_to | body | Optional: |
status | body | Optional: Array of statuses |
gtin | body | Optional: Gtin of recognised products on receipt |
total_from | body | Optional: |
total_to | body | Optional: |
page | body | Optional: default 0 |
page_size | body | Optional: default 10 |
sort_by | body | Optional: Object field, order |
Statuses:
- INITIAL,
- SET_RETAILERS,
- SET_RETAILERS_PENDING,
- SET_PRODUCTS,
- SET_PRODUCTS_PENDING,
- COMPLETED,
- FAILED,
- UNRECOGNIZED,
- HIDDEN Sort by fields
- issued_at (date on receipt)
- ts (upload date)
- receipt_code
- status
- total
- user_id Order
- ASC
- DESC
Example request body
{
"receipt_code": "n1",
"page_size": 2,
"sort_by": {
"field": "status",
"order": "DESC"
}
}
Example Response
{
"total": 203,
"receipts": [
{
"id": "urn:authenticateit:user:username:1@3a7a4c1b-0afe-40cd-b3aa-e0552bd7b9b2",
"image": [
"https://dev-cdn.shping.com/2022/1/15/86025595-5781-4994-91e1-f9eebcf31892"
],
"issued_at": "2019-10-25T00:00:00Z",
"uploaded_at": "2022-01-15T13:18:23.547Z",
"case_number": null,
"case_id": null,
"case_status": null,
"rule_id": null,
"rule_name": null,
"products": 0,
"recognised": 0,
"receipt": "n1",
"status": "HIDDEN",
"retailer": "coles",
"total": "999909",
"user": "urn:authenticateit:user:username:1"
},
{
"id": "urn:authenticateit:user:username:1@48c118ac-34bf-46a9-b380-ba2e9f7dbb3d",
"image": [
"https://dev-cdn.shping.com/2022/4/26/4f68ad24-2a56-497b-ae96-416ba71e9a7b.jpg"
],
"issued_at": "2019-10-25T00:00:00Z",
"uploaded_at": "2022-04-26T06:41:03.959Z",
"products": 0,
"recognised": 0,
"receipt": "n1",
"status": "HIDDEN",
"retailer": "coles",
"total": "9999.09",
"user": "urn:authenticateit:user:username:1"
}
]
}
Get retailer receipt
POST /receipts-service/retailer/:retailer_id/:id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
retailer_id | params | Required: Retailer id |
id | params | Optional: receipt id |
User have to be system
Example Response
{
"analyzed": {
"analyzed_receipt": {
"accuracy_rate": 0.8093153238296509,
"barcode": "5541017680441",
"data": {
"computed_total": "5.99",
"links": [
"https://i.imgur.com/c8O0Be6.jpg"
],
"prices": [
{
"gtin": "9311995843710",
"name": "A4 COPY PAPER 500 SHEETS",
"price": 5.99,
"quantity": 1,
"unit": "each",
"value": 5.99
}
],
"store": "rejectshop",
"tax": "0.54",
"total": "5.99",
"ts": "2022-09-15T05:52:46.223Z"
},
"id": "urn:authenticateit:user:email:email@mail.com@analyzed_receipts@ae115e12-4033-463f-a180-3287c08781af",
"merch_id": null,
"ocr_hash": "2df10655f8b4941bd55a156881d19a09d75983bd",
"parsed_receipt_id": "7250lane 131082022",
"postcode": "7250",
"receipt_barcode": "7713019112390",
"receipt_code": "7250lane 131082022",
"receipt_date": "31/08/2022",
"receipt_id": "ae115e12-4033-463f-a180-3287c08781af",
"receipt_number": "7250lane 131082022",
"receipt_time": "10:55:08",
"receipt_ts": "2022-08-31T10:55:08Z",
"receipt_ts_utc": "2022-08-31T00:55:08Z",
"retailer": "rejectshop",
"retailer_store_id": "7250",
"status": "completed",
"term_id": "lane 1",
"ts": "2022-09-15T05:52:46.223Z",
"user_id": "urn:authenticateit:user:email:email@mail.com",
"words_count": 149
},
"chunk_id": "urn:authenticateit:user:email:email@mail.com@receipts",
"limits": {
"from_ts": "2022-09-14T22:00:00Z",
"limit_coins": "0",
"sum_coins": "0",
"to_ts": "2022-09-15T21:59:59Z"
},
"non_partner_brand_product_coins": 550000000000000000,
"non_partner_brand_product_coins_earned": 0,
"partner_brand_product_coins": 55040000000000000000,
"partner_brand_product_coins_earned": 0,
"pending_coins": "550000000000000000",
"receipt": {
"accuracy": "14,4549999237061",
"client_ip": "10.0.0.5",
"country_iso": "036",
"hash": "2df10655f8b4941bd55a156881d19a09d75983bd",
"issued_at": "2020-12-08T00:00:00Z",
"latitude": "-37838094",
"location_name": "Store name",
"longitude": "144974757",
"ocr_done": true,
"ocr_status": "success",
"postcode": null,
"receipt": [
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/ReceiptSwiss.jpg/250px-ReceiptSwiss.jpg"
],
"receipt_code": null,
"receipt_id": "ae115e12-4033-463f-a180-3287c08781af",
"retailer_id": "woolworths",
"retailer_name": "Woolworths",
"status": 7,
"store_id": "2566",
"tax": null,
"total": 0,
"ts": "2022-05-24T18:35:11.490Z",
"updated_at": "2022-08-02T00:03:00Z"
}
},
"ocr": {}
}
Retrieve Conditions Schema
This endpoint provides the schema for setting alert conditions in the receipts service.
GET /receipts-service/alerts/conditions
Headers
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Example Response
{
"data": {
"schema": [
{
"property": "MATCH_RECEIPT_GTINS_COUNT",
"operators": [
"EQ",
"GT",
"LT",
"NE"
]
}
]
}
}
Retrieve Alert Rules
This endpoint fetches the list of alert rules configured within the receipts service. Alert rules contain conditions that determine specific actions.
GET /receipts-service/alerts/rules
Headers
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Optional Parameters
Name | Type | Description |
---|---|---|
page |
int | Page index to retrieve |
pageSize |
int | Number of items per page |
Response Attributes
Attribute | Type | Description |
---|---|---|
page_size |
int | The size of the returned page |
page |
int | Current page index |
total_pages |
int | Total number of available pages |
total_count |
int | Total number of available rules |
rules |
array of objects | Array containing individual rule objects |
Rule Object Attributes
Attribute | Type | Description |
---|---|---|
created_at |
string (date) | Rule creation timestamp |
created_by |
string | Identifier of the user who created the rule |
type |
string | Type of rule (e.g., receipts_alert_rule ) |
rule_name |
string | Name of the rule |
conditions |
array of objects | Array of conditions for the rule |
status |
string | Rule status (active/inactive) |
priority |
int | Rule priority level |
karma_value |
int | Rule karma value |
action |
string | Rule action (e.g., moderate ) |
Example Response
{
"data": {
"page_size": 10,
"page": 0,
"total_pages": 1,
"total_count": 2,
"rules": [
{
"created_at": "2023-07-17T14:46:55.810Z",
"created_by": "urn:authenticateit:user:username:shping:5e873b3d-2550-4f9f-b72b-b1f3ce56646c",
"type": "receipts_alert_rule",
"rule_name": "Test Rule",
"conditions": [
{
"property": "USER_REGISTRATION",
"operator": "GT",
"value": "2023-07-14T04:56:11+1000"
},
{
"property": "TIME",
"operator": "GT",
"value": "01:33"
},
{
"property": "ITEMS_QUANTITY",
"operator": "EQ",
"value": 1
},
{
"property": "USER_LEVEL",
"operator": "EQ",
"value": "basic"
}
],
"status": "inactive",
"priority": 1,
"karma_value": 0,
"action": "moderate"
}
]
}
}
Retrieve Alert Rule by ID
This endpoint retrieves the details of a specific alert rule identified by its _id
. The rule contains conditions that trigger specific actions.
GET /receipts-service/alerts/rules/{rule_id}
Headers
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Request Body Parameters
Name | Type | Description |
---|---|---|
id |
String | Required: Rule ID |
Response Attributes
Attribute | Type | Description |
---|---|---|
created_at |
string (date) | Rule creation timestamp |
created_by |
string | Identifier of the user who created the rule |
type |
string | Type of rule (e.g., receipts_alert_rule ) |
rule_name |
string | Name of the rule |
conditions |
array of objects | Array of conditions for the rule |
status |
string | Rule status (active/inactive) |
priority |
int | Rule priority level |
karma_value |
int | Rule karma value |
action |
string | Rule action (e.g., moderate ) |
Example Response
{
"data": {
"created_at": "2023-07-17T14:46:55.810Z",
"created_by": "urn:authenticateit:user:username:shping:5e873b3d-2550-4f9f-b72b-b1f3ce56646c",
"type": "receipts_alert_rule",
"rule_name": "Test Rule",
"conditions": [
{
"property": "USER_REGISTRATION",
"operator": "GT",
"value": "2023-07-14T04:56:11+1000"
},
{
"property": "TIME",
"operator": "GT",
"value": "01:33"
},
{
"property": "ITEMS_QUANTITY",
"operator": "EQ",
"value": 1
},
{
"property": "USER_LEVEL",
"operator": "EQ",
"value": "basic"
}
],
"status": "inactive",
"priority": 1,
"karma_value": 0,
"action": "moderate"
}
}
Create Alert Rule
This endpoint allows you to create a new alert rule. The rule can be customized by setting various conditions, actions, and priorities.
POST /receipts-service/alerts/rules
Headers
Name | Type | Description |
---|---|---|
content-type |
Header | Required: application/json |
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Request Body Parameters
Parameter | Type | Description |
---|---|---|
rule_name |
string | Name of the rule |
conditions |
array of objects | Array of conditions for the rule |
status |
string | Rule status (active/inactive) |
priority |
int | Rule priority level |
action |
string | Rule action (e.g., moderate ) |
description |
string | Rule description |
Response Attributes
Attribute | Type | Description |
---|---|---|
_id |
string | Rule identifier |
created_at |
string (date) | Rule creation timestamp |
created_by |
string | Identifier of the user who created the rule |
type |
string | Type of rule (e.g., receipts_alert_rule ) |
rule_name |
string | Name of the rule |
conditions |
array of objects | Array of conditions for the rule |
status |
string | Rule status (active/inactive) |
priority |
int | Rule priority level |
karma_value |
int | Rule karma value |
action |
string | Rule action (e.g., moderate ) |
description |
string | Rule description |
Example Response
{
"data": {
"rule": {
"_id": "urn:authenticateit:receipts:alerts:rule:e265f830-ac73-4fbc-9b41-449e4404bf2d",
"created_at": "2023-07-19T07:49:45.570Z",
"created_by": "urn:authenticateit:user:username:1",
"type": "receipts_alert_rule",
"rule_name": "API test by Jared",
"conditions": [
{
"property": "USER_REGISTRATION",
"operator": "GT",
"value": "2023-07-14T04:56:11+1000"
}
],
"status": "inactive",
"priority": 1,
"karma_value": 0,
"action": "moderate",
"description": "Jared API test"
}
}
}
Update Alert Rule
This endpoint allows you to update an existing alert rule based on its identifier. You can modify its name, conditions, status, priority, and action.
PUT /receipts-service/alerts/rules/{rule_id}
Headers
Name | Type | Description |
---|---|---|
content-type |
Header | Required: application/json |
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Request Body Parameters
Parameter | Type | Description |
---|---|---|
rule_name |
string | Name of the rule |
conditions |
array of objects | Array of conditions for the rule |
status |
string | Rule status (active/inactive) |
priority |
int | Rule priority level |
action |
string | Rule action (e.g., moderate ) |
description |
string | Rule description |
Response Attributes
Attribute | Type | Description |
---|---|---|
_id |
string | Rule identifier |
_rev |
string | Revision identifier |
created_at |
string (date) | Rule creation timestamp |
created_by |
string | Identifier of the user who created the rule |
updated_at |
string (date) | Rule update timestamp |
updated_by |
string | Identifier of the user who updated the rule |
type |
string | Type of rule (e.g., receipts_alert_rule ) |
rule_name |
string | Name of the rule |
conditions |
array of objects | Array of conditions for the rule |
status |
string | Rule status (active/inactive) |
priority |
int | Rule priority level |
karma_value |
int | Rule karma value |
action |
string | Rule action (e.g., moderate ) |
description |
string | Rule description |
Example Response
{
"data": {
"rule": {
"created_at": "2023-07-19T07:49:45.570Z",
"created_by": "urn:authenticateit:user:username:1",
"updated_at": "2023-07-19T07:54:15.820Z",
"updated_by": "urn:authenticateit:user:username:1",
"type": "receipts_alert_rule",
"rule_name": "API test by Jared",
"conditions": [
{
"property": "USER_REGISTRATION",
"operator": "GT",
"value": "2023-07-14T04:56:11+1000"
}
],
"status": "inactive",
"priority": 1,
"karma_value": 0,
"action": "moderate",
"description": "Jared API test"
}
}
}
Delete Alert Rule
This endpoint allows you to delete an existing alert rule by its identifier.
DELETE /receipts-service/alerts/rules/urn:authenticateit:receipts:alerts:rule:e265f830-ac73-4fbc-9b41-449e4404bf2d \
Headers
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Response Attributes
Attribute | Type | Description |
---|---|---|
success |
boolean | Indicates whether the operation was successful |
message |
string | Message indicating the result of the delete operation |
Example Response
{
"data": {
"success": true,
"message": "Rule with ID urn:authenticateit:receipts:alerts:rule:e265f830-ac73-4fbc-9b41-449e4404bf2d successfully deleted."
}
}
List Receipt Cases
This endpoint allows you to retrieve a list of receipt cases based on the specified filters.
GET /receipts-service/cases/
Headers
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Optional Parameters
Parameter | Type | Description |
---|---|---|
user_id |
Body | User ID for the filter |
issued_From |
Body | Start date of the receipt issuance |
issued_To |
Body | End date of the receipt issuance |
status |
Body | Status of the receipt case |
rule_id |
Body | Rule ID for filtering receipt cases |
retailer_id |
Body | Retailer ID for filtering receipt cases |
receipt_number |
Body | Receipt number for filtering receipt cases |
page |
Body | The page number |
page_size |
Body | The number of items to return per page |
Response Attributes
Attribute | Type | Description |
---|---|---|
total_pages |
int | The total number of pages |
total_count |
int | The total number of receipt cases |
id |
string | The unique identifier for the receipt case |
status |
string | The status of the receipt case |
priority |
int | The priority of the receipt case |
rule_id |
string | The rule ID related to the receipt case |
rule_name |
string | The name of the rule |
receipt |
object | Receipt details (nested object) |
user |
object | User details (nested object) |
moderator |
object | Moderator details (nested object) |
created_at |
string | The timestamp when the case was created |
updated_at |
string | The timestamp when the case was last updated |
Nested Object: receipt
Attribute | Type | Description |
---|---|---|
status |
integer | Status of the receipt |
postcode |
string | Postcode of the location |
retailer_id |
string | Retailer ID |
issued_at |
string | Issue date and time of the receipt |
items_count |
integer | Count of items in the receipt |
items_recognized_count |
integer | Count of recognized items in the receipt |
total |
string | Total price |
store_id |
string | Store ID |
Retailer |
object | Retailer details (nested object) |
Nested Object: receipt.retailer
Attribute | Type | Description |
---|---|---|
name |
string | Retailer name |
alias |
string | Retailer alias |
logo |
string | Retailer logo URL |
Nested Object: user
and moderator
Attribute | Type | Description |
---|---|---|
first_name |
string | First name |
last_name |
string | Last name |
photo |
string | URL of the user's photo |
email |
string | Email of the user |
Example Response
{
"data": {
"total_pages": null,
"cases": [
{
"id": "urn:authenticateit:receipts:alerts:case:16a5b594-ceaf-47be-bc97-7dc929983553",
"status": "moderate",
"priority": 1,
"rule_id": "urn:authenticateit:receipts:alerts:rule:9c2220dd-a3c7-4f00-9ffc-50f339ef6b8d",
"rule_name": null,
"receipt": {},
"user": {},
"moderator": {},
"created_at": "2023-09-11T03:20:23.000Z",
"updated_at": null
},
...
]
}
}
Validate Receipt
This endpoint allows you to validate a given receipt based on its data and attributes. It will return a task ID for the receipt validation which you can later check for status.
As a result, invalid items will create a case record in the system automatically.
POST /receipts-service/validate/
Headers
Name | Type | Description |
---|---|---|
content-type |
Header | Required: application/json |
authenticateit_identity_ticket |
Header | Required: Session's ticket |
Request Body
The request body should be a JSON object containing various receipt attributes for validation. For example, it can contain raw_time
, prices
, store
, total
, and many more attributes.
Payload Attributes
Attribute | Type | Description | Example Values |
---|---|---|---|
_id | string | The identifier for the receipt. | ocr_receipt:ae115e12-4033-463f-a180-3287c08781af |
data | object | Contains the receipt data object for validation. | ReceiptDataObject |
Receipt Data Object Attributes
Attribute | Type | Description | Example Values |
---|---|---|---|
raw_time | string | The raw time when the receipt was issued. | "12:39 am" |
prices | array | List of item data. | [ {...PriceObject} ] |
tax | number or null | The tax amount on the total purchase. | 0.50 |
store | string | The name of the store where the receipt is from. | "woolworths" |
total_items | number or null | Total number of items in the receipt. | 10 |
total | string | The total cost of the items on the receipt. | "11.56" |
computed_total | string | Calculated total cost of the items. | "11.56" |
ts | string | The timestamp for the data. | "2023-07-07T05:08:09.738Z" |
links | array |
Array of URLs, typically to images of the receipt. | ["https://cdn.shping.com/test.jpg"] |
Receipt Data Price Object Attributes
Attribute | Type | Description | Example Values |
---|---|---|---|
name | string | The name of the item. | "Turkish Loaf Garlic" |
price | number | The price of the item. | 2.16 |
quantity | number | The quantity of the item. | 1 or 1.5kg |
value | number | The total value of the item (price x quantity). | 2.16 |
unit | string | The unit for the item's quantity. | "each" (see units) |
Additional Attributes
Attribute | Type | Description | Example Values |
---|---|---|---|
retailer | string | The retailer name. | "woolworths" |
retailer_store_id | string | The retailer's store ID. | "1402" |
receipt_date | string | The date when the receipt was issued. | "2020-11-13T10:32:00Z" |
receipt_raw_date | string | The raw date in the receipt. | "13/11/2020" |
receipt_time | string | The time when the receipt was issued. | "10:32" |
... | ... | ... | ... |
Note: The above attributes are based on the example you provided and may vary depending on your specific requirements.
Note: The exact JSON schema may vary.
Response Attributes
Attribute | Type | Description |
---|---|---|
id | string | Unique identifier for the validation task |
type | string | Type of the validation task |
created_at | string | Timestamp when the validation task was created |
status | string | Status of the validation task |
Example Response
{
"data": {
"_id": "urn:authenticateit:receipts:validate:2ebe2ffd-299b-41c9-9c1d-56cd7a5099df",
"type": "receipts_validate_task",
"created_at": "2023-09-14T04:13:20.037Z",
"status": "pending"
}
}
Unit Descriptions
Unit | Full Name | Description | Common Usage |
---|---|---|---|
each |
Each | Denotes individual items that are sold as single units. | Fruits, furniture, electronics |
kg |
Kilogram | A metric unit of mass equal to 1,000 grams. Often used for heavier items. | Meat, bulk grains, vegetables |
g |
Gram | A metric unit of mass. Typically used for lighter items. | Spices, small amounts of produce |
l |
Liter | A metric unit of volume. Generally used for liquids. | Milk, juice, oil |
mg |
Milligram | A metric unit of mass equal to one thousandth of a gram. Used for very small quantities. | Nutritional supplements, medicines |
ml |
Milliliter | A metric unit of volume equal to one thousandth of a liter. Also used for very small quantities. | Small beverage bottles, liquid medicines |
Examples in Receipt Context
- Each: If you buy 2 apples, the receipt might indicate
2 each
. - Kg: If you buy 1.5 kilograms of beef, the receipt could indicate
1.5 kg
. - G: If you buy 200 grams of cheese, the receipt could indicate
200 g
. - L: If you buy a 2-liter bottle of soda, the receipt could indicate
2 l
. - Mg: If you buy a small bottle containing 500 milligrams of Vitamin C tablets, it might indicate
500 mg
. - Ml: If you buy a small 350 milliliter bottle of juice, the receipt could indicate
350 ml
.
These units help to standardize the quantities of items, which is useful for both consumers and retailers.
Manual Case Creation Endpoint Description
This endpoint allows you to manually create a new receipt case.
POST /receipts-service/cases/
Headers
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket |
Header | Required: Session's ticket |
content-type |
Header | Required: Set to application/json |
Request Parameters
Parameter | Type | Description |
---|---|---|
user_id |
JSON | Required: The user's unique identifier |
receipt_id |
JSON | Required: The receipt's unique identifier |
issued_at |
JSON | Required: The issuance date of the receipt |
status |
JSON | Required: Status of the receipt case to be created |
rule_id |
JSON | Required: The rule's unique identifier |
Response Attributes
Attribute | Type | Description |
---|---|---|
_id | string | Unique identifier of the new receipt case |
type | string | Type of case (e.g., "receipts_alert_case") |
created_at | string | Timestamp of when the case was created |
rule_id | string | Rule ID |
status | string | Case status |
priority | integer | Priority of the case |
user_id | string | User ID |
products | array | List of associated products |
receipt_id | string | Receipt ID |
receipt_number | string | Receipt number (if available) |
receipt_total | number | Total amount of the receipt |
tax | number | Tax amount |
moderated_by | array | List of moderators |