# Document Management

Rialto's API uses AWS S3 Presigned URLs to upload and download documents to be added to the requests.

Below are listed the steps necessary to complete API calls with documents.

### Get Presigned urls

When an API user needs to join a document to a request (e.g. join a document for a trade request, create a managed Client Account etc.), they need to first upload the documents before making the request.

For that matter, users need to call the `POST /uploads/request-batch-upload` route with a list of filenames joined in the request body. This route is available with both Client and Manager APIs.

The request will return a list of AWS S3 Presigned URLs, used to upload the documents. The user then needs to make a `PUT` request to the URL with a document path as parameter.&#x20;

For example with the curl command line interface : `curl -X PUT -T <path to my local file> <Presigned URL>`&#x20;

Files will be put in a temporary storage folder while waiting to be included into an API request.&#x20;

### Use uploaded files in API requests

Files uploaded via Presigned URLs are placed in a temporary storage; this folder is emptied every 24 hours. Users can get a list of the currently available files by calling the route `GET /uploads` .

Files that were uploaded can then be referenced by filename to be included in API requests.

When a file is successfully used as a parameter in an API call, the file is then moved to a permanent storage folder. The name of the file is also modified to prevent conflicts.

For example, when `file1.jpg` is used, a name such as `7111bfb8-d6d3-4930-a6d0-eaa68a1c431a_file1.jpg` might be generated. This new filename can be used to download the file.

### Download files

Downloading files is similar to uploading. API users need to request Presigned URLs with the route `POST /documents/request-batch-download` and joining a list of filenames (including their uuid addition) in parameter.

The request will return a Presigned URL to be used to download the document.&#x20;

For example with the curl command line interface : `curl -o <path to my destination> <Presigned URL>`&#x20;

Please read [this guide](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html) on the AWS website for more information. Please also refer to the [Client API ](broken://pages/w5Pq0FCvQWwmAaY0FW27)reference and the [Manager API reference](broken://pages/27oJLsbSbFdXoXkvBIcP) for more details about the document management routes.


---

# Agent Instructions: 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:

```
GET https://docs.rialtobridge.xyz/concepts/document-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
