Skip to content

Google Drive API

This page documents the public Google Drive API. It follows the Drive action model with 17 operations grouped into drive, file, folder, and fileFolder resources.

Connect

Create a connection ticket:

bash
curl -X POST https://auth.genium.one/api/social/connect-ticket \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider":"drive"}'

Open the returned connect_url in a browser. The callback is:

text
https://auth.genium.one/callback/drive

The Drive actions require the full Google Drive permission. Existing Drive connections made with the narrower upload permission must reconnect.

Shared-drive actions also require a Google Workspace account with Shared Drive access. A personal Google account can still use all file, folder, upload, download, share, move, and search actions, but may return an empty shared-drive list and cannot create a new shared drive.

List connected Drive accounts:

bash
curl https://auth.genium.one/api/drive/accounts \
  -H "Authorization: Bearer $USER_API_KEY"

Endpoint

Metadata actions use:

text
POST https://auth.genium.one/api/google/drive
Authorization: Bearer <USER_API_KEY>
Content-Type: application/json

The upload action uses the same endpoint with query parameters and a raw local file body:

text
POST https://auth.genium.one/api/google/drive?resource=file&operation=upload

The legacy upload endpoint remains available at POST https://auth.genium.one/api/drive/files.

Common fields

FieldTypeDescription
resourcestringdrive, file, folder, or fileFolder.
operationstringAction to execute.
account_idnumberSelects a connected Drive account.
drive_idstringShared drive ID.
file_idstringFile ID.
folder_idstringFolder ID.
namestringFile, folder, or shared drive name.
descriptionstringFile description.
parentsstring[]Parent folder IDs.
mime_typestringGoogle MIME type.
fieldsstringGoogle Drive response field projection.
page_sizenumberList page size, from 1 to 1,000.
page_tokenstringToken returned by a previous list/search response.

Successful JSON actions return:

json
{
  "resource": "file",
  "operation": "copy",
  "result": {}
}

download returns the file bytes with the Google content type. Invalid input returns 400; a missing account returns 404; Google API failures return 502.

Drive actions

1. Create a shared drive

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"drive","operation":"create","name":"Genium Team Drive"}'

2. Delete a shared drive

json
{
  "resource": "drive",
  "operation": "delete",
  "drive_id": "DRIVE_ID"
}

3. Get a shared drive

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"drive","operation":"get","drive_id":"DRIVE_ID"}'

4. List shared drives

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"drive","operation":"list","page_size":100,"fields":"drives(id,name),nextPageToken"}'

Use the returned nextPageToken as page_token for the next page.

5. Update a shared drive

json
{
  "resource": "drive",
  "operation": "update",
  "drive_id": "DRIVE_ID",
  "name": "Renamed Team Drive"
}

File actions

6. Copy a file

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"file","operation":"copy","file_id":"FILE_ID","name":"Video copy","parents":["FOLDER_ID"]}'

7. Create a text file

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"file","operation":"createFromText","name":"notes.txt","mime_type":"text/plain","content":"Genium notes"}'

8. Download a file

bash
curl -X POST "https://auth.genium.one/api/google/drive" \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"file","operation":"download","file_id":"FILE_ID"}' \
  -o downloaded-file

9. Delete a file

json
{
  "resource": "file",
  "operation": "delete",
  "file_id": "FILE_ID"
}

10. Move a file

json
{
  "resource": "file",
  "operation": "move",
  "file_id": "FILE_ID",
  "add_parents": "DESTINATION_FOLDER_ID",
  "remove_parents": "OLD_FOLDER_ID"
}

11. Share a file

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"file","operation":"share","file_id":"FILE_ID","type":"user","role":"reader","email_address":"person@example.com","send_notification_email":true}'

Allowed common type values are user, group, domain, and anyone. Common role values are reader, commenter, writer, and organizer.

12. Update file metadata

json
{
  "resource": "file",
  "operation": "update",
  "file_id": "FILE_ID",
  "name": "new-name.mp4",
  "description": "Updated description"
}

13. Upload a local file

Send the file as the raw request body:

bash
curl -X POST "https://auth.genium.one/api/google/drive?resource=file&operation=upload" \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "X-File-Name: final_video.mp4" \
  -H "X-Folder-Id: FOLDER_ID" \
  -H "Content-Type: video/mp4" \
  --data-binary @final_video.mp4

The response includes file_id, web_view_link, size_bytes, and delete_after. Uploads are tracked and automatically deleted from Drive after one hour. Use the legacy /api/drive/files endpoint when you need its existing idempotency behavior.

Folder actions

14. Create a folder

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"folder","operation":"create","name":"Genium Videos","parents":["PARENT_FOLDER_ID"]}'

15. Delete a folder

json
{
  "resource": "folder",
  "operation": "delete",
  "folder_id": "FOLDER_ID"
}

16. Share a folder

json
{
  "resource": "folder",
  "operation": "share",
  "folder_id": "FOLDER_ID",
  "type": "user",
  "role": "writer",
  "email_address": "person@example.com"
}

17. Search files or folders

Use a Google Drive query in query:

bash
curl -X POST https://auth.genium.one/api/google/drive \
  -H "Authorization: Bearer $USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":"fileFolder","operation":"search","query":"name contains '\''video'\'' and trashed = false","page_size":100,"fields":"nextPageToken,files(id,name,mimeType,parents,webViewLink,modifiedTime)"}'

If query is omitted, providing name creates a name-contains search.

Genium Social Hub