Exams
Create an exam
POST
/registries/{registryId}/examsCreate one session. For many at once, POST a CSV to /exams/import.
curl -X POST "https://api.facetrustai.com/v1/registries/3f9a1c2e-7b4d-4e6a-9c8b-2d1e0f5a6b7c/exams" \ -H "Authorization: Bearer $FACETRUST_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "courseCode": "CSC 301", "courseTitle": "Data Structures", "startsAt": "2026-11-26T09:00:00Z", "endsAt": "2026-11-26T11:00:00Z", "venue": "CBT Hall A" }'
// Node.js 18+, ES module (built-in fetch and FormData) const res = await fetch('https://api.facetrustai.com/v1/registries/3f9a1c2e-7b4d-4e6a-9c8b-2d1e0f5a6b7c/exams', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FACETRUST_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({ "courseCode": "CSC 301", "courseTitle": "Data Structures", "startsAt": "2026-11-26T09:00:00Z", "endsAt": "2026-11-26T11:00:00Z", "venue": "CBT Hall A" }), }); const data = await res.json();
import os, uuid, requests res = requests.post( "https://api.facetrustai.com/v1/registries/3f9a1c2e-7b4d-4e6a-9c8b-2d1e0f5a6b7c/exams", headers={"Authorization": f"Bearer {os.environ['FACETRUST_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "courseCode": "CSC 301", "courseTitle": "Data Structures", "startsAt": "2026-11-26T09:00:00Z", "endsAt": "2026-11-26T11:00:00Z", "venue": "CBT Hall A" }, timeout=15, ) res.raise_for_status() data = res.json()
200 · application/json
{
"id": "b2f0c9d1-3a4e-4b5c-8d7e-6f1a2b3c4d5e",
"courseCode": "CSC 301",
"courseTitle": "Data Structures",
"startsAt": "2026-11-26T09:00:00Z",
"endsAt": "2026-11-26T11:00:00Z",
"venue": "CBT Hall A",
"eligibleCount": 0
}Use it for
Push the timetable from your academic system.
School accounts only
This endpoint is available to School accounts. Calls from other account types return
403 account_type_forbidden.Headers#
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <key>, a key with the exams:write scope. See Authentication. |
Idempotency-Key | No | A UUID you generate. Retrying with the same key returns the original result. See Conventions. |
Content-Type | Yes | application/json |
Path parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
registryId | uuid | Yes | Your registry. Shown on this page and in the console under Registry. |
Body parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
courseCode | string | Yes | e.g. "CSC 301". |
courseTitle | string | Yes | None |
startsAt | ISO 8601 | Yes | None |
endsAt | ISO 8601 | Yes | Must be after startsAt. |
venue | string | Yes | None |
Response#
Returns 200 with the body shown in the response example. Examples follow the account type selected at the top of the page.
Shown above, with the request.
Errors#
| Code | HTTP | Meaning |
|---|---|---|
unauthorized | 401 | Missing, malformed, revoked or expired API key. |
forbidden_scope | 403 | The key doesn’t have the scope this endpoint needs. |
account_type_forbidden | 403 | This endpoint isn’t available to your account type. |
module_disabled | 403 | The module is switched off for your account. Contact FaceTrust. |
ip_not_allowed | 403 | The request came from an IP outside the key’s allowlist. |
rate_limited | 429 | Too many requests. Wait for Retry-After seconds. |
validation_failed | 422 | The request body failed validation; see fields for per-field errors. |