Get Pre-signed URL

You can generate pre-signed URL using this API.

Request Method

GET

Request URL

{{BASE_URL}}/integration/v1/generatePreSign/{{templateType}}?fileName={filename}

Request Headers

ParameterData TypeField ValidationsDescription

x-cleartax-auth-token

String

NA

Mandatory.

User auth token.

fileContentType

String

Enum:

XLSX, XLS, CSV

Mandatory.

Type of file being uploaded.

Request Path Params

ParameterData TypeField ValidationsDescription

templateType

String

Enum:

sales,

purchase

Type of document. sales - Sales document.

purchase- Purchase document.

Request Query Params

ParamterData TypeField ValidationsDescription

fileName

String

MaxLength: 1500

Name of the file to be uploaded (eg. filename.xlsx)

Request Body

There will be no request body for this API.

Response Status Codes

HTTP Status CodeDescription

200

For a successfully processed request (may be a success or validation error).

401

If the user is not authenticated for the operation.

403

If the user is not authorized for the operation.

500

If there are any unhandled exceptions on Clear side.

Response Schema

ParamterData TypeField ValidationsDescription

status

String

enum:

CREATED, FAILED

Status of generate pre-signed URL action.

CREATED - Pre-signed URL is generated.

FAILED - Pre-signed URL is not generated.

preSignedS3Url

String

MaxLength: 2048

The pre-signed URL string. This URL is valid only for 10 minutes from the time of generation.

errorCode

String

enum:

AUTHORIZATION_FAILED, LICENSE_EXPIRED, API_QUOTA_EXCEEDED, PERMISSION_DENIED,

INTERNAL_ERROR

API Error Code.

AUTHORIZATION_FAILED- Invalid Auth Token passed, LICENSE_EXPIRED- Account License has expired, API_QUOTA_EXCEEDED- API access quota has exceeded, PERMISSION_DENIED- Don't have permission. Contact admin for access, INTERNAL_ERROR- Internal Error in Clear. Contact support.

If there is no error, this will be null.

errorMessage

String

NA

API Error Message.

If there is no error, this will be null.

Sample Response

Success - HTTP Status Code - 200

{
    "status": "CREATED",
    "preSignedS3Url": "https://storage.clear.in/v1/ap-south-1/ingestionv2-staging/307a6331-df8b-4bdd-a05a-d18812da0340/GSTSALES/2023/JANUARY/608996448b37488db5ef8a0db5c4f534/OriginalFileName/608996448b37488db5ef8a0db5c4f534__1674056071858.SalesInvoicesAndCreditOrDebitNotes?X-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ZkzBnHxGEJmllq9DCHo6CeBjqZARZ%2BWnyAzRtRrX6b5rQ6fwSFBSEhGyT37gCxKc10gbokCdvifp7tylNxmezHMCv5Y1CY39Tng7LWWaLXTMN4a9qDaHNYc3rhWQxjkZcoz4%2BgUVnEwN5n%2FNabHHGg1PdOdIXGXZqzdY1U2O9E%2B76OfrxQ5rF5g2iMg7u%2BqVb6lpNFeBywAY4fgQ0k08LJcomUKUHl1NcDMRlnKw%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230118T153431Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=35999&X-Amz-Credential=ASIATGEOL5AH7CXDG5RM%2F20230118%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Signature=77c29e7e2a0b419a4355175ff7eaa598d600285f5015004d270f18780ee24b69",
    "errorCode": null,
    "errorMessage": null
}

Error - HTTP Status Code - 401

{
    "status": null,
    "preSignedS3Url": null,
    "errorCode": "AUTHORIZATION_FAILED",
    "errorMessage": "Invalid Auth Token"
}

Error - HTTP Status Code - 500

[
    {
        "errorCode": "INTERNAL_ERROR",
        "errorMessage": "Required request header 'fileContentType' for method parameter type FileContentType is not present",
        "errorField": null,
        "errorValues": null,
        "errorResolution": null
    }
]

API Validations

  1. Filename cannot be empty.

  2. Content type and template type should be valid.

API Constraints

The user should have invoice creation permission.

Last updated