reports
3 operations
GET /v1/reportsThe tenant's public mismatch reports (staff triage)POST /v1/reports/{id}/resolveResolve a public mismatch reportGET /v1/reports/{id}One public mismatch report with its fruit's scan history (staff triage)
GET /v1/reports
The tenant's public mismatch reports (staff triage)
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: report_triage · listReports
Newest first, one page (limit, default 50, at most 200; cursor from the previous page), optionally only open or resolved ones and only one category, with the contact the visitor left (null once erased). Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant); other tenants' reports are never listed. Not audited (a read). no-store.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
statusoptional | query | "open" | "resolved" |
|
categoryoptional | query | ReportCategory | Only reports of this category (ReportCategory). |
limitoptional | query | integer | 1 to 200 (default 50). |
cursoroptional | query | string | The previous page's |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | ReportPageapplication/json | One page of reports. |
| 400 | Errorapplication/json | A bad |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Cache-Control | 200 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"items": [
{
"id": 12,
"fruit": {
"code": "Q-0928-014-0003",
"public_id": "73879f17d0930440809333f141385eb6"
},
"lot": {
"code": "LO-260928-014",
"public_id": "5d0c7a3e9b1f4a2c8e6d0b4f7a9c3e1d"
},
"category": "label_peeled",
"note": "Tem bị bóc ở cuống.",
"contact": "zalo 0901 234 567",
"status": "open",
"outcome": null,
"created_at": 1790000000.5,
"resolved_at": null
}
],
"next_cursor": null
}Response 400 · application/json · status
{
"error": "bad status",
"code": "bad_status"
}Response 400 · application/json · category
{
"error": "bad category",
"code": "bad_category"
}Response 400 · application/json · limit
{
"error": "bad limit",
"code": "bad_limit"
}Response 400 · application/json · cursor
{
"error": "bad cursor",
"code": "bad_cursor"
}Response 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Response 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/reports/{id}/resolve
Resolve a public mismatch report
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: report_triage · resolveReport
Resolves one of the tenant's open reports with an outcome, once. When it was the lot's last open report, the lot's report hold clears: the lot is recomputed right after the commit and its pages leave under_review, with at most the sealed tier. Audited (report.resolve, in the same transaction; the contact is never in the audit row). Allowed for tenant_admin and platform_admin acting for the tenant; another tenant's report answers like a missing one.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | The report id. |
Idempotency-Keyoptional | header | string | Makes a retry of this request safe (#169). A client-chosen key, 1 to 255 visible ASCII characters (a UUID is a good choice), scoped to the caller's tenant and principal (session user, API token or legacy token). The first request with a key runs; when it answers 2xx, that response (status, body and headers) is stored and replayed for 24 hours to every request with the same key and the same method, path, query and body bytes, marked |
Request body
ReportResolution (required)
Media type: application/json
Example request · application/json
{
"outcome": "unfounded"
}Responses
| Status | Type | Description |
|---|---|---|
| 200 | Reportapplication/json | The report, resolved. |
| 400 | Errorapplication/json | Invalid JSON, an unknown field or an outcome that is not one of ReportResolution's, or a bad X-Request-Id; or a malformed or repeated Idempotency-Key header. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). SELF-2-4 (#193): also company read-only while the company is leaving CropPath or has left (its records can be read and exported, not changed). |
| 404 | Errorapplication/json | No such report of this tenant (another tenant's answers like a missing one). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 409 | Errorapplication/json | The report is already resolved. Or the Idempotency-Key's first request is still running ( |
| 413 | Errorapplication/json | The request body is over 1 MiB. |
| 422 | Errorapplication/json | The Idempotency-Key was used by this principal within 24 hours with another method, path, query or body. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Idempotent-Replayed | 200 | "true" |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 409 | string | Request id: the caller's |
Retry-After | 409 | string | Seconds to wait before retrying. |
X-Request-Id | 413 | string | Request id: the caller's |
X-Request-Id | 422 | string | Request id: the caller's |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"id": 12,
"fruit": {
"code": "Q-0928-014-0003",
"public_id": "73879f17d0930440809333f141385eb6"
},
"lot": {
"code": "LO-260928-014",
"public_id": "5d0c7a3e9b1f4a2c8e6d0b4f7a9c3e1d"
},
"category": "label_peeled",
"note": "Tem bị bóc ở cuống.",
"contact": "zalo 0901 234 567",
"status": "resolved",
"outcome": "unfounded",
"created_at": 1790000000.5,
"resolved_at": 1790003600.5
}Response 400 · application/json · invalid_json
{
"error": "invalid JSON",
"code": "invalid_json"
}Response 400 · application/json · outcome
{
"error": "invalid outcome",
"code": "invalid_outcome"
}Response 400 · application/json · unknown
{
"error": "unknown fields: note",
"code": "unknown_fields"
}Response 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Response 400 · application/json · invalid_idempotency_key
{
"error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
"code": "invalid_idempotency_key"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Response 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Response 403 · application/json · company_read_only
{
"error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
"code": "company_read_only"
}Response 404 · application/json
{
"error": "not found: 12",
"code": "not_found"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 409 · application/json · report_already_resolved
{
"error": "report already resolved",
"code": "report_already_resolved"
}Response 409 · application/json · idempotency_key_in_use
{
"error": "idempotency key in use: retry later",
"code": "idempotency_key_in_use"
}Response 409 · application/json · idempotency_key_used
{
"error": "idempotency key used: the response is too large to replay",
"code": "idempotency_key_used"
}Response 409 · application/json · idempotency_key_unrecorded
{
"error": "idempotency key used: the request ran but its response was not recorded",
"code": "idempotency_key_used"
}Response 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Response 422 · application/json
{
"error": "idempotency key mismatch: the key was used with another request",
"code": "idempotency_key_mismatch"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}GET /v1/reports/{id}
One public mismatch report with its fruit's scan history (staff triage)
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: report_triage · getReport
The report as the list shows it, with the contact (null once erased), and the reported fruit's scan history (A8, #74; ReportDetail): the newest 50 scans, newest first, each its number, time, country, region, city and device class, never an address or its hash. A read with two bounded statements, not audited, no-store. Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant); another tenant's report answers like a missing one.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | The report id. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | ReportDetailapplication/json | The report and its fruit's scan history. |
| 400 | Errorapplication/json | A bad X-Request-Id. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). |
| 404 | Errorapplication/json | No such report of this tenant (another tenant's answers like a missing one). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Cache-Control | 200 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"id": 12,
"fruit": {
"code": "Q-0928-014-0003",
"public_id": "73879f17d0930440809333f141385eb6"
},
"lot": {
"code": "LO-260928-014",
"public_id": "5d0c7a3e9b1f4a2c8e6d0b4f7a9c3e1d"
},
"category": "scanned_many",
"note": "Mã đã bị quét ở nhiều nơi.",
"contact": "zalo 0901 234 567",
"status": "open",
"outcome": null,
"created_at": 1790000000.5,
"resolved_at": null,
"scans": {
"total": 4,
"truncated": false,
"items": [
{
"scan_no": 4,
"at": 1789999000,
"country": "VN",
"region": "Hà Nội",
"city": "Hà Nội",
"ua_class": "mobile"
},
{
"scan_no": 3,
"at": 1789990000,
"country": "VN",
"region": "Gia Lai",
"city": "Pleiku",
"ua_class": "mobile"
},
{
"scan_no": 2,
"at": 1789980000,
"country": "VN",
"region": "Đắk Lắk",
"city": null,
"ua_class": "desktop"
},
{
"scan_no": 1,
"at": 1789970000,
"country": "VN",
"region": "Đắk Lắk",
"city": "Buôn Ma Thuột",
"ua_class": "other"
}
]
}
}Response 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Response 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Response 404 · application/json
{
"error": "not found: 12",
"code": "not_found"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}