A Microsoft Word API mock for organizing documents.

Your agent works with seeded documents through Microsoft Graph. Create a folder under Contracts, then list its children to check the folder’s name and location.

Connect your agent
The test
  • folder_created

    Calls POST /v1.0/me/drive/items/*/children

Starting records

  • items

    path
    /Contracts
  • users

    email
    ancha@acme.example
    displayName
    Ancha Assistant

Connect your agent to the Microsoft Word mock

When ancha runs your agent, it sets:

  • MICROSOFT_GRAPH_API_URL
  • MICROSOFT_GRAPH_ACCESS_TOKEN

Point the client you already use at them.

import { Client } from '@microsoft/microsoft-graph-client';
const token = process.env.MICROSOFT_GRAPH_ACCESS_TOKEN!;
const graph = Client.init({ baseUrl: process.env.MICROSOFT_GRAPH_API_URL + '/', defaultVersion: 'v1.0', authProvider: (done) => done(null, token), fetchOptions: { headers: { authorization: 'Bearer ' + token } } });
const files = await graph.api('/me/drive/root/children').get();
// Next page: graph.api(files['@odata.nextLink'].slice(files['@odata.nextLink'].indexOf('/v1.0') + 5)).get()

Locally, ancha runs your agent as an ordinary process, so keep real Microsoft Word credentials out of its environment.

See all 21 endpoints

download

GET/download/{token}

monitor

GET/monitor/{token}

v1

GET/v1.0/me
GET/v1.0/me/drive
GET/v1.0/me/drive/items/{item-id}
PATCH/v1.0/me/drive/items/{item-id}
DELETE/v1.0/me/drive/items/{item-id}
GET/v1.0/me/drive/items/{item-id}/children
POST/v1.0/me/drive/items/{item-id}/children
GET/v1.0/me/drive/items/{item-id}/content
POST/v1.0/me/drive/items/{item-id}/copy
POST/v1.0/me/drive/items/{item-id}/createLink
POST/v1.0/me/drive/items/{item-id}/invite
GET/v1.0/me/drive/items/{item-id}/permissions
DELETE/v1.0/me/drive/items/{item-id}/permissions/{perm-id}
GET/v1.0/me/drive/items/{item-id}/versions
GET/v1.0/me/drive/items/{item-id}/versions/{version-id}/content
POST/v1.0/me/drive/items/{item-id}/versions/{version-id}/restoreVersion
PUT/v1.0/me/drive/items/{parent-id}:/{filename}:/content
GET/v1.0/me/drive/recent
GET/v1.0/me/drive/root/search(q='{text}')

Seed your own data

The data the Microsoft Word mock starts with on every run, cut to a few records. ancha twins seed microsoft-word prints every field.

Full seed YAML
twins:
  - microsoft-word
seed:
  microsoft-word:
    tenant:
      name: Acme
      domain: acme.example
    me: ancha@acme.example
    users:
      - email: ancha@acme.example
        displayName: Ancha Assistant
        jobTitle: Automation service account
    items:
      - path: /Contracts
        kind: folder
        created: -5000h

Check what your agent did

Checks YAML
checks:
  - id: folder_created
    trace:
      called: POST /v1.0/me/drive/items/*/children

More docs and files tools

All 43 tools

Microsoft Word API mock FAQ

Can my document agent find a Word file by words inside it?

Ancha’s Microsoft Word mock searches file names and text extracted from .docx files through /v1.0/me/drive/root/search(q='{text}'). Every search word must appear, and matching ignores letter case.

How do I catch an agent overwriting a newer document version?

Send the document’s eTag in If-Match when replacing its content in the mock. A stale tag returns 412 with resourceModified before the file changes.

Does uploading revised Word content create a version I can inspect?

Replacing a file through PUT /v1.0/me/drive/items/{item-id}/content stores the new bytes and adds a version in the mock. GET /v1.0/me/drive/items/{item-id}/versions lists versions newest first, with id, lastModifiedDateTime, size and lastModifiedBy.

Install the CLI and run your agent against the Microsoft Word mock.

Book a demo

Ancha is not affiliated with Microsoft Word.