> For the complete documentation index, see [llms.txt](https://docs.eseye.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eseye.com/api-reference/bulk-operations-api/files/upload-or-download-file.md).

# Upload or Download File

Returns the AWS credentials you need to upload a file to S3, or a URL that downloads a file from S3. The `action` query parameter controls which one you get.

Set `action` to `upload` to generate presigned values for the file upload. The response includes `key`, `AWSAccessKeyId`, `x-amz-security-token`, `policy`, and `signature`. After this call, open **Upload File to S3**, go to **Body > form-data**, and choose the CSV file that matches your operation.

Set `action` to `download` to generate a URL that downloads the requested file. Pass the `responseFileId` returned by **Get ResponseFile** as the `fileId`. If the response includes a `url` or `fileUrl`, pass it to **Download via Pre-signed URL**.

```json
{"openapi":"3.1.0","info":{"title":"Bulk Operations API","version":"2.0.0"},"tags":[{"name":"Files"}],"servers":[{"url":"https://{fileUrl}","variables":{"fileUrl":{"default":"files.api.example.com","description":"Base URL of the File service (provided by Eseye)."}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Send `Bearer {token}`, where `{token}` is the `access_token` returned by Request a token."}}},"paths":{"/api/v2/file/{fileId}":{"get":{"summary":"Upload or Download File","operationId":"upload-download-file","tags":["Files"],"description":"Returns the AWS credentials you need to upload a file to S3, or a URL that downloads a file from S3. The `action` query parameter controls which one you get.\n\nSet `action` to `upload` to generate presigned values for the file upload. The response includes `key`,\n`AWSAccessKeyId`, `x-amz-security-token`, `policy`, and `signature`. After this call, open **Upload\nFile to S3**, go to **Body > form-data**, and choose the CSV file that matches your operation.\n\nSet `action` to `download` to generate a URL that downloads the requested file. Pass the\n`responseFileId` returned by **Get ResponseFile** as the `fileId`. If the response includes a `url` or\n`fileUrl`, pass it to **Download via Pre-signed URL**.\n","parameters":[{"name":"fileId","in":"path","required":true,"description":"The ID of the file. For an upload, enter the `fileId` returned by Create File. For a download, enter the `responseFileId` returned by Get ResponseFile.","schema":{"type":"string"}},{"name":"action","in":"query","required":true,"description":"Whether you are uploading a file or downloading one.","schema":{"type":"string","enum":["upload","download"]}}],"responses":{"200":{"description":"For `action=upload`, returns the presigned values for the S3 upload. For `action=download`, returns a presigned download URL."}}}}}}
```


---

# 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.eseye.com/api-reference/bulk-operations-api/files/upload-or-download-file.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.
