{
  "openapi": "3.1.0",
  "info": {
    "title": "OfficeMaker Free GPT API",
    "version": "1.1.5",
    "description": "OfficeMaker Free REST API for Custom GPT Actions (no API key). POST bodies: snake_case only (document_type, file_name, document_json). document_json is one stringified JSON string. Flow: GET /gpt/v1/minimal-schema?documentType=word (compact shape + optional schemaAttestation), optional getDocumentSchema (format=markdown), POST /gpt/v1/validate-document, then createDocument. Build one object in memory and serialize once at the HTTP boundary. Full rules: GET /gpt/v1/instructions."
  },
  "servers": [
    {
      "url": "https://free.officemaker.ai",
      "description": "OfficeMaker Free public host"
    }
  ],
  "paths": {
    "/gpt/v1/instructions": {
      "get": {
        "operationId": "getInstructions",
        "summary": "Get Custom GPT / Actions instructions",
        "description": "Full Custom GPT / Actions instruction text (markdown). Call at task start. Re-import this OpenAPI when the server version changes.",
        "responses": {
          "200": {
            "description": "Instructions and metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInstructionsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gpt/v1/schema": {
      "get": {
        "operationId": "getDocumentSchema",
        "summary": "Get live document schema",
        "description": "Prism schema for word, excel, or powerpoint. Use format=markdown for the authoring guide before createDocument. For a subtree only: schemaPath, path, or pointer—and omit format or use jsonschema.",
        "parameters": [
          {
            "name": "documentType",
            "in": "query",
            "required": false,
            "description": "Document family: word, excel, or powerpoint.",
            "schema": {
              "type": "string",
              "enum": [
                "word",
                "excel",
                "powerpoint"
              ],
              "default": "word"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Full guide: markdown (no schemaPath/path/pointer). Partial subtree: omit format or jsonschema only. json aliases the default MSOfficeCore JSON schema.",
            "schema": {
              "type": "string",
              "enum": [
                "markdown",
                "llm",
                "jsonschema",
                "spec",
                "tree",
                "examples",
                "json"
              ]
            }
          },
          {
            "name": "schemaPath",
            "in": "query",
            "required": false,
            "description": "Dot path for a partial JSON subtree. Requires JSON output: omit format or format=jsonschema.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "description": "Alias for schemaPath.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pointer",
            "in": "query",
            "required": false,
            "description": "RFC 6901 pointer or OpenAPI-style path; /properties/… maps like schemaPath. Word body blocks: content.children. Partial JSON only: omit format or jsonschema.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schema document or schema fragment.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Document family root, e.g. word"
                        }
                      },
                      "additionalProperties": true
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "Optional type discriminator on fragment nodes"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  ]
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters or unsupported partial schema request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gpt/v1/gap-analysis": {
      "get": {
        "operationId": "getGapAnalysis",
        "summary": "Get gap analysis",
        "description": "High-level gap notes for a document family (markdown or json). For exact create JSON shape, prefer getDocumentSchema with format=markdown.",
        "parameters": [
          {
            "name": "documentType",
            "in": "query",
            "required": false,
            "description": "Document family to inspect.",
            "schema": {
              "type": "string",
              "enum": [
                "word",
                "excel",
                "powerpoint"
              ],
              "default": "word"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Gap analysis output format.",
            "schema": {
              "type": "string",
              "enum": [
                "markdown",
                "json"
              ],
              "default": "markdown"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Gap analysis result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GapAnalysisJsonResponse"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/gpt/v1/minimal-schema": {
      "get": {
        "operationId": "getMinimalSchema",
        "summary": "Compact schema root for agents (same as GET /minimalSchema)",
        "parameters": [
          {
            "name": "documentType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "word",
                "excel",
                "powerpoint"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Minimal schema JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/gpt/v1/validate-document": {
      "post": {
        "operationId": "validateDocumentPayload",
        "summary": "Validate payload without creating a file",
        "description": "Body: document_type, file_name, document_json (object preferred; string form returns validation errors).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "document_type",
                  "file_name",
                  "document_json"
                ],
                "properties": {
                  "document_type": {
                    "type": "string",
                    "enum": [
                      "word",
                      "excel",
                      "powerpoint"
                    ]
                  },
                  "file_name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "document_json": {
                    "oneOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "description": "Prefer a JSON object; strings are flagged with guidance."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "validJson, validSchema, errors, warnings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/gpt/v1/create-document": {
      "post": {
        "operationId": "createDocument",
        "summary": "Create Office document",
        "description": "Create Word/Excel/PowerPoint. Body: document_type, file_name, document_json (one stringified JSON string, snake_case fields). Prefer documentDownloadUrl. Match getDocumentSchema(markdown).",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDocumentRequest"
              },
              "example": {
                "document_type": "word",
                "file_name": "example-doc",
                "document_json": "{\"type\":\"document\",\"content\":{\"children\":[{\"type\":\"paragraph\",\"children\":[{\"type\":\"text\",\"text\":\"Hello\"}]}]}}"
              },
              "examples": {
                "word_prism_root": {
                  "summary": "Word (recommended root shape)",
                  "description": "Prism/Word JSON: root type is \"document\" (not \"word\"). Block tree lives in content.children. HTTP field document_type stays \"word\". Avoid root-level \"children\" without \"content\", and avoid putting the only \"type\":\"document\" inside content without a root type.",
                  "value": {
                    "document_type": "word",
                    "file_name": "hello-world",
                    "document_json": "{\"type\":\"document\",\"content\":{\"children\":[{\"type\":\"paragraph\",\"children\":[{\"type\":\"text\",\"text\":\"Hello\"}]}]}}"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success: primary Office download is documentDownloadUrl (short /gpt/v1/file?token=...); pdfDownloadUrl / previewDownloadUrls for PDF/previews. Omit long S3 documentUrl/pdfUrl/previewUrls when *DownloadUrl fields exist. In chat, prefer markdown [label](exact_url) with URL copied verbatim from JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateDocumentSuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid document request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gpt/v1/create-preview": {
      "post": {
        "operationId": "createPreview",
        "summary": "Generate previews for a document",
        "description": "Generates preview images for an existing OfficeMaker document. Body uses snake_case: document_key and document_type (ChatGPT Actions).",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePreviewRequest"
              },
              "example": {
                "document_type": "word",
                "document_key": "anonymous/example-user/example.docx",
                "max_preview_pages": 2
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview generation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatePreviewSuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid preview request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GetInstructionsResponse": {
        "type": "object",
        "required": [
          "instructions",
          "format",
          "surface",
          "openApiInfoVersion"
        ],
        "additionalProperties": false,
        "properties": {
          "instructions": {
            "type": "string",
            "description": "Full markdown-oriented rule text for the Custom GPT (Actions)."
          },
          "format": {
            "type": "string",
            "enum": [
              "markdown"
            ],
            "description": "Encoding of the instructions field."
          },
          "surface": {
            "type": "string",
            "enum": [
              "gpt-actions"
            ],
            "description": "Which integration surface this text targets."
          },
          "openApiInfoVersion": {
            "type": "string",
            "description": "Matches info.version in this OpenAPI document when the response was generated."
          }
        }
      },
      "CreateDocumentRequest": {
        "type": "object",
        "required": [
          "document_type",
          "document_json",
          "file_name"
        ],
        "additionalProperties": true,
        "properties": {
          "document_type": {
            "type": "string",
            "enum": [
              "word",
              "excel",
              "powerpoint"
            ],
            "description": "Office family for the output file. This is separate from any \"type\" field inside document_json: Word uses inner root type \"document\"; PowerPoint uses inner root type \"powerpoint\" (never \"presentation\")."
          },
          "file_name": {
            "type": "string",
            "description": "Required file name stem (no path). Extension is chosen from document_type; avoid empty strings.",
            "minLength": 1
          },
          "document_json": {
            "type": "string",
            "minLength": 2,
            "description": "JSON.stringify(the document) as a single string—never a nested object. Match GET /gpt/v1/schema?documentType=…&format=markdown. Word: root type \"document\", blocks under content.children. PowerPoint: type \"powerpoint\" (not \"presentation\"). Excel: per schema.",
            "example": "{\"type\":\"document\",\"content\":{\"children\":[{\"type\":\"paragraph\",\"children\":[{\"type\":\"text\",\"text\":\"Hi\"}]}]}}"
          },
          "spec_key": {
            "type": "string",
            "description": "Optional alternative to document_json for large specs stored in S3 (advanced)."
          },
          "user_id": {
            "type": "string",
            "description": "Optional user identifier. If omitted, the free service uses an anonymous/free default."
          },
          "document_id": {
            "type": "string",
            "description": "Optional document identifier."
          },
          "generate_pdf": {
            "type": "boolean",
            "description": "Optional PDF output when supported. ChatGPT Actions: use snake_case generate_pdf (not generatePdf)."
          }
        }
      },
      "CreatePreviewRequest": {
        "type": "object",
        "required": [
          "document_key",
          "document_type"
        ],
        "additionalProperties": true,
        "properties": {
          "document_key": {
            "type": "string",
            "minLength": 1,
            "description": "S3 object key from createDocument success response. Not the display file name.",
            "example": "anonymous/.../document.docx"
          },
          "document_type": {
            "type": "string",
            "enum": [
              "word",
              "excel",
              "powerpoint"
            ]
          },
          "user_id": {
            "type": "string",
            "description": "Optional user identifier. If omitted, the free service uses an anonymous/free default."
          },
          "document_id": {
            "type": "string",
            "description": "Optional document identifier."
          },
          "max_preview_pages": {
            "type": "integer",
            "minimum": 1,
            "description": "Optional limit on the number of generated preview pages."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "success": {
            "type": "boolean"
          },
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "GapAnalysisJsonResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "documentType": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "totalFields": {
            "type": "integer"
          },
          "creationFields": {
            "type": "integer"
          },
          "conversionFields": {
            "type": "integer"
          },
          "bothFields": {
            "type": "integer"
          },
          "recommendations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateDocumentSuccessResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "success": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "documentType": {
            "type": "string"
          },
          "documentKey": {
            "type": "string"
          },
          "specKey": {
            "type": "string",
            "nullable": true
          },
          "documentUrl": {
            "type": "string",
            "description": "Long S3 presigned URL. Do not show users if documentDownloadUrl is set."
          },
          "documentDownloadUrl": {
            "type": "string",
            "description": "Primary .docx/.xlsx/.pptx download (short /gpt/v1/file?token=... on API host; TTL downloadExpiresIn). Use this URL in chat, not documentUrl. Markdown ok: [Download file](paste this string exactly)."
          },
          "pdfUrl": {
            "type": "string",
            "nullable": true
          },
          "pdfDownloadUrl": {
            "type": "string",
            "nullable": true,
            "description": "Short PDF link when set; prefer over pdfUrl for users."
          },
          "pdfKey": {
            "type": "string",
            "nullable": true
          },
          "previewUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Long S3 presigned URLs; prefer previewDownloadUrls for users."
          },
          "previewDownloadUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Short preview links; show these instead of previewUrls when present."
          },
          "previewKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expiresIn": {
            "type": "integer"
          },
          "downloadExpiresIn": {
            "type": "integer",
            "description": "Seconds until documentDownloadUrl (and related) expire, when present."
          },
          "urlFetchFailedRefs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "documentInsertionsApplied": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreatePreviewSuccessResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "success": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "previewUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Long S3 URLs; prefer previewDownloadUrls for users."
          },
          "previewDownloadUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Short preview links when present."
          },
          "previewDataUrls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "previewKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expiresIn": {
            "type": "integer"
          },
          "downloadExpiresIn": {
            "type": "integer"
          }
        }
      }
    }
  }
}