import requests
# Step 1: Get signed URL
api_url = "https://api.raydocs.com"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(
f"{api_url}/vapor/signed-storage-url",
headers=headers,
json={
"content_type": "application/pdf",
"visibility": "private"
}
)
upload_data = response.json()
# Step 2: Upload file to S3
with open("invoice.pdf", "rb") as f:
requests.put(
upload_data["url"],
data=f,
headers={"Content-Type": "application/pdf"}
)
# Step 3: Use the key in batch create
file_key = upload_data["key"]
print(f"File uploaded with key: {file_key}")