GCP Cloud Connector API Reference
API reference for direct PDF sealing and Cloud Storage workflows through the Trusted Signatures Cloud Function on GCP.
- Direct mode up to about 32 MB
- Cloud Storage mode
- SHA-256 digest only
GCP proof
Use Cloud Functions and Cloud Storage for project-level speed, scale, and IAM control
The documented GCP pattern uses Cloud Functions for execution, direct or Cloud Storage modes for document handling, and Google Cloud IAM controls for a customer-managed sealing workflow.
32 MB
speed path
Direct mode handles base64 PDF requests up to about 32 MB for a simple single-request integration path.
Gen2
scale model
The connector runs as a second-generation Cloud Function and can shift large-file workflows to Cloud Storage mode.
IAM
security controls
Invoker bindings, dedicated service accounts, and bucket-scoped roles keep runtime and document access tightly scoped.
SHA-256
data boundary
Only the PDF digest is sent to Trusted Signatures while source and sealed files remain in your GCP project.
API Reference
The GCP Cloud Connector provides businesses with a scalable, cost-effective API on their Google Cloud infrastructure to seal even the most sensitive documents. By deploying the connector in their own project, customers have assurance that none of the information in the documents can be intercepted or modified. Only an SHA-256 digest of the PDF is sent to Trusted Signatures for signing; no other data about the document exits the customer’s infrastructure.
The connector supports two modes:
- Direct Mode: PDF sent as base64 in request body (up to ~32MB)
- Storage Mode: PDF stored in Cloud Storage buckets (no size limit)
Base URL
Your Cloud Function URL:
| |
Architecture Overview
Endpoints
Health Check
Check if the Cloud Function is operational.
| |
Response:
| |
Status Codes:
200- Function is healthy
Seal PDF Document
Digitally seal a PDF document with Trusted Signatures using either direct mode or Cloud Storage mode.
| |
Direct Mode (Base64)
For PDFs up to ~32MB. PDF is sent directly in the request body.
Request Body:
| |
Response:
| |
Storage Mode (Cloud Storage)
For PDFs of any size. PDF is stored in Cloud Storage buckets.
Request Body:
| |
Response:
| |
Parameters
Common Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Hex-encoded API key from Trusted Signatures |
apiKeyId | string | Yes | Your API key identifier |
tsaTimestamp | boolean | Yes | Include timestamp authority signature |
includeLtv | boolean | Yes | Include Long Term Validation data |
limitChanges | string | No | PDF modification restrictions |
Direct Mode Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
pdfBuffer | string | Yes | Base64-encoded PDF document (max ~32MB) |
Storage Mode Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
sourceBucket | string | Yes | Cloud Storage bucket containing source PDF |
sourceKey | string | Yes | Cloud Storage key (path) to source PDF |
destinationBucket | string | Yes | Cloud Storage bucket for sealed PDF |
destinationKey | string | Yes | Cloud Storage key (path) for sealed PDF |
Important:
- You cannot specify both modes in the same request
- You must specify exactly one mode (direct or storage)
- Use unique
sourceKeyanddestinationKeyvalues for concurrent invocations to avoid conflicts - The source and destination buckets may be the same or different buckets
limitChanges Options:
"no-changes"- No modifications allowed (default)"allow-forms"- Allow form filling only"allow-comments"- Allow comments and annotations
Status Codes:
200- PDF successfully sealed400- Invalid request (missing fields, both modes specified, size limit exceeded)403- Access denied to Cloud Storage404- Source PDF not found in Cloud Storage500- Sealing operation failed
Error Response:
| |
Usage Examples
JavaScript/Node.js - Direct Mode
| |
JavaScript/Node.js - Storage Mode
| |
Python - Direct Mode
| |
Python - Storage Mode
| |
cURL - Direct Mode
| |
cURL - Storage Mode
| |
With Authentication
If your function requires authentication:
| |
Rate Limits
Cloud Functions default limits:
- Concurrent executions: 1000 per region (can be increased)
- Request rate: No hard limit, scales automatically
- Request timeout: 60 seconds (configurable up to 540s for 2nd gen)
Configure limits in function settings or via quotas.
Error Handling
400 Bad Request
Invalid mode specification:
| |
| |
Missing required fields:
| |
Size limit exceeded (Direct Mode):
| |
Solution: Verify request format and use appropriate mode for your PDF size.
403 Forbidden
Cloud Storage access denied:
| |
| |
Solution: Verify Cloud Function service account has required Cloud Storage IAM roles.
404 Not Found
Source PDF not found:
| |
Solution: Verify the source bucket and key exist and are accessible.
500 Internal Server Error
Sealing operation failed:
| |
Common causes:
- Invalid API key or credentials
- Malformed PDF document
- Network connectivity issues
- Trusted Signatures API unavailable
- Cloud Storage service errors
Solution: Check Cloud Logging for detailed error information.
503 Service Unavailable
Function temporarily unavailable:
Common causes:
- Cold start taking too long
- Function scaling up
- Temporary GCP issue
Solution: Retry the request with exponential backoff.
CORS Support
The function includes CORS headers for cross-origin requests:
Access-Control-Allow-Origin: *Access-Control-Allow-Methods: GET, POSTAccess-Control-Allow-Headers: Content-Type
Preflight OPTIONS requests are handled automatically.
Security
HTTPS Only
All Cloud Functions URLs use HTTPS by default.
Authentication Options
Configure in function settings:
- No authentication - Public access
- Require authentication - IAM-based access control
- Service account - Machine-to-machine authentication
Data Handling
- PDF documents are processed in memory only
- No data is persisted by the Cloud Function
- API keys are transmitted securely via HTTPS
Monitoring
Cloud Logging
View function logs:
| |
Cloud Monitoring
Monitor function metrics:
- Execution count
- Execution time
- Memory usage
- Error rate
- Active instances
Access via GCP Console → Cloud Monitoring → Metrics Explorer
Performance
Mode Selection
Direct Mode:
- Best for: PDFs < 10MB, low latency requirements
- Pros: Single request, no Cloud Storage setup needed
- Cons: 32MB size limit, higher memory usage, slower for large files
Storage Mode:
- Best for: Large PDFs, high-volume processing, existing Cloud Storage workflows
- Pros: No size limit, better memory efficiency, parallel processing
- Cons: Requires Cloud Storage setup, additional latency for upload/download
Cold Starts
- First invocation may take 2-5 seconds
- Subsequent invocations are faster (warm starts)
- Set minimum instances to reduce cold starts (increases cost)
Memory Allocation
Direct Mode:
- Rule of thumb: PDF size × 4 = minimum memory needed
- For 10MB PDF: allocate at least 512MB
- For 25MB PDF: allocate at least 1GB
Storage Mode:
- More memory efficient (streaming from Cloud Storage)
- 512MB sufficient for most use cases
- Scale up for very large PDFs (>100MB)
Optimization Tips
- Use Storage Mode for files >10MB
- Keep function code minimal (already optimized via bundling)
- Use appropriate memory allocation based on mode
- Set reasonable timeout values (up to 540s for 2nd gen)
- Monitor and adjust based on actual usage
- Use regional buckets in same region as function
Best Practices
Security
- API Keys: Store Trusted Signatures API credentials in Google Secret Manager
- IAM: Use custom service accounts with minimal required permissions
- Network: Consider VPC deployment for enhanced security
- Monitoring: Set up alerts for unusual usage patterns
- Data: Only SHA-256 digest transmitted to Trusted Signatures (PDFs stay in your environment)
Performance
- Mode Selection: Use Storage Mode for files >10MB
- Memory: Allocate appropriate memory based on PDF size and mode
- Regions: Deploy function and buckets in same region
- Lifecycle: Use Cloud Storage lifecycle policies for temporary files
- Monitoring: Track function performance and costs
Error Handling
- Implement proper error handling in your code
- Log errors for debugging
- Set up monitoring and alerts
- Use exponential backoff for retries
Licensing
This Cloud Functions Gateway requires a valid Trusted Signatures Container Gateway license for production use. Usage is only permitted under the terms and conditions at https://trusted-signatures.com/terms/
Support
For technical support or questions:
- Documentation: https://trusted-signatures.com/docs/
- Support: support@trusted-signatures.com
- Licensing: sales@trusted-signatures.com
- Cloud Storage Setup: See Cloud Storage setup
Need architectural review?
Book a technical walkthrough
For enterprise rollout, we can review trust model, controls, and integration patterns with your team.