A Google Drive API mock for creating files.
Your agent works with seeded files, folders and permissions. Check its file-creation request, then retrieve the file’s name, parent folder and sharing permissions.
file_createdCalls POST /drive/v3/files
Starting records
files
- id
1S5hb_FhQvm4ktmAiEQw6JGnEikjLH30U- name
Acme- description
Shared team folder. Everyone at Acme can edit.
users
ancha@acme.example- name
Ancha assistant
Connect your agent to the Google Drive mock
When ancha runs your agent, it sets:
GOOGLE_DRIVE_API_URLGOOGLE_DRIVE_ACCESS_TOKEN
Point the client you already use at them.
import { auth, drive } from '@googleapis/drive';
const oauth = new auth.OAuth2();
oauth.setCredentials({ access_token: process.env.GOOGLE_DRIVE_ACCESS_TOKEN });
const files = drive({ version: 'v3', auth: oauth });
const options = { rootUrl: process.env.GOOGLE_DRIVE_API_URL + '/', retry: false };
const { data } = await files.files.list({ q: "trashed = false", fields: 'files(id, name, mimeType)' }, options);Locally, ancha runs your agent as an ordinary process, so keep real Google Drive credentials out of its environment.
See all 26 endpoints
drive
/drive/v3/about/drive/v3/changes/drive/v3/changes/startPageToken/drive/v3/files/drive/v3/files/drive/v3/files/{fileId}/drive/v3/files/{fileId}/drive/v3/files/{fileId}/drive/v3/files/{fileId}/comments/drive/v3/files/{fileId}/comments/drive/v3/files/{fileId}/comments/{commentId}/drive/v3/files/{fileId}/comments/{commentId}/drive/v3/files/{fileId}/comments/{commentId}/drive/v3/files/{fileId}/comments/{commentId}/replies/drive/v3/files/{fileId}/comments/{commentId}/replies/drive/v3/files/{fileId}/copy/drive/v3/files/{fileId}/export/drive/v3/files/{fileId}/permissions/drive/v3/files/{fileId}/permissions/drive/v3/files/{fileId}/permissions/{permissionId}/drive/v3/files/{fileId}/permissions/{permissionId}/drive/v3/files/{fileId}/permissions/{permissionId}/drive/v3/files/{fileId}/revisions/drive/v3/files/trashupload
/upload/drive/v3/files/upload/drive/v3/files/{fileId}Seed your own data
The data the Google Drive mock starts with on every run, cut to a few records. ancha twins seed google-drive prints every field.
Full seed YAML
twins:
- google-drive
seed:
google-drive:
domain: acme.example
me: ancha@acme.example
users:
- email: ancha@acme.example
name: Ancha assistant
- email: ben@acme.example
name: Ben Carter
files:
- id: 1S5hb_FhQvm4ktmAiEQw6JGnEikjLH30U
name: Acme
mimeType: application/vnd.google-apps.folder
owner: ben@acme.example
description: Shared team folder. Everyone at Acme can edit.
created: -2000h
permissions:
- type: domain
domain: acme.example
role: writer
allowFileDiscovery: true
Check what your agent did
Checks YAML
checks:
- id: file_created
trace:
called: POST /drive/v3/filesMore docs and files tools
All 43 toolsGoogle Drive API mock FAQ
How can a Drive API mock find files inside a particular folder?
Use a q expression such as 'folder_id' in parents and trashed = false on GET /, replacing folder_id with the folder's ID. Ancha combines those filters and returns files the caller can access and list.
Do files inherit folder sharing permissions in the Drive sandbox?
The mock combines a file's own permissions with permissions inherited from its parent folders. GET / returns the resulting permissions, including the file owner.
What should I send when an agent moves a Drive file between folders?
Use PATCH / with addParents for the destination and removeParents for the old parent. Adding a different parent while retaining the current one returns 403 cannotAddParent in the mock. A successful move updates the file's parent, version and modified time.
Install the CLI and run your agent against the Google Drive mock.
Ancha is not affiliated with Google Drive.