# Get File Ingestion Status

This API will be used to know the final status of the ingestion.&#x20;

### Request Method

GET

### Request URL

```
{{BASE_URL}}/integration/v1/ingest/file/{{templateType}}/status/{{activityId}}?tenant={tenant}
```

### Request Headers

| Parameter             | Data Type | Field Validation | Description                               |
| --------------------- | --------- | ---------------- | ----------------------------------------- |
| x-cleartax-auth-token | String    | NA               | <p>Mandatory. </p><p>User auth token.</p> |

### Request Path Params

| Parameter    | Data Type | Field Validation                                     | Description                                                                                            |
| ------------ | --------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| templateType | String    | <p>Enum: </p><p>sales,</p><p>purchase</p><p><br></p> | <p>Mandatory. </p><p>Type of document. sales - Sale document.</p><p>purchase - Purchase document. </p> |
| activityId   | String    | NA                                                   | Mandatory. Activity ID received in Trigger File Ingestion API.                                         |

### Request Query Params

| Parameter | Data Type | Field Validation                                      | Description                                                                                                                                                              |
| --------- | --------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| tenant    | String    | <p>Enum: </p><p>GSTSALES,</p><p>MAXITC</p><p><br></p> | <p>Mandatory. Primary Product for which the file is uploaded.</p><p></p><p>GSTSALES - For Sales Document,                       </p><p>MAXITC- For Purchase Document</p> |
|           |           |                                                       |                                                                                                                                                                          |

### Request Body

There is no request body for this API.

### Response Status Codes

| HTTP Status Code | Description           |
| ---------------- | --------------------- |
| 200              | OK                    |
| 400              | Bad request.          |
| 401              | Unauthorized          |
| 500              | Internal Server Error |

### Response Schema

| Parameter       | Data Type | Field Validations                                                                                                                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| --------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| externalId      | String    | NA                                                                                                                                   | If the user passes this in the request, it will be returned in the response.                                                                                                                                                                                                                                                                                                                                                                     |
| activityId      | String    | NA                                                                                                                                   | Activity ID requested in the request.                                                                                                                                                                                                                                                                                                                                                                                                            |
| status          | String    | <p>Enum:<br>ACTIVITY_CREATED, ACTIVITY_QUEUED, ACTIVITY_COMPLETED, ACTIVITY_DISCARDED,</p><p>SYSTEM_FEEDBACK,<br>UNPLANNED_ERROR</p> | <p>Status of the triggered ingestion activity.<br><br>ACTIVITY_CREATED - Ingestion triggered,</p><p>ACTIVITY_QUEUED - Ingestion in progress,</p><p>ACTIVITY_COMPLETED - Ingestion completed or aborted or error,</p><p>ACTIVITY_DISCARDED - Ingestion deleted from UI.</p><p>SYSTEM_FEEDBACK - Any handled error on the file, eg: file corrupted, mandatory header missing, duplicate header, etc.<br>UNPLANNED_ERROR - Any unhandled error.</p> |
| processingStats | Array     | NA                                                                                                                                   | Array of Processing Stats objects. If the activity is not completed, then this field will be null.                                                                                                                                                                                                                                                                                                                                               |
| fileError       | Object    | NA                                                                                                                                   | File Error Object. If there is no file error, then this field will be null.                                                                                                                                                                                                                                                                                                                                                                      |

#### Processing Stats Object

| Parameter          | Data Type | Field Validations | Description                                          |
| ------------------ | --------- | ----------------- | ---------------------------------------------------- |
| gstin              | String    | NA                | GSTIN for which the stats are aggregated.            |
| totalDocumentCount | Number    | NA                | Count of total documents parsed from the valid rows. |
| validRows          | Number    | NA                | Count of valid rows.                                 |
| invalidRows        | Number    | NA                | Count of invalid rows.                               |

#### File Error Object

| Parameter     | Data Type | Field Validations             | Description                                                                                                                   |
| ------------- | --------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| inputFileName | String    | NA                            | Filename used in Trigger File Ingestion API.                                                                                  |
| status        | String    | Enum: DATA\_VALIDATION\_ERROR | Status of the error file.                                                                                                     |
| errorFileUrl  | String    | NA                            | URL from where the error file can be downloaded. This pre-signed URL is valid for 10 hours. This file will be in CSV format.  |
|               |           |                               |                                                                                                                               |
| errors        | String    | NA                            | Array of File Error Details Object. If there are no errors, this will be null.                                                |

#### File Error Details Object

| Parameter       | Data Type | Field Validations | Descriptions                                                                          |
| --------------- | --------- | ----------------- | ------------------------------------------------------------------------------------- |
| errorCode       | String    | NA                | Error code. If there is no error code, then this will be null.                        |
| errorMessage    | String    | NA                | Error message. If there is no error message, then this will be null.                  |
| errorField      | String    | NA                | Error field. If there is no error field, then this will be null.                      |
| errorValues     | Array     | NA                | Array of strings. Error values. If there are no error values, then this will be null. |
| errorResolution | String    | NA                | Error resolution. If there is no error resolution, then this will be null.            |

### Sample Response (Success)

Success - HTTP Status Code - 200

```json
{
    "externalId": null,
    "activityId": "3a23d3221b1847a78264f2e5fbb7e538",
    "status": "ACTIVITY_COMPLETED",
    "processingStats": [
        {
            "gstin": "27AAFCD5862R013",
            "totalDocumentCount": 1,
            "validRows": 0,
            "invalidRows": 1
        },
        {
            "gstin": "29AAFCD5862R000",
            "totalDocumentCount": 1,
            "validRows": 1,
            "invalidRows": 0
        },
        {
            "gstin": "24AAFCD5862R005",
            "totalDocumentCount": 1,
            "validRows": 1,
            "invalidRows": 0
        }
    ],
    "fileError": {
        "inputFileName": "SalesInvoicesAndCreditOrDebitNotes.xlsx",
        "status": "DATA_VALIDATION_ERROR",
        "errorFileUrl": "https://storage.clear.in/v1/ap-south-1/ingestionv2-staging/My%20Organis_SR_3a23d3221b1847a78264f2e5fbb7e538_2023-01-18T18%3A52%3A45.927215.xlsx?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEPr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCmFwLXNvdXRoLTEiRzBFAiEA7Bi1YiB7kUi1SG5aU2DfrjuKMeTmgVpJG9r3Sh6rl6YCIEYo3TadDA%2FTHxAyHCtG4j9XuL%2FQ22eWduVSi9xpSLWJKv8ECGQQBRoMMjE5MzQxOTA3OTgzIgzLG4YHegDJxQ1qDykq3AT2FHa%2BtXgQm2IwD%2F2NsRLltkBEp9%2Bf%2BwdZ5iqbhLJNpM6KyF0zNa9UGgcR4HP6PYPXVo8UyW7iabB0i2e4lSvGGh%2Bws1NAkaL%2F2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Amz-Credential=ASIATGEOL5AH4GGGNYO7%2F20230118%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=bec52c2fb85a98217bbb2b16e232a294deb811cba25b9cc1b50006abb4a5f21e",
        "errors": null
    }
}
```

### Sample Response (Error)

HTTP Status Code - 401 Unauthorized

```json
{
    "externalId": null,
    "activityId": null,
    "status": "UNPLANNED_ERROR",
    "processingStats": null,
    "fileError": null
}
```

### API Validations

Currently there are no known validations.

### API Constraints

Currently there are no known constraints.&#x20;
