> For the complete documentation index, see [llms.txt](https://docs.cleartax.in/cleartax-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cleartax.in/cleartax-docs/gls-api/gls-api-reference/advanced-ingestion-api/upload-file-to-storage.md).

# Upload File to Storage

### Request Method

PUT

### Request URL

`{{Presigned URL generated in Step 1}}`

### Request Headers

| Parameter    | Data Type | Field Validations | Description                                                                                                                                                                                                                          |
| ------------ | --------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Content-Type | String    | NA                | <p>Mandatory. Content type based on the file to be uploaded in the body.</p><p>csv: text/csv<br>xls: application/vnd.ms-excel<br>xlsx: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet<br>zip: application/zip</p> |

### Request Path Params

There are no path parameters for this API.

### Request Query Params

There are no query parameters for this API.

### Request Body

The request body should contain the binary file data. Use --data-binary flag in curl to upload the file content directly without any encoding modifications.

### Response Status Codes

<table><thead><tr><th width="374">HTTP Status Code</th><th>Description</th></tr></thead><tbody><tr><td>200</td><td>Request processed successfully and response returned.</td></tr><tr><td>400</td><td>Bad Request. The request is invalid or missing required parameters.</td></tr><tr><td>403</td><td>User not authorized or URL expired</td></tr><tr><td>500</td><td>Something went wrong on the server.</td></tr></tbody></table>

### Response Schema

This API returns the HTTP status code directly without a JSON body on success.

<table><thead><tr><th width="195.33331298828125">HTTP Status</th><th>Response</th></tr></thead><tbody><tr><td>200</td><td>Empty body</td></tr><tr><td>400</td><td>XML error message from S3</td></tr><tr><td>403</td><td>XML error - Access denied or URL expired</td></tr></tbody></table>

### Sample Request and Response

#### Sample Success

**Request cURL**

```
curl --location --request PUT 'https://storage.clear.in/v1/ap-south-1/one-integration-prod/..' \
--header 'Content-Type: text/csv' \
--data-binary '@/path/to/your/sales.csv'
```

**Response Status Code**

200

**Response Body**

The response body will be empty body

#### Sample Error

**Request cURL**

```
curl --location 'https://storage.clear.in/v1/ap-south-1.....' \
--header 'Content-Type: text/plain' \
--data-binary '@/path/to/your/sales.csv'
```

**Response Status Code**

403

**Response Body**

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>SignatureDoesNotMatch</Code>
    <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
    <AWSAccessKeyId>accessKeyId</AWSAccessKeyId>
    <StringToSign>AWS4-HMAC-SHA256
20251222T074221Z
20251222/ap-south-1/s3/aws4_request
8aba80d567aa00f818a38a5c77186b374d5c8aae23816bf47f3b512f8106e65a</StringToSign>
    <SignatureProvided>signature</SignatureProvided>
    <StringToSignBytes></StringToSignBytes>
    <CanonicalRequest>GET
/c6e40ed7-e1fc-4e95-9131-6554a32eb812/87654321/2025/DECEMBER/22/6973d35c-cae9-4a43-bbdf-c24d9c8623ae/data_extraction/c6e40ed7-e1fc-4e95-9131-6554a32eb812/a
X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIATGEOL5AHTEZO5JVG%2F20251222%2Fap-south-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20251222T074221Z&amp;X-Amz-Expires=3600&amp;X-Amz-SignedHeaders=content-type%3Bhost
content-type:
host:one-integration-staging.s3.ap-south-1.amazonaws.com</CanonicalRequest> 
<CanonicalRequestBytes>50 55 54 0a</CanonicalRequestBytes>
 <RequestId>P85Y3G1TK40JFGNS</RequestId>
    <HostId>hostId</HostId>
</Error>
```

### API Validations <a href="#api-validations" id="api-validations"></a>

Currently there are no known validations.

### API Constraints

Once a pre-signed URL is generated, it will be valid for only 1 hour. If upload fails, generate a new pre-signed URL and try again.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cleartax.in/cleartax-docs/gls-api/gls-api-reference/advanced-ingestion-api/upload-file-to-storage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
