This article will walk you through the process of generating an acknowledgement using our API service. This service call is not tied to a flow and will not run a flow. This is will simply generate an acknowledgement for any corresponding EDI file.
Endpoint
POST /api/docs/generate-ack
Description
This API generates one or more EDI acknowledgment files (997 for X12 or CONTRL for EDIFACT) based on an uploaded EDI file.
The file may contain one or more interchanges (ISA
), functional groups (GS
), and transaction sets (ST
). If so, the file will be split automatically into multiple EDI documents, and an acknowledgment will be generated for each one.
Authorization
- Requires: AccessToken
Request Body (JSON Format)
{
"file": "string",
"status": "A",
"rejectReasons": [
{
"controlNumber": "string",
"segmentErrors": [
{
"segment": "string",
"segmentPosition": 0,
"errorCode": 0,
"elementErrors": [
{
"elementPosition": 0,
"componentPosition": 0,
"errorCode": 0,
"errorValue": "string"
}
]
}
]
}
]
}
Field Explanation
?️ Top-level fields
Field | Type | Required | Description |
---|---|---|---|
file | string (Base64) | ✅ Yes | The original EDI content, base64-encoded. |
status | "A" or "R" | ✅ Yes | Global status to apply to all acknowledgment files unless overridden by rejectReasons . "A" = Accept, "R" = Reject. |
rejectReasons | array | ❌ Optional | List of specific rejection reasons for individual transaction sets (ST ), identified by control number. |
rejectReasons[]
(optional)
Used only if specific transactions inside the uploaded file should be rejected with detailed error information.
Field | Type | Required | Description |
---|---|---|---|
controlNumber | string | ✅ Yes | The value of ST02 — identifies the transaction set (ST segment) to which the rejection applies. |
segmentErrors | array | ✅ Yes | List of segment-level errors and any nested element-level errors. |
? segmentErrors[]
Field | Type | Required | Description |
---|---|---|---|
segment | string | ✅ Yes | Segment ID in the EDI document (e.g., "N1" , "REF" , etc.). |
segmentPosition | number | ✅ Yes | Line position of the segment in the transaction set (starting from 1). |
errorCode | number | ❌ Optional | Segment-level error code. See SegmentErrorCode enum. |
elementErrors | array | ✅ Yes | Element-level validation errors inside this segment. |
elementErrors[]
Field | Type | Required | Description |
---|---|---|---|
elementPosition | number | ✅ Yes | Index of the data element in the segment (starting from 1). |
componentPosition | number or null | ❌ Optional | If the element is composite, this specifies the index of the component. Null if not composite. |
errorCode | number | ✅ Yes | Element-level validation error code. See ElementErrorCode enum. |
errorValue | string | ✅ Yes | The invalid value found in the document. |
Enum Reference
SegmentErrorCode
Code | Meaning |
---|---|
1 | Unrecognized Segment ID |
2 | Unexpected Segment |
3 | Mandatory Segment Missing |
4 | Loop Occurs Over Maximum Times |
5 | Segment Exceeds Maximum Use |
6 | Segment Not in Defined Set |
7 | Segment Not in Proper Sequence |
8 | Segment Has Data Element Errors |
ElementErrorCode
Code | Meaning |
---|---|
1 | Mandatory Data Element Missing |
2 | Conditional Required Element Missing |
3 | Too Many Data Elements |
4 | Data Element Too Short |
5 | Data Element Too Long |
6 | Invalid Character in Data Element |
7 | Invalid Code Value |
8 | Invalid Date |
9 | Invalid Time |
10 | Exclusion Condition Violated |
Responses
✅ 200 OK
Returns an EDI acknowledgment file (
application/octet-stream
)Filename:
Ack_{yyyyMMddHHmmss}.edi
❌ 400 Bad Request
When:
File
is null or emptyFile is not in EDI format
Notes
ACK generation respects standard formats (
997
,CONTRL
) based on input detection.Each acknowledgment has its own counter (ISA, GS, ST).
You may use the
ackContent
in the response as a downloadable.edi
file.
Example Use Cases
✅ 1. Accept All Transactions
json
{ "file": "VGVzdCBFREkgY29udGVudA==", "status": "A" }
All transactions will be accepted, no rejectReasons
provided.
❌ 2. Reject All Transactions (no error detail)
json
{ "file": "VGVzdCBFREkgY29udGVudA==", "status": "R" }
All transactions will be rejected without specifying segment/element errors.
⚠️ 3. Conditional Reject with Error Details
json
{
"file": "VGVzdCBFREkgY29udGVudA==",
"status": "A",
"rejectReasons": [
{
"controlNumber": "0002",
"segmentErrors": [
{
"segment": "N1",
"segmentPosition": 5,
"errorCode": 5,
"elementErrors": [
{
"elementPosition": 2,
"componentPosition": null,
"errorCode": 7,
"errorValue": "ABC"
}
]
}
]
}
]
}
- Global status is
Accept
- But transaction
0002
will be Rejected due to errors