Skip to main content
GRN Creation API
curl --request POST \
  --url https://api.pazy.io/v1.0/procurement/grn

Authentication

All requests require an API key in the request headers. Headers:
Authorization: Api-Key YOUR_API_KEY
Content-Type: application/json

Request

Content-Type: application/json

Body Parameters

ParameterTypeRequiredDescription
grnNumberstringYesGRN number to assign to the document (minimum 1 character)
lineItemsarrayYesList of line items that make up the GRN (minimum 1 item required)
poIdstringYesPurchase order ID that this GRN is linked to (minimum 1 character)
receivedDatestringYesReceived date for the GRN in ISO-8601 format (YYYY-MM-DD)
remarkstringNoRemark for the GRN (minimum 1 character)
referenceNostringNoReference number for the GRN (minimum 1 character)
descriptionstringNoDescription for the GRN (minimum 1 character)

Line Items Object

Each item in the lineItems array must contain the following fields:
ParameterTypeRequiredDescription
quantitynumberYesQuantity received for the line item
ratenumberYesUnit rate to be applied to the line item
identifierstringYesDescription of the line item (minimum 1 character)

Code Examples

curl -X POST https://api.pazy.io/v1.0/procurement/grn \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "grnNumber": "GRN-2024-001",
    "poId": "po_identifier",
    "receivedDate": "2024-02-15",
    "description": "Goods receipt for office supplies",
    "remark": "All items received in good condition",
    "referenceNo": "REF-2024-001",
    "lineItems": [
      {
        "identifier": "SKU-001",
        "quantity": 100,
        "rate": 50.00
      },
      {
        "identifier": "SKU-002",
        "quantity": 50,
        "rate": 75.50
      }
    ]
  }'

Success Response

HTTP Status: 200 OK Response Fields:
FieldTypeDescription
okbooleanIndicates whether the request was successful
dataobjectContains the GRN creation response data
data.idstringUnique identifier for the GRN
data.grnNumberstringGRN number assigned to the document
data.statusstringCurrent status of the GRN

Response Example

{
  "ok": true,
  "data": {
    "id": "grn_identifier",
    "grnNumber": "GRN-2024-001",
    "status": "CREATED"
  }
}

Error Responses

Missing Required Fields

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "MISSING_REQUIRED_FIELD",
    "message": "grnNumber is required"
  }
}
HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "PURCHASE_ORDER_ID_REQUIRED",
    "message": "Purchase order ID required"
  }
}

Invalid Date

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_DATE",
    "message": "Invalid date"
  }
}

Invalid Expected Delivery Date

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_EXPECTED_DELIVERY_DATE",
    "message": "Invalid expected delivery date"
  }
}

Invalid Line Items

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed: /body/lineItems: must NOT have fewer than 1 items"
  }
}
HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed: /body/lineItems/0/quantity: must be number"
  }
}
HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed: /body/lineItems/0/identifier: must NOT have fewer than 1 characters"
  }
}

Purchase Order Not Found

HTTP Status: 404 Not Found
{
  "ok": false,
  "error": {
    "code": "PURCHASE_ORDER_NOT_FOUND",
    "message": "Purchase order not found"
  }
}

GRN Not Found

HTTP Status: 404 Not Found
{
  "ok": false,
  "error": {
    "code": "GRN_NOT_FOUND",
    "message": "GRN not found"
  }
}

Invalid State

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_STATE",
    "message": "Invalid state"
  }
}

Invalid Matching Type

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_MATCHING_TYPE",
    "message": "Invalid matching type"
  }
}

Invalid Procurement Type

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_PROCUREMENT_TYPE",
    "message": "Invalid procurement type"
  }
}

Invalid Source

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_SOURCE",
    "message": "Invalid source"
  }
}

Invalid Type

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_TYPE",
    "message": "Invalid type"
  }
}

Invalid GSTIN

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_GSTIN",
    "message": "Invalid GSTIN"
  }
}

Invalid Currency

HTTP Status: 400 Bad Request
{
  "ok": false,
  "error": {
    "code": "INVALID_CURRENCY",
    "message": "Invalid currency Only INR is supported at the moment"
  }
}

Vendor Not Found

HTTP Status: 404 Not Found
{
  "ok": false,
  "error": {
    "code": "VENDOR_NOT_FOUND",
    "message": "Vendor not found"
  }
}

Authentication Errors

HTTP Status: 401 Unauthorized
{
  "ok": false,
  "error": {
    "code": "MISSING_CREDENTIALS",
    "message": "Missing Credentials"
  }
}
{
  "ok": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid API Key"
  }
}

Permission Errors

HTTP Status: 403 Forbidden
{
  "ok": false,
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Permission check failed - PERMISSION_CHECK_FAILED"
  }
}

GRN Creation Errors

HTTP Status: 500 Internal Server Error
{
  "ok": false,
  "error": {
    "code": "PROCUREMENT_CREATION_FAILED",
    "message": "Error creating procurement"
  }
}

Internal Error

HTTP Status: 500 Internal Server Error
{
  "ok": false,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Internal error"
  }
}

Best Practices

GRN Creation

  • Ensure all required fields (grnNumber, lineItems, poId, receivedDate) are provided
  • Use ISO 8601 date format (YYYY-MM-DD) for the receivedDate field
  • Provide at least one line item with valid quantity, rate, and identifier values
  • The poId must reference an existing purchase order in the system
  • Use description to provide context about the goods received
  • Include remark for any special notes or conditions about the receipt
  • Use referenceNo to link the GRN to external reference numbers or documents
  • Ensure the received date is not in the future and aligns with the purchase order timeline

Line Items

  • Ensure each line item has a unique identifier that matches the purchase order line items
  • Use positive numbers for quantity and rate
  • The quantity received should typically match or be less than the quantity ordered in the purchase order
  • Verify that line items correspond to the linked purchase order