DeleteGR (DELETE)

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

 

PropertyRequired?Data typeDescriptionValidations / Exceptions
Request Headers    
acceptYesStringResponse media type. Use application/json. 
content-typeYesStringPayload media type. Use application/json. 
authorizationYesStringBearer token used for authentication. 
ocp-apim-subscription-keyYesStringAPIM subscription key issued to the consumer. 
subtypeappidYesGUID (String)Sub-type application identifier of the Goods Receipt module. 
eventYesStringEvent name routing the request. Use leo-gr-delete. 
x-gep-transaction-scope-idYesGUID (String)Unique transaction/correlation id. 

 

PropertyRequired?Data typeDescriptionValidations / Exceptions
DeleteGR Request Body (Header)    
_idYesString (GUID)Mongo internal id (rootId) of the GR document being deleted.Must match existing GR
grHeaderIdYesString (ObjectId)Header object id of the GR being deleted. 
documentIdYesString (GUID)Document id of the GR being deleted. 
grNumberYesString (100)Goods Receipt number being deleted. 
documentNoYesString (100)Document number; generally same as grNumber. 
documentName String (200)Display name of the GR document. 
statusYesStringCurrent status of the GR. Delete is typically allowed only for Draft.Only Draft GRs can be deleted
statusIdYesIntegerNumeric status id corresponding to status. 
subTypeAppIdYesGUID (String)Sub-type application id of the GR module. 
subTypeYesIntegerNumeric sub-type identifier. 
grTypeYesIntegerNumeric GR type identifier. 
orderNumberYesStringPurchase order number against which the GR was created. 
referenceDocumentNumber StringReference document (PO/ASN) number. 
supplierCodeYesStringClient partner code of the supplier. 
businessUnitName StringDisplay name of the business unit. 
purchaseType StringType of purchase: Direct / Indirect. 
orderType StringSource order type (e.g., IndirectOrder). 
source StringDocument source (Order, ASN, etc.). 
documentDateYesDateTime (ISO 8601)Document date of the Goods Receipt. 
postingDateYesDateTime (ISO 8601)Posting date of the GR in the ERP. 
createdBy StringFull name of the user who created the GR. 
createdOn DateTime (ISO 8601)Timestamp when the GR was created. 
updatedBy StringFull name of the user who last updated the GR. 
updatedOn DateTime (ISO 8601)Timestamp of last update. 
currency Currency objectCurrency of the GR. 
supplier Supplier objectSupplier details on the GR. 
businessUnit List of BusinessUnit objectBusiness unit(s) associated with the GR. 
shipToAddress Address objectShip-to address of the GR. 
orderContact Contact objectOrder contact details. 
orderAuthor Contact objectOrder author details. 
auditFields AuditFields objectAudit fields. 
dataSourceSystem ObjectSource system metadata. 
linkedDocuments LinkedDocuments objectLinked PO/ASN document references. 
grLineYesList of GRLine objectArray of GR line items belonging to the GR.At least one line

 

PropertyRequired?Data typeDescriptionValidations / Exceptions
GRLine    
_idYesString (GUID)Internal id of the GR line. 
grLineIdYesString (GUID)GR line id. 
grLineNumberYesStringLine number on the GR. 
grNumberYesStringGR number this line belongs to. 
grHeaderIdYesStringParent GR header id. 
documentIdYesStringParent GR document id. 
poNumberYesStringPO number this line references. 
poLineNumberYesStringLine number on the referenced PO. 
poIDClientCode String (GUID)Internal id of the referenced PO. 
poLineIDClientCode String (GUID)Internal id of the referenced PO line. 
receivedQuantityYesDecimalQuantity received on this line. 
deliveredQtyYesDecimalDelivered quantity for the line. 
orderedQuantityYesDecimalOrdered quantity on the PO line. 
receivedDateYesDateTimeDate the goods were received. 
acceptedDate DateTimeDate the line was accepted. 
needByDate DateTimeNeed-by date from the PO line. 
lineTypeYesStringType of line (Material, Service, Tax). 
itemUOM StringUnit of measure code. 
itemName StringItem name. 
customerItemDescription StringCustomer item description. 
category StringCategory of the line item. 
unitPrice DecimalUnit price for the line. 
currency StringCurrency display name. 
currencyCode StringCurrency ISO code. 
priceBasis StringPrice basis (Quantity Based / Amount Based). 
status StringLine status. 
shipToSite StringShip-to site of the line. 
supplierName StringSupplier name on the line. 
previouslyAcceptedQuantity DecimalPreviously accepted quantity on the PO line. 
previouslyReceivedQuantity DecimalPreviously received quantity on the PO line. 
isDeleted BooleanSoft-delete flag for the line. 
isModified BooleanWhether the line was modified. 
auditFields AuditFields objectAudit fields for the line. 

 

PropertyRequired?Data typeDescriptionValidations / Exceptions
DeleteGR Response (GepReturn)    
isSuccess BooleanTrue if the delete operation succeeded, false otherwise. 
errorMessage StringError message text when isSuccess is false. 
errorCode JToken / StringError code (or structured token) when applicable. 
returnValue ObjectAlways null for this endpoint. 
hasData BooleanConvenience flag: returnValue != null. 
hasException BooleanConvenience flag: true if exception captured. 
exception ObjectException details (server-side failure).