Skip to content

AWS S3 Integration Guide

This guide walks you through setting up AWS S3 integration to automatically upload generated PDFs to your own S3 bucket.

DocSpring supports two methods of authentication for AWS S3:

Uses AWS Security Token Service (STS) to assume an IAM role in your AWS account. This is the recommended approach as it’s more secure than sharing access keys.

  1. Visit the IAM service
  2. Click RolesCreate role
  3. Select Another AWS account as the trusted entity type
  4. Enter the DocSpring AWS account ID: 691950705664
  5. Click Next
  6. Create a custom policy with the following permissions:
IAM Role Permissions
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:PutObject"],
"Resource": ["arn:aws:s3:::YOUR_BUCKET_NAME/*"]
}
]
}
  1. Attach the policy to your role
  2. Name your role (must include docspring in the name)
  3. After creating the role, edit the trust relationship:
Trust Relationship
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::691950705664:user/service/docspring-s3-cross-account"
},
"Action": "sts:AssumeRole"
}
]
}
  1. Go to your DocSpring integrations page
  2. Click Add IntegrationAWS S3
  3. Fill in the configuration:
  • Authentication Type: Choose “Access Key” or “Role-based Authentication”
  • Bucket Name: Your S3 bucket name
  • Region: The AWS region where your bucket is located (e.g., “us-east-1”)

For access key authentication:

  • Access Key ID: Your AWS access key ID
  • Secret Access Key: Your AWS secret access key

For role-based authentication:

  • Role ARN: The ARN of the IAM role to assume
  • Submission Type: Choose which PDFs to upload:
    • Only Live (default)
    • Only Test
    • Both Live and Test
  • API Token IDs: Comma-separated list to limit uploads to specific API tokens

Customize where PDFs are stored in your bucket using Liquid templates.

  • account_id - Your DocSpring Account ID (e.g., acc_X3gQR5GN6tS6tcYgJs)
  • template_id - Template ID (e.g., tpl_eGc5CmFbPnCCmerqsx)
  • template_name - Template name (invalid characters replaced with underscore)
  • submission_id - Submission ID (e.g., sub_Gbxesk7Xf52Pq3KgT9)
  • timestamp - Processing time (e.g., 20180509094531)
  • date - Date (e.g., 20180509)
  • year - Year (e.g., 2018)
  • month - Month, not zero-padded (e.g., 5)
  • day - Day, not zero-padded (e.g., 9)
  • metadata.<key> - Any metadata values

For combined submissions:

  • combined_submission_id - Combined submission ID (e.g., com_Zbetd3ayK4EK3J4Hf4)
submission_path_template: "submissions/{{ submission_id }}.pdf"
test_submission_path_template: "test_submissions/{{ submission_id }}.pdf"
combined_submission_path_template: "combined_submissions/{{ combined_submission_id }}.pdf"

Organize by date and template:

{{ year }}/{{ month }}/{{ template_name }}/{{ submission_id }}.pdf

Use metadata for organization:

clients/{{ metadata.client_id }}/{{ date }}_{{ submission_id }}.pdf
  1. Create a test submission through the API or web interface
  2. Check your S3 bucket for the uploaded PDF
  3. Check the submission’s actions array in the API response:
// The actions array will contain an aws_s3_upload entry
{
"actions": [{
"action_type": "aws_s3_upload",
"state": "processed", // "pending" before upload completes
"result_data": {
"bucket": "your-bucket",
"key": "submissions/sub_123.pdf"
}
}]
}

Check if a PDF has been uploaded to S3:

if (submission["actions"].length === 0) return false;
const action = submission["actions"].find(
(a) => a.action_type === "aws_s3_upload",
);
return action && action.state === "processed";

Set up S3 event notifications to receive webhooks when PDFs are uploaded to your bucket.

  • For access keys: Verify the IAM user has correct permissions
  • For roles: Check the role’s permissions and trust relationship
  • For roles: Ensure the role name includes docspring
  • For access keys: Ensure keys are correct and active
  • For roles: Verify the role ARN and trust relationship
  • Check that all variables in your templates are valid
  • Ensure the template syntax is correct (use double curly braces)
  • Confirm the region matches your S3 bucket’s location

For additional help, contact DocSpring support.