Building with AI agents on the Authmarks API: set-up, guardrails and workflows for Australian unis
A practical guide for uni IT and LMS teams using coding agents with Authmarks: what context to give the agent, token guardrails, a healthy set-up checklist, two worked workflows and rules agents can follow.
Published 2026-11-26 · 6 min read
| Machine-readable API | https://www.authmarks.com/api/v1/openapi.json |
|---|---|
| Developer page index | https://www.authmarks.com/llms.txt |
| MCP endpoint | https://www.authmarks.com/api/mcp |
| Auth | Bearer token (amk_ organisation API token) |
| Access | Read-only, no writes |
What this page gives you: a tested pattern for letting coding agents (Claude Code, Cursor, Copilot, Codex and others) safely build reports and checks on top of Authmarks. You'll see which two URLs to hand the agent, which instructions keep tokens out of prompts and repositories, a checklist for a healthy set-up, two complete worked workflows, and a short list of rules written for the agents themselves. The API and the MCP server are read-only, so the worst an agent can do with a correctly scoped token is read data you've already allowed it to read. That matters to a uni IT services team weighing up whether to let an agent near student information at all.
Give the agent the right context
Agents write better code when they read the real contract rather than guessing at it. Hand them two URLs:
| URL | What it is |
|---|---|
https://www.authmarks.com/api/v1/openapi.json | The OpenAPI 3.1 document: every endpoint, parameter, field and error. |
https://www.authmarks.com/llms.txt | A plain-text index of every developer page, written for language models to read. |
A solid opening prompt:
We are building an internal report on top of the Authmarks REST API.
Read https://www.authmarks.com/api/v1/openapi.json and https://www.authmarks.com/llms.txt first.
The API is read-only. The token is in the AUTHMARKS_TOKEN environment variable and the
organisation id in AUTHMARKS_ORG. Never print, log or hard-code the token.
If your agent can also use MCP, connect it using the MCP setup so it can look at real data while it writes the code.
Guardrails to put in your agent instructions
Add these to the file your agent reads on every run (CLAUDE.md, AGENTS.md, .cursor/rules, or whatever your tool uses):
## Authmarks API rules
- Base URL: https://www.authmarks.com/api/v1/orgs/$AUTHMARKS_ORG. Contract: https://www.authmarks.com/api/v1/openapi.json
- Read the token from the AUTHMARKS_TOKEN environment variable. Never ask for it, print it, log it,
paste it into a prompt, write it to a file or commit it.
- Never put the token in browser or client-side code.
- The API is read-only (GET/HEAD). Do not write code that expects to change Authmarks data.
- Page with `limit` (max 200) and `next_cursor` until it is null. Never build cursors.
- On 429, wait the Retry-After seconds. Retry 503 with backoff. Do not retry 401/403.
- Treat student names and emails as personal data: do not print them in logs or test fixtures.
- Ids are opaque strings. Timestamps are ISO 8601 UTC.
Then give the agent a dedicated, read-only token with an expiry, holding only the scopes the task needs. See Authentication and scopes.
Healthy setup checklist
- A separate token for each tool and each person (
agent-cursor-jlee,report-nightly-ci), never a shared one. - Only the scopes the job needs.
records_readonly where student submissions are actually needed. - An expiry on every agent token, as short as the job allows.
- Tokens kept in environment variables or a secrets manager, never in code, prompts or chat.
-
.envlisted in.gitignore, plus a secret-scanning rule foramk_[A-Za-z0-9_-]{43}. - A monthly check of last used in Settings → Developers, revoking tokens nobody uses.
- Rotation on a schedule, and whenever someone with access leaves.
- A named owner for every scheduled job, written down next to the job.
- If you stream the admin audit log to a SIEM, alerts on token creation and revocation (audit stream).
Student names and email addresses are personal information. In Australia, the Privacy Act 1988 and the Australian Privacy Principles generally cover how organisations collect, use and disclose it; your uni's privacy office decides how they apply to agent tooling, so it's worth looping them in before an agent touches records_read data.
Workflow 1: nightly report of unsealed submissions
Goal: each night, list submissions not yet sealed for assignments due in the last seven days, and post the counts to your team (for example, the teaching team for a large first-year unit during assessment weeks).
Token scopes: assignments_read, records_read.
Prompt for the agent:
Write a Python script, report_unsealed.py, that:
1. Lists all assignments (page through next_cursor, limit=200).
2. Keeps assignments whose due_at is within the last 7 days.
3. For each, lists all submissions and counts sealed vs not sealed.
4. Prints one line per assignment: title, due date, sealed count, unsealed count.
Use requests. Read AUTHMARKS_TOKEN and AUTHMARKS_ORG from the environment.
Honor Retry-After on 429. Do not print student emails.
A script along the lines of what the agent should produce:
import os
import time
from datetime import datetime, timedelta, timezone
import requests
BASE = f"https://www.authmarks.com/api/v1/orgs/{os.environ['AUTHMARKS_ORG']}"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['AUTHMARKS_TOKEN']}"
def pages(path):
cursor = None
while True:
response = session.get(f"{BASE}{path}", params={"limit": 200, "cursor": cursor}, timeout=30)
if response.status_code == 429:
time.sleep(int(response.headers.get("Retry-After", "60")))
continue
response.raise_for_status()
body = response.json()
yield from body["data"]
cursor = body["next_cursor"]
if not cursor:
return
def parse(ts):
return datetime.fromisoformat(ts.replace("Z", "+00:00")) if ts else None
now = datetime.now(timezone.utc)
for assignment in pages("/assignments"):
due = parse(assignment["due_at"])
if due is None or not (now - timedelta(days=7) <= due <= now):
continue
sealed = unsealed = 0
for submission in pages(f"/assignments/{assignment['id']}/submissions"):
if submission["sealed"]:
sealed += 1
else:
unsealed += 1
print(f"{assignment['title']}\tdue {due:%Y-%m-%d}\tsealed {sealed}\tunsealed {unsealed}")
Run it from CI on a schedule, with the token stored as an encrypted CI secret:
# .github/workflows/authmarks-nightly.yml
on:
schedule: [{ cron: "0 6 * * *" }]
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install requests && python report_unsealed.py
env:
AUTHMARKS_TOKEN: ${{ secrets.AUTHMARKS_TOKEN }}
AUTHMARKS_ORG: ${{ vars.AUTHMARKS_ORG }}
Cron in CI runs on UTC, so 0 6 * * * fires at 06:00 UTC, which is late afternoon on the east coast of Australia (16:00 AEST, 17:00 AEDT). Adjust the hour to suit when your team wants the report.
Workflow 2: LMS health check that alerts on failed grade returns
Goal: every 15 minutes, look for connections waiting for approval and for grade returns that failed in the last hour, and raise an alert if there are any.
Token scope: lms_read and nothing else.
// lms-health.mjs (Node.js 18+)
const BASE = `https://www.authmarks.com/api/v1/orgs/${process.env.AUTHMARKS_ORG}`;
const headers = { Authorization: `Bearer ${process.env.AUTHMARKS_TOKEN}` };
const since = Date.now() - 60 * 60 * 1000;
async function get(path) {
const response = await fetch(`${BASE}${path}`, { headers });
if (!response.ok) {
throw new Error(`${path}: HTTP ${response.status}`);
}
return response.json();
}
const problems = [];
const connections = await get("/lms-connections");
for (const connection of connections.data) {
if (connection.status === "pending") {
problems.push(`${connection.label}: waiting for approval since ${connection.created_at}`);
}
if (connection.status !== "active") continue;
// Do not assume an order: filter by time on every page.
let cursor = null;
do {
const query = new URLSearchParams({ limit: "200" });
if (cursor) query.set("cursor", cursor);
const page = await get(`/lms-connections/${connection.id}/grade-returns?${query}`);
for (const ret of page.data) {
if (ret.status === "failed" && Date.parse(ret.created_at) >= since) {
problems.push(`${connection.label}: grade return ${ret.id} failed at ${ret.created_at}`);
}
}
cursor = page.next_cursor;
} while (cursor);
}
if (problems.length > 0) {
await fetch(process.env.ALERT_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: `Authmarks LMS health:\n${problems.join("\n")}` }),
});
process.exitCode = 1;
}
ALERT_WEBHOOK_URL is your own chat or paging webhook (Slack, Teams, PagerDuty). How to fix failed returns is covered in Troubleshooting LTI and Grades and roster.
You can ask the same question interactively through MCP: "List grade returns that failed in the last hour for every active connection."
For agents: rules to follow
If you're an AI agent working with Authmarks, follow these rules:
- Read
https://www.authmarks.com/api/v1/openapi.jsonbefore you write any API code. Don't invent endpoints or fields. - The API and the MCP server are read-only. There's no way to create, change or delete data through them. Don't try.
- Read the token only from the
AUTHMARKS_TOKENenvironment variable. Never print it, log it, echo it in shell commands, write it to files, include it in commits, or ask the user to paste it into the conversation. - Never put the token in browser, mobile or extension code.
- Use
Authorization: Bearer <token>. Never put the token in a URL. - Page with
limit(1 to 200) andcursoruntilnext_cursorisnull. Don't build or alter cursors. - On
429, waitRetry-Afterseconds. Retry503with backoff. Don't retry401or403; report which scope or token is wrong. - Treat
student.nameandstudent.emailas personal information. Don't copy them into logs, fixtures, issues or summaries unless the user asked for them. - Treat ids as opaque strings and timestamps as ISO 8601 UTC.
- The API returns no scores or percentages. Don't infer or describe any about a student's writing.
- If a scope is missing, tell the user which scope to add, and that an owner or admin creates tokens in Settings → Developers.
Related pages
Sources
- The llms.txt proposal — as of 2026-11-26
- OpenAPI Specification 3.1.0 — as of 2026-11-26
- Model Context Protocol specification (2025-06-18) — as of 2026-11-26
Change notes
- 2026-11-26 — First published for Australian readers.
Spotted an error? Email sales@authmarks.com and we will correct the page and date the correction.