# How to generate signed URLs

To load documents from S3, you can create a pre-signed URL to access files inside your bucket. Use the following instructions (taken from the [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html)).

1. Sign in to the AWS Management Console and open the Amazon S3 console at <https://console.aws.amazon.com/s3/>.

2. In the Buckets list, choose the name of the bucket that contains the object that you want as a pre-signed URL.

3. In the Objects list, select the object for which you want to create a pre-signed URL.

4. On the Actions menu, choose Share with a pre-signed URL.

5. Specify how long you want the pre-signed URL to be valid.

6. Choose 'Create pre-signed URL'.

7. When a confirmation appears, the URL is automatically copied to your clipboard. You will see a button to copy the pre-signed URL if you need to copy it again.

This will generate an URL with the following structure:

```
https://<BUCKET>.s3.<REGION>.amazonaws.com/<FILE>?response-content-disposition=inline&X-Amz-Security-Token=<TOKEN>
```

Pre-signed URLs have a maximum duration of 12 hours.

## How to add the URL to a Stack AI flow

{/\* TODO add link to data loaders \*/} You can load the document with its signed URL to a URL data loader (see ) which will load and parse the PDF to a vector database.

{/\* TODO: deploy link \*/} Go to the [Deploy](https://docs.stackai.com/workflow-builder/broken-reference) section and you can call specify the signed URL in the inputs of the flow. In CuRL a simple flow works as:

You can try this flow in the [WebScrapper Q\&A template](https://www.stack-ai.com/dashboard/compose?flow_id=644ac9a695e34ea9447d4138).

## How to call the document via the API

Go to the Deploy section and you can call specify the signed URL in the inputs of the flow. In CuRL a simple flow works as:

```bash
curl "https://stack-inference.com/inference/v0/run/<ORG_ID>/<FLOW_ID>" \
 -X POST \
 -d '{"in-0": "Summarize this document", "url-0": "https://<BUCKET>.s3.<REGION>.amazonaws.com/<FILE>?response-content-disposition=inline&X-Amz-Security-Token=<TOKEN>"}' \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer XXXXXXXXXXXXX"
```

For more details on deployment see . {/\* TODO: link to deployer guide \*/}
