Google Docs to Forms - Formswrite.com logo
BlogPricing

Document to Quiz Conversion API: Complete Developer Guide

Formswrite Team

February 15, 2026

Document to Quiz Conversion API: Complete Developer Guide

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

PropertyValue
Base URLhttps://api.formswrite.com
AuthenticationBearer token (JWT)
Content-Typeapplication/json
Rate LimitBased on subscription plan
Token Expiry365 days

Authentication

All API requests require a Bearer token in the Authorization header.

Getting Your API Token

  1. Sign in to Formswrite
  2. Navigate to your account settings
  3. 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
}
ParameterTypeRequiredDescription
documentIdstringYesGoogle Doc ID or full URL
formatstringYesOutput format (see table below)
documentNamestringNoName for the output file
asyncbooleanNoUse 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

FormatAPI ValueFile TypePlatform
Google Formsgoogle_formGoogle Forms
Moodle XMLmoodle.xmlMoodle LMS
Canvas QTIcanvas.zipCanvas LMS
Blackboardblackboard.txtBlackboard Learn
Brightspacebrightspace.zipBrightspace D2L
Schoologyschoology.zipSchoology
Sakaisakai.zipSakai LMS
Kahootkahoot.csvKahoot
Quizizzquizizz.csvQuizizz
Blooketblooket.csvBlooket
Gimkitgimkit.csvGimkit
Socrativesocrative.csvSocrative
Wooclapwooclap.csvWooclap
Quizalizequizalize.csvQuizalize
ClassMarkerclassmarker.csvClassMarker
Pear Assessmentpear_assessment.csvPEAR Assessment
QTI 2.1qti_21.zipIMS QTI Standard
QTI 2.2qti_22.zipIMS QTI Standard
GIFTgift.txtMoodle GIFT
Aikenaiken.txtAiken Format
Clozecloze.txtCloze (Moodle)
Microsoft Wordword.docxMicrosoft Word
LearnDashlearndash.txtLearnDash (WordPress)
H5Ph5p.zipH5P 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: waitingactivecompleted (or failed)

Error Handling

Status CodeMeaningExample
400Invalid requestMissing format or unsupported format
401UnauthorizedInvalid or expired token
402Payment requiredNo active subscription
408TimeoutDocument still processing (use async mode)
500Server errorInternal 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:
  1. Trigger: New file added to a Google Drive folder
  2. Action: Call Formswrite API to convert to Moodle XML
  3. Action: Upload the XML to your Moodle instance

CI/CD Pipeline

Integrate quiz generation into your build pipeline:
  1. Store quiz documents in a shared Google Drive
  2. Run a conversion script as part of your deployment
  3. Upload generated files to your LMS automatically

SaaS Integration

Build quiz conversion into your own platform:
  1. User uploads or selects a Google Doc
  2. Your backend calls the Formswrite API
  3. 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.

Share this post with your network


Formswrite - Google Docs to Forms Converter

Create forms in seconds, not hours

Convert Google Docs to Forms with one click

Save hours on quiz creation every month.

No more manual form creation. No more formatting hassles.

We care about your data in our privacy policy

© 2026 Formswrite. All Rights Reserved.