# 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](broken://pages/oOHFjmwKv0eQbeeDLLx5) 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 \*/}


---

# 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.stackai.com/hidden-pages/how-to-generate-signed-urls.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.
