Access the OneNote API via Microsoft Graph with managed OAuth authentication. Create and manage notebooks, sections, section groups, and pages for note-taking and organization.
Reference
List Notebooks
GET /one-note/v1.0/me/onenote/notebooksExample:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFResponse:
{
"value": [
{
"id": "1-30487038-8c2e-440a-860d-e82c6dc74f10",
"displayName": "My Notebook",
"createdDateTime": "2026-03-12T10:25:00Z",
"lastModifiedDateTime": "2026-03-12T10:30:00Z",
"isDefault": true,
"isShared": false,
"sectionsUrl": "https://graph.microsoft.com/v1.0/me/onenote/notebooks/.../sections",
"sectionGroupsUrl": "https://graph.microsoft.com/v1.0/me/onenote/notebooks/.../sectionGroups"
}
]
}List Notebooks with Sections
Use $expand to include sections and section groups:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks?$expand=sections,sectionGroups')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFGet a Notebook
GET /one-note/v1.0/me/onenote/notebooks/{notebook_id}Example:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks/{notebook_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFCreate a Notebook
POST /one-note/v1.0/me/onenote/notebooks
Content-Type: application/json
{
"displayName": "New Notebook"
}Example:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'displayName': 'My New Notebook'}).encode()
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFCopy a Notebook
POST /one-note/v1.0/me/onenote/notebooks/{notebook_id}/copyNotebookExample:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'renameAs': 'Copied Notebook'}).encode()
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks/{notebook_id}/copyNotebook', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFNote: Copy operations are asynchronous. The response includes a status URL to check progress.
Get Recent Notebooks
GET /one-note/v1.0/me/onenote/notebooks/getRecentNotebooks(includePersonalNotebooks=true)Example:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks/getRecentNotebooks(includePersonalNotebooks=true)')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFList All Sections
GET /one-note/v1.0/me/onenote/sectionsExample:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/sections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFResponse:
{
"value": [
{
"id": "1-c9d63289-4f64-4579-9043-155543978c78",
"displayName": "My Section",
"createdDateTime": "2026-03-12T10:26:00Z",
"lastModifiedDateTime": "2026-03-12T10:28:00Z",
"isDefault": false,
"pagesUrl": "https://graph.microsoft.com/v1.0/me/onenote/sections/.../pages"
}
]
}List Sections in a Notebook
GET /one-note/v1.0/me/onenote/notebooks/{notebook_id}/sectionsExample:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks/{notebook_id}/sections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFGet a Section
GET /one-note/v1.0/me/onenote/sections/{section_id}Create a Section
POST /one-note/v1.0/me/onenote/notebooks/{notebook_id}/sections
Content-Type: application/json
{
"displayName": "New Section"
}Example:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'displayName': 'Meeting Notes'}).encode()
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks/{notebook_id}/sections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFList All Section Groups
GET /one-note/v1.0/me/onenote/sectionGroupsExample:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/sectionGroups')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFList Section Groups in a Notebook
GET /one-note/v1.0/me/onenote/notebooks/{notebook_id}/sectionGroupsGet a Section Group
GET /one-note/v1.0/me/onenote/sectionGroups/{section_group_id}Create a Section Group
POST /one-note/v1.0/me/onenote/notebooks/{notebook_id}/sectionGroups
Content-Type: application/json
{
"displayName": "New Section Group"
}Example:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'displayName': 'Project Notes'}).encode()
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/notebooks/{notebook_id}/sectionGroups', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFList All Pages
GET /one-note/v1.0/me/onenote/pagesExample:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/pages')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFResponse:
{
"value": [
{
"id": "1-42a904024c734393b561d0a85428965d!251-c9d63289-4f64-4579-9043-155543978c78",
"title": "My Page",
"createdDateTime": "2026-03-12T10:29:42Z",
"lastModifiedDateTime": "2026-03-12T10:30:00Z",
"contentUrl": "https://graph.microsoft.com/v1.0/me/onenote/pages/.../content"
}
]
}List Pages in a Section
GET /one-note/v1.0/me/onenote/sections/{section_id}/pagesGet a Page
GET /one-note/v1.0/me/onenote/pages/{page_id}Get Page Content
Returns the HTML content of a page:
GET /one-note/v1.0/me/onenote/pages/{page_id}/contentExample:
python <<'EOF'
import urllib.request, os
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/pages/{page_id}/content')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
resp = urllib.request.urlopen(req)
print(resp.read().decode())
EOFCreate a Page
Pages are created with HTML content:
POST /one-note/v1.0/me/onenote/sections/{section_id}/pages
Content-Type: text/html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<p>Page content here</p>
</body>
</html>Example:
python <<'EOF'
import urllib.request, os, json
html = """<!DOCTYPE html>
<html>
<head>
<title>Meeting Notes - March 12</title>
</head>
<body>
<h1>Meeting Notes</h1>
<p>Attendees: Alice, Bob, Charlie</p>
<ul>
<li>Discussed Q1 goals</li>
<li>Reviewed project timeline</li>
</ul>
</body>
</html>""".encode()
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/sections/{section_id}/pages', data=html, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'text/html')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOFUpdate Page Content
Use PATCH to append, insert, or replace content:
PATCH /one-note/v1.0/me/onenote/pages/{page_id}/content
Content-Type: application/json
[
{
"target": "body",
"action": "append",
"content": "<p>New paragraph added!</p>"
}
]Actions:
append- Add content at the end of targetprepend- Add content at the beginning of targetreplace- Replace target contentinsert- Insert after target
Example:
python <<'EOF'
import urllib.request, os, json
data = json.dumps([
{
"target": "body",
"action": "append",
"content": "<p>Updated at 2026-03-12</p>"
}
]).encode()
req = urllib.request.Request('https://api.maton.ai/one-note/v1.0/me/onenote/pages/{page_id}/content', data=data, method='PATCH')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
resp = urllib.request.urlopen(req)
print(f"Updated: {resp.status}")
EOF