If you are a parent account looking to copy documents to a subaccount, you can easily do so by following the below instructions:
First, gather your API keys for both Docs accounts - the parent account and the subaccount.
Find your Parent account api key in your account settings
-
Sign in to your Formstack Documents account.
-
Click on your profile in the top right corner.
-
Select "API Access."
-
Click "Create an API Key" to generate your key if you don’t already have one.
Then, use the Subaccount API to get a list of your subaccount’s API keys.
Once you have both API keys, follow these steps to copy a document from the parent account to the subaccount:
1. Fetch the document details you want to copy using the Get a Document endpoint:
GET https://www.webmerge.me/api/documents/
-
Replace
with the document ID from the parent account -
Use the parent account's API credentials for authentication
-
This will give you the document's properties (name, type, output settings, etc.)
If the document type is not HTML, use this endpoint to fetch the file:
GET https://www.webmerge.me/api/documents/
This will return the file contents encoded in base64, which you'll need for creating the document in the subaccount
2. Create a new document in the subaccount using the Create a Document endpoint:
POST https://www.webmerge.me/api/documents
-
Use the subaccount's API credentials for authentication
-
Include all the necessary parameters from the document in the parent account:
-
name: The name of the document
-
type: The document type ("html", "pdf", "docx", "xlsx", or "pptx")
-
output: The output format ("pdf", "docx", "xlsx", "pptx", or "email")
-
output_name: The custom filename for the merged document (if applicable)
-
folder: The folder name to save the document in (if applicable)
-
-
Include document content based on the document type:
-
For HTML documents:
-
Include the html parameter with the HTML content
-
Include any size parameters (size_width and size_height) if necessary
-
-
For PDF, DOCX, XLSX, or PPTX documents:
-
Include the file_contents parameter with the base64-encoded file content obtained in step 2
-
-