Document to Quiz Conversion API: Complete Developer Guide
Formswrite Team
•
February 15, 2026

Document to Quiz Conversion API: Complete Developer Guide
The Formswrite API is a REST API that converts documents into quizzes and forms across 25+ platforms. Write your quiz in a Google Doc, call the API, and get a ready-to-import file for Google Forms, Moodle, Canvas, Kahoot, Blackboard, or any other supported platform.
This guide covers everything you need to integrate the Formswrite API into your application.
API Overview
| Property | Value |
|---|---|
| Base URL | https://api.formswrite.com |
| Authentication | Bearer token (JWT) |
| Content-Type | application/json |
| Rate Limit | Based on subscription plan |
| Token Expiry | 365 days |
Authentication
All API requests require a Bearer token in the Authorization header.
Getting Your API Token
- Sign in to Formswrite
- Navigate to your account settings
- Generate an API token
Using Your Token
bash# Recommended: Authorization header
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://api.formswrite.com/api/v1/convert
# Alternative: X-Access-Token header
curl -H "X-Access-Token: YOUR_TOKEN" \
https://api.formswrite.com/api/v1/convert
# Alternative: Query parameter
curl "https://api.formswrite.com/api/v1/convert?token=YOUR_TOKEN"
Endpoints
POST /api/v1/convert
Convert a document to any supported format.
Request Body:
json{
"documentId": "string (required)",
"format": "string (required)",
"documentName": "string (optional)",
"async": false
}
| Parameter | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Google Doc ID or full URL |
format | string | Yes | Output format (see table below) |
documentName | string | No | Name for the output file |
async | boolean | No | Use async processing (default: false) |
Document ID formats:
# Raw document ID
"1abc123xyz"
# Full Google Docs URL (also accepted)
"https://docs.google.com/document/d/1abc123xyz/edit"
Supported Output Formats
| Format | API Value | File Type | Platform |
|---|---|---|---|
| Google Forms | google_form | — | Google Forms |
| Moodle XML | moodle | .xml | Moodle LMS |
| Canvas QTI | canvas | .zip | Canvas LMS |
| Blackboard | blackboard | .txt | Blackboard Learn |
| Brightspace | brightspace | .zip | Brightspace D2L |
| Schoology | schoology | .zip | Schoology |
| Sakai | sakai | .zip | Sakai LMS |
| Kahoot | kahoot | .csv | Kahoot |
| Quizizz | quizizz | .csv | Quizizz |
| Blooket | blooket | .csv | Blooket |
| Gimkit | gimkit | .csv | Gimkit |
| Socrative | socrative | .csv | Socrative |
| Wooclap | wooclap | .csv | Wooclap |
| Quizalize | quizalize | .csv | Quizalize |
| ClassMarker | classmarker | .csv | ClassMarker |
| Pear Assessment | pear_assessment | .csv | PEAR Assessment |
| QTI 2.1 | qti_21 | .zip | IMS QTI Standard |
| QTI 2.2 | qti_22 | .zip | IMS QTI Standard |
| GIFT | gift | .txt | Moodle GIFT |
| Aiken | aiken | .txt | Aiken Format |
| Cloze | cloze | .txt | Cloze (Moodle) |
| Microsoft Word | word | .docx | Microsoft Word |
| LearnDash | learndash | .txt | LearnDash (WordPress) |
| H5P | h5p | .zip | H5P Interactive |
Sync Mode (Default)
bashcurl -X POST https://api.formswrite.com/api/v1/convert \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"documentId": "1abc123xyz",
"format": "moodle",
"documentName": "Chapter 5 Quiz"
}'
Success Response (200):
json{
"success": true,
"exportId": "export-uuid",
"downloadUrl": "https://api.formswrite.com/api/forms/exports/export-uuid",
"fileName": "Chapter 5 Quiz-moodle.xml",
"format": "moodle",
"expiresAt": "2026-03-17T00:00:00.000Z"
}
The
downloadUrl is valid for 30 days.Async Mode
For large documents, use async mode to avoid request timeouts:
bashcurl -X POST https://api.formswrite.com/api/v1/convert \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"documentId": "1abc123xyz",
"format": "canvas",
"async": true
}'
Response (202):
json{
"success": true,
"status": "processing",
"jobId": "12345",
"message": "Document analysis queued. Poll for status.",
"pollUrl": "/api/v1/convert/status/12345"
}
GET /api/v1/convert/status/:jobId
Poll for async job status.
bashcurl https://api.formswrite.com/api/v1/convert/status/12345 \
-H "Authorization: Bearer YOUR_TOKEN"
Response:
json{
"success": true,
"jobId": "12345",
"state": "completed",
"progress": 100,
"result": {
"success": true,
"documentName": "Chapter 5 Quiz",
"isQuiz": true,
"mergedContent": {
"title": "Chapter 5 Quiz",
"introduction": "Answer the following questions",
"questions": [...]
}
}
}
Job states:
waiting → active → completed (or failed)Error Handling
| Status Code | Meaning | Example |
|---|---|---|
400 | Invalid request | Missing format or unsupported format |
401 | Unauthorized | Invalid or expired token |
402 | Payment required | No active subscription |
408 | Timeout | Document still processing (use async mode) |
500 | Server error | Internal error |
Error Response Format:
json{
"success": false,
"message": "Invalid format. Supported formats: google_form, moodle, canvas, ..."
}
Code Examples
Python — Convert and Download
pythonimport requests
API_TOKEN = "your_token"
def convert_doc(doc_id, format, name):
response = requests.post(
"https://api.formswrite.com/api/v1/convert",
headers={
"Authorization": f"Bearer {API_TOKEN}",
"Content-Type": "application/json"
},
json={
"documentId": doc_id,
"format": format,
"documentName": name
}
)
result = response.json()
if result.get("success"):
file_response = requests.get(result["downloadUrl"])
with open(result["fileName"], "wb") as f:
f.write(file_response.content)
return result["fileName"]
else:
raise Exception(result.get("message", "Conversion failed"))
# Usage
convert_doc("1abc123xyz", "moodle", "Biology Quiz")
convert_doc("1abc123xyz", "canvas", "Biology Quiz")
convert_doc("1abc123xyz", "kahoot", "Biology Quiz")
Node.js — Async with Polling
javascriptasync function convertDocument(docId, format, name) {
// Start async conversion
const response = await fetch('https://api.formswrite.com/api/v1/convert', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.FORMSWRITE_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
documentId: docId,
format,
documentName: name,
async: true
})
});
const { jobId } = await response.json();
// Poll for completion
while (true) {
const status = await fetch(
`https://api.formswrite.com/api/v1/convert/status/${jobId}`,
{ headers: { 'Authorization': `Bearer ${process.env.FORMSWRITE_TOKEN}` } }
);
const result = await status.json();
if (result.state === 'completed') return result;
if (result.state === 'failed') throw new Error(result.error);
await new Promise(r => setTimeout(r, 3000)); // Wait 3s
}
}
Zapier Webhook
javascript// In a Zapier "Code by Zapier" step:
const response = await fetch('https://api.formswrite.com/api/v1/convert', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + inputData.api_token,
'Content-Type': 'application/json'
},
body: JSON.stringify({
documentId: inputData.google_doc_id,
format: 'moodle',
documentName: inputData.quiz_name
})
});
output = await response.json();
AI-Powered Question Extraction
The Formswrite API uses AI to intelligently parse your Google Doc. It understands:
- Natural language question formatting
- Numbered and bulleted answer options
- Correct answers marked with bold, asterisks, or other conventions
- Section headers and introductions
- Images embedded in questions
- Point values and grading rubrics
You don't need to follow a rigid template. Write your quiz naturally and the AI handles the rest.
Integration Patterns
Webhook-Based Automation
Use Zapier, Make (Integromat), or n8n to trigger conversions automatically:
- Trigger: New file added to a Google Drive folder
- Action: Call Formswrite API to convert to Moodle XML
- Action: Upload the XML to your Moodle instance
CI/CD Pipeline
Integrate quiz generation into your build pipeline:
- Store quiz documents in a shared Google Drive
- Run a conversion script as part of your deployment
- Upload generated files to your LMS automatically
SaaS Integration
Build quiz conversion into your own platform:
- User uploads or selects a Google Doc
- Your backend calls the Formswrite API
- Return the download URL to your user
FAQ
What document formats can I use as input?
The API currently accepts Google Docs. You can pass a document ID or a full Google Docs URL.
How does the AI detect question types?
The AI analyzes the structure of your document — numbered lists become multiple choice, checkboxes become multi-select, and short prompts become short answer questions. Correct answers are detected from bold text, asterisks, or explicit markers.
Can I convert the same document to multiple formats?
Yes. Call the API multiple times with different
format values. Each call is independent.How long are download URLs valid?
Download URLs expire after 30 days.
Is the API available in all regions?
Yes. The API is accessible globally with no regional restrictions.
Can I use this for commercial purposes?
Yes. The API is available for commercial use under any paid Formswrite subscription plan.
What happens if my document has no questions?
The AI will still process the document and return structured content. If no questions are detected, the output may contain only metadata (title, introduction).
Get Started
Sign up for Formswrite to get your API token and start converting documents to quizzes and forms programmatically. One API, 25+ output formats.