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.

Connect your agent
The test
  • file_created

    Calls POST /drive/v3/files

Starting records

  • files

    id
    1S5hb_FhQvm4ktmAiEQw6JGnEikjLH30U
    name
    Acme
    description
    Shared team folder. Everyone at Acme can edit.
  • users

    email
    ancha@acme.example
    name
    Ancha assistant

Connect your agent to the Google Drive mock

When ancha runs your agent, it sets:

  • GOOGLE_DRIVE_API_URL
  • GOOGLE_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

GET/drive/v3/about
GET/drive/v3/changes
GET/drive/v3/changes/startPageToken
GET/drive/v3/files
POST/drive/v3/files
GET/drive/v3/files/{fileId}
PATCH/drive/v3/files/{fileId}
DELETE/drive/v3/files/{fileId}
GET/drive/v3/files/{fileId}/comments
POST/drive/v3/files/{fileId}/comments
GET/drive/v3/files/{fileId}/comments/{commentId}
PATCH/drive/v3/files/{fileId}/comments/{commentId}
DELETE/drive/v3/files/{fileId}/comments/{commentId}
GET/drive/v3/files/{fileId}/comments/{commentId}/replies
POST/drive/v3/files/{fileId}/comments/{commentId}/replies
POST/drive/v3/files/{fileId}/copy
GET/drive/v3/files/{fileId}/export
GET/drive/v3/files/{fileId}/permissions
POST/drive/v3/files/{fileId}/permissions
GET/drive/v3/files/{fileId}/permissions/{permissionId}
PATCH/drive/v3/files/{fileId}/permissions/{permissionId}
DELETE/drive/v3/files/{fileId}/permissions/{permissionId}
GET/drive/v3/files/{fileId}/revisions
DELETE/drive/v3/files/trash

upload

POST/upload/drive/v3/files
PATCH/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/files

More docs and files tools

All 43 tools

Google 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 /drive/v3/files, 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 /drive/v3/files/{fileId}/permissions returns the resulting permissions, including the file owner.

What should I send when an agent moves a Drive file between folders?

Use PATCH /drive/v3/files/{fileId} 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.

Book a demo

Ancha is not affiliated with Google Drive.