Overview
This POST API can be used by GEP to delete a Goods Receipt (GR) in QUANTUM. The endpoint accepts the full GR document (header + lines) as the payload and removes the GR from the system. As part of the delete operation, the API also rolls back ASN line quantities and synchronizes the 'Accepted Later' quantities for the referenced PO lines.
URL Format: https://<Instance>/leo-gr-domaingateway-api/api/v1/Delete
Notes:
- Typically only GRs in Draft status are eligible for deletion.
- The 'event' header value must be 'leo-gr-delete'.
- The full GR document (as returned by GetGR) should be sent in the request body.
Request
POST https://api-leouat.gep.com/leo-gr-domaingateway-api/api/v1/Delete
Sample Request Body (abbreviated):
{
"_id": "3b8cf789-33d8-42e9-a46c-339e9992d5cc",
"grNumber": "GR-20250606322194",
"grHeaderId": "90fd42d1-6b8c-4024-8924-24d3bc72a82b",
"documentId": "90fd42d1-6b8c-4024-8924-24d3bc72a82b",
"documentNo": "GR-20250606322194",
"documentName": "AutomReceipt202506060038n7P",
"status": "Draft",
"statusId": 1,
"subTypeAppId": "39dd1c6a-2edc-40c7-b0d4-2e50755eb941",
"subType": 1,
"grType": 1,
"orderNumber": "4100010830",
"referenceDocumentNumber": "4100010830",
"supplierCode": "PC-2024.003858",
"businessUnitName": "0010 - 3A Composites USA",
"createdBy": "3AC Automation Buyer",
"createdOn": "2025-06-06T00:38:32.208Z",
"updatedBy": "3AC Automation Buyer",
"updatedOn": "2025-06-06T07:03:52Z",
"documentDate": "2025-06-06T00:38:31Z",
"postingDate": "2025-06-06T00:38:31Z",
"purchaseType": "Indirect",
"orderType": "IndirectOrder",
"source": "Order",
"currency": { "code": "USD", "name": "US Dollar . USD", "symbol": "$" },
"supplier": { "...": "supplier object" },
"businessUnit": [ { "entityCode": "0010", "entityName": "0010 - 3A Composites USA" } ],
"grLine": [
{
"_id": "f51f227a-14ff-4a1a-9e66-e2297e620396",
"grLineId": "f51f227a-14ff-4a1a-9e66-e2297e620396",
"grLineNumber": "1",
"grNumber": "GR-20250606322194",
"poNumber": "4100010830",
"poLineNumber": "1",
"receivedQuantity": 40,
"deliveredQty": 40,
"orderedQuantity": 10,
"receivedDate": "2025-06-06T00:38:31Z",
"lineType": "Material",
"status": "Draft",
"itemUOM": "EA",
"unitPrice": 8
}
]
}
Response
{
"isSuccess": true,
"errorMessage": null,
"errorCode": null,
"returnValue": null,
"hasData": false,
"hasException": false,
"exception": null
}
Examples
Success Scenario - Request
curl --location 'https://api-leouat.gep.com/leo-gr-domaingateway-api/api/v1/Delete' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'subtypeappid: 39dd1c6a-2edc-40c7-b0d4-2e50755eb941' \
--header 'event: leo-gr-delete' \
--header 'authorization: Bearer <token>' \
--header 'ocp-apim-subscription-key: <subscription-key>' \
--header 'x-gep-transaction-scope-id: a716a2c9-7784-4428-a465-bcf9ee7f799a' \
--data-raw '<full GR document JSON>'
Success Scenario - Response
{
"isSuccess": true,
"errorMessage": null,
"errorCode": null,
"returnValue": null,
"hasData": false,
"hasException": false,
"exception": null
}
Failure Scenario - Response
{
"isSuccess": false,
"errorMessage": "Goods Receipt cannot be deleted as it is not in Draft status.",
"errorCode": "GR_DELETE_NOT_ALLOWED",
"returnValue": null,
"hasData": false,
"hasException": true,
"exception": {
"Message": "Goods Receipt cannot be deleted as it is not in Draft status."
}
}
Data Elements
| Property | Required? | Data type | Description | Validations / Exceptions |
|---|---|---|---|---|
| Request Headers | ||||
| accept | Yes | String | Response media type. Use application/json. | |
| content-type | Yes | String | Payload media type. Use application/json. | |
| authorization | Yes | String | Bearer token used for authentication. | |
| ocp-apim-subscription-key | Yes | String | APIM subscription key issued to the consumer. | |
| subtypeappid | Yes | GUID (String) | Sub-type application identifier of the Goods Receipt module. | |
| event | Yes | String | Event name routing the request. Use leo-gr-delete. | |
| x-gep-transaction-scope-id | Yes | GUID (String) | Unique transaction/correlation id. |
| Property | Required? | Data type | Description | Validations / Exceptions |
|---|---|---|---|---|
| DeleteGR Request Body (Header) | ||||
| _id | Yes | String (GUID) | Mongo internal id (rootId) of the GR document being deleted. | Must match existing GR |
| grHeaderId | Yes | String (ObjectId) | Header object id of the GR being deleted. | |
| documentId | Yes | String (GUID) | Document id of the GR being deleted. | |
| grNumber | Yes | String (100) | Goods Receipt number being deleted. | |
| documentNo | Yes | String (100) | Document number; generally same as grNumber. | |
| documentName | String (200) | Display name of the GR document. | ||
| status | Yes | String | Current status of the GR. Delete is typically allowed only for Draft. | Only Draft GRs can be deleted |
| statusId | Yes | Integer | Numeric status id corresponding to status. | |
| subTypeAppId | Yes | GUID (String) | Sub-type application id of the GR module. | |
| subType | Yes | Integer | Numeric sub-type identifier. | |
| grType | Yes | Integer | Numeric GR type identifier. | |
| orderNumber | Yes | String | Purchase order number against which the GR was created. | |
| referenceDocumentNumber | String | Reference document (PO/ASN) number. | ||
| supplierCode | Yes | String | Client partner code of the supplier. | |
| businessUnitName | String | Display name of the business unit. | ||
| purchaseType | String | Type of purchase: Direct / Indirect. | ||
| orderType | String | Source order type (e.g., IndirectOrder). | ||
| source | String | Document source (Order, ASN, etc.). | ||
| documentDate | Yes | DateTime (ISO 8601) | Document date of the Goods Receipt. | |
| postingDate | Yes | DateTime (ISO 8601) | Posting date of the GR in the ERP. | |
| createdBy | String | Full name of the user who created the GR. | ||
| createdOn | DateTime (ISO 8601) | Timestamp when the GR was created. | ||
| updatedBy | String | Full name of the user who last updated the GR. | ||
| updatedOn | DateTime (ISO 8601) | Timestamp of last update. | ||
| currency | Currency object | Currency of the GR. | ||
| supplier | Supplier object | Supplier details on the GR. | ||
| businessUnit | List of BusinessUnit object | Business unit(s) associated with the GR. | ||
| shipToAddress | Address object | Ship-to address of the GR. | ||
| orderContact | Contact object | Order contact details. | ||
| orderAuthor | Contact object | Order author details. | ||
| auditFields | AuditFields object | Audit fields. | ||
| dataSourceSystem | Object | Source system metadata. | ||
| linkedDocuments | LinkedDocuments object | Linked PO/ASN document references. | ||
| grLine | Yes | List of GRLine object | Array of GR line items belonging to the GR. | At least one line |
| Property | Required? | Data type | Description | Validations / Exceptions |
|---|---|---|---|---|
| GRLine | ||||
| _id | Yes | String (GUID) | Internal id of the GR line. | |
| grLineId | Yes | String (GUID) | GR line id. | |
| grLineNumber | Yes | String | Line number on the GR. | |
| grNumber | Yes | String | GR number this line belongs to. | |
| grHeaderId | Yes | String | Parent GR header id. | |
| documentId | Yes | String | Parent GR document id. | |
| poNumber | Yes | String | PO number this line references. | |
| poLineNumber | Yes | String | Line number on the referenced PO. | |
| poIDClientCode | String (GUID) | Internal id of the referenced PO. | ||
| poLineIDClientCode | String (GUID) | Internal id of the referenced PO line. | ||
| receivedQuantity | Yes | Decimal | Quantity received on this line. | |
| deliveredQty | Yes | Decimal | Delivered quantity for the line. | |
| orderedQuantity | Yes | Decimal | Ordered quantity on the PO line. | |
| receivedDate | Yes | DateTime | Date the goods were received. | |
| acceptedDate | DateTime | Date the line was accepted. | ||
| needByDate | DateTime | Need-by date from the PO line. | ||
| lineType | Yes | String | Type of line (Material, Service, Tax). | |
| itemUOM | String | Unit of measure code. | ||
| itemName | String | Item name. | ||
| customerItemDescription | String | Customer item description. | ||
| category | String | Category of the line item. | ||
| unitPrice | Decimal | Unit price for the line. | ||
| currency | String | Currency display name. | ||
| currencyCode | String | Currency ISO code. | ||
| priceBasis | String | Price basis (Quantity Based / Amount Based). | ||
| status | String | Line status. | ||
| shipToSite | String | Ship-to site of the line. | ||
| supplierName | String | Supplier name on the line. | ||
| previouslyAcceptedQuantity | Decimal | Previously accepted quantity on the PO line. | ||
| previouslyReceivedQuantity | Decimal | Previously received quantity on the PO line. | ||
| isDeleted | Boolean | Soft-delete flag for the line. | ||
| isModified | Boolean | Whether the line was modified. | ||
| auditFields | AuditFields object | Audit fields for the line. |
| Property | Required? | Data type | Description | Validations / Exceptions |
|---|---|---|---|---|
| DeleteGR Response (GepReturn) | ||||
| isSuccess | Boolean | True if the delete operation succeeded, false otherwise. | ||
| errorMessage | String | Error message text when isSuccess is false. | ||
| errorCode | JToken / String | Error code (or structured token) when applicable. | ||
| returnValue | Object | Always null for this endpoint. | ||
| hasData | Boolean | Convenience flag: returnValue != null. | ||
| hasException | Boolean | Convenience flag: true if exception captured. | ||
| exception | Object | Exception details (server-side failure). |