Save to Google Drive
When a contract reaches the signed status, the final PDF can be auto-archived to your personal Google Drive in a folder of your choice. Useful for compliance, legal hold, or just keeping signed paperwork outside of Kinderpedia.
The integration is per-user (each staff member connects their own Drive). See Integrations → Google Drive for connection details.
Auto-archive (sender-scoped)
When a contract reaches signed:
- We look up the user who sent the contract (the one who clicked "Send via DocuSign" or "Email all").
- If that user has Google Drive connected with auto-archive enabled, we trigger
GoogleDriveAutoSyncService::pushSignedContract($contract, $sender). - The signed PDF is downloaded from S3 + uploaded to Drive via
files.create. - The file name is
{contract_number} - {lead_name}.pdf. - Drive file ID stored on
contracts.drive_file_id. Adrive_urlshortcut is also written for one-click access.
The contract detail page shows a green "Saved to Drive" badge once the upload succeeds, with a click-through to the file.
Manual archive
For older contracts signed before Drive was connected — or contracts the sender didn't set up Drive for — the contract page has a Save to Drive button. Click → archives retroactively. Same flow, just on-demand.
Visible to the sender of the contract (the user who pressed Send). Other staff don't see it because the Drive target is sender-scoped.
Folder selection
Drive uploads always go to the folder you picked in Integrations → Google Drive → Configure → Default folder. If no folder was picked, files land in your root My Drive.
To change the folder for future archives:
- Integrations → Google Drive → Configure.
- Click Pick folder… in the picker dialog.
- Pick a new folder (can be on a Shared Drive).
- Save.
Existing archived files stay where they are. Only future archives target the new folder.
File naming
{contract_number} - {lead_name}.pdf by default. The contract number is whatever's on contracts.contract_number; the lead name is the student's name.
If a name collision occurs (re-archiving the same contract), we append a short random suffix ({contract_number} - {lead_name} - a4f2.pdf) so we never overwrite an existing Drive file.
Custom naming patterns are not configurable yet.
What gets archived
Only the signed PDF — the final merged document with all signatures applied. NOT archived:
- DocuSign's Certificate of Completion
- Source contract template
- Any attachments uploaded alongside the contract
- Activity log entries
If you need the Certificate of Completion archived too, download it manually from the contract detail page and upload to Drive yourself.
Shared Drives for team-wide archive
If your team needs every signed contract to land in a shared folder (rather than each sender's personal Drive), the right setup is:
- Have one designated "contracts archivist" user connect their Drive.
- Pick a folder on a Shared Drive the whole team has access to.
- Either (a) ensure only this user sends contracts, or (b) accept that auto-archive is sender-scoped and add a workflow to re-route.
We don't fan-out archive to N users' Drives — that would create duplicate storage + duplicate audit trails. One contract = one Drive file.
Privacy + scope
The Drive integration uses Google's drive.file scope — the most-restrictive scope Google offers for app uploads. Kinderpedia cannot:
- List your other Drive files
- Read files you didn't create through us
- Share files (no
permissions.create) - Delete files (no
files.delete)
Files we upload are visible to you in Drive immediately. Permissions inherit from the parent folder — if you uploaded to a Shared Drive, all members see the file; if to a private folder, only you do.
Failure handling
If the Drive push fails:
- The contract is still marked
signed(Drive failure doesn't roll back the signing). - The error is logged to
audit_logs(contract_drive_archive_failed). - The integration tile flips to
errorwith the failure message. - The contract page shows "Drive archive failed — Retry" with a button to manually re-attempt.
Common failure causes:
- Drive token expired (re-connect)
drive_folder_idno longer exists (folder was deleted in Drive)- Quota exceeded (extremely rare; Google's free tier is 15GB)
Disconnecting
Disconnecting Drive doesn't delete already-archived files — they stay in your Drive. Future signed contracts simply skip the auto-archive step.
If you reconnect later (same Google account), auto-archive resumes with the new credentials. Folder selection is preserved across reconnects.
Audit log entries
Drive operations generate audit_logs:
contract_drive_archived— contract id, drive file id, who archivedcontract_drive_archive_failed— contract id, error messagecontract_drive_archive_replayed— when you manually retry a failed archive
These show up in the contract's activity log.
Cost / billing
Storage usage counts against the connecting user's Google account quota (or Workspace quota if they're on Workspace). Kinderpedia doesn't charge for Drive archives. Most signed contract PDFs are <1MB, so a school doing 200 contracts/year uses ~200MB — well within Google's 15GB free tier.
For schools with high-volume archive needs, point Drive at a Workspace Shared Drive — those have separate, much-larger quotas.