drive.file OAuth scope, which grants AfterCare access only to files it creates or that the user explicitly selects — no broader access to your Drive. Follow the steps below to connect Drive before calling the import or backup endpoints.
Connect Google Drive
Endpoint reference
GET /drive/status
Return the current Google Drive connection status for the authenticated user.cURL
Response — 200 OK
Example response
POST /drive/auth
Start thedrive.file OAuth authorization flow and return the Google consent URL.
cURL
Response — 200 OK
Example response
authUrl to show the Google consent screen. The state value is signed by AfterCare and validated when the callback arrives — do not modify it.
GET /drive/callback
Complete the OAuth flow after Google redirects the user back with an authorization code. AfterCare calls this endpoint internally as part of the redirect — your app does not call it directly.GET /drive/callback is AfterCare’s OAuth redirect URI — your application never calls it directly. Once Google redirects the user here, AfterCare exchanges the authorization code for an access token and marks Drive as connected. The state parameter is validated on every callback to prevent CSRF attacks.Query parameters
POST /drive/import
Import a file from the connected Google Drive and queue it for processing as a discharge document. If the same file has been imported before, the endpoint returns the existing document instead of creating a duplicate.string
required
The Google Drive file ID of the document to import. The file must be accessible to the OAuth token on record for the authenticated user.
Response — 202 Accepted
New document
Duplicate detected
deduplicated is true, the file was already imported and the existing document is returned. No new processing is queued.
POST /drive/backup
Back up a recovery guide to the connected Google Drive as a formatted JSON file namedrecovery-guide-{documentId}.json.
string (UUID)
required
The UUID of the document whose recovery plan you want to back up. The document must belong to the authenticated user and must have a completed recovery plan (
status: "ready").Response — 201 Created
Example response
Response — 404 Not Found
Upload documents
Upload a discharge document directly from your device instead of importing from Drive.
Ask a question
Ask a natural-language question grounded in any uploaded or imported document.