Create documents with the Web Editor
The Pages (Web Editor) REST API lets your system open a document for editing or send data straight to PDF production. These features require Doxis Interact to be installed.
Every call needs a bearer token from a Standard API client. See Authentication.
Hosts and environments
Pages has two API hosts.
| Version | API host |
|---|---|
| Pages v4 | api.webeditor-v4.metaforce.net |
| Pages v3 | api.webeditor.metaforce.net |
The pages in this part describe Pages v4, and the examples use its host. On Pages v3, use the Pages v3 host and check each call in the Pages v3 reference, which is linked from REST API.
Every path starts with the environment, for example /Development/dxml/create. The values are Development, Test, Test1, Test2, Test3, Test4, Test5, IntegrationTest, AcceptanceTest and Production. Most calls also take an optional last segment with an environment group name or id. Leave it out unless you work with environment groups.
A Pages environment can be set up to require an environment scope. A call to such an environment needs a token from a client that has that Webeditor Scope, otherwise it is refused. See Create an API client.
Base64
WebEditor will need document metadata to be in a Base64 string. There are online tools that will help you doing this (search the internet for Base64 XML) or you could write a small function that will do it for you.
This function is for Digital Ocean and will transform JSON input to a valid WebEditor XML before it is transformed into Base64:
const json2xml = require("json2xml")
const axios = require("axios")
async function main(args)
{
console.log(args);
// keep this need to delete fro json body
delete args.http
delete args.__ow_headers
delete args.__ow_path
delete args.__ow_method
// keep this need to delete fro json body
Object.keys(args).forEach(k => !args[k] && delete args[k])
const xmlver = "<?xml version='1.0' encoding='utf-8'?>"
const xmlData = xmlver + "<Data>" + json2xml(args) + "</Data>";
const base64Data = Buffer.from(xmlData).toString('base64');
return {"body": base64Data }
}
exports.main=mainXML Sample data
You will need to construct some XML data with input elements that are used in the Interact template. This is one example:
<?xml version='1.0' encoding='utf-8'?>
<Data>
<Contact
ContactAccountId="0012o00002OkJbTAAV"
ContactAccountName__c="Dickenson plc"
ContactAssistantName="Marie Curie"
ContactAssistantPhone="(785) 265-5350"
ContactBirthdate="2000-09-20"
ContactCleanStatus="Pending"
ContactCount__c="123"
ContactDepartment="Internal Operations"
ContactDescription="(785) 265-5350"
ContactDoNotCall="false"
ContactEmail="a_young@dickenson.com"
ContactFax="1234567"
ContactFirstName="Andy"
ContactHasOptedOutOfEmail="false"
ContactHasOptedOutOfFax="false"
ContactHomePhone="(524) 232.2123"
ContactId="0032o00002WtQjkAAF"
ContactIsEmailBounced="false"
/>
</Data>Once you have managed to create a XML and converted it to Base64 you are ready to use the API to create documents
DXML
If you would like to create a document that can be edited, you will need to create a DXML. When creating a DXML you will get a link that will start an edit session for the document.
API Call: https://api.webeditor-v4.metaforce.net/Development/dxml/create
For data as JSON instead of XML, call /{customerEnvironment}/dxml/create/jsondata. The body is the same.
| Field | What it is |
|---|---|
MetaFile | The MetaFile that holds the document. Required. |
Document | The document template in the MetaFile. Required. |
DataAsBase64 | The XML or JSON data as a base64 string. Required. |
UserName | The user name that is written to the audit log. Required. |
SenderCallBackEndpoint | Optional. A URL that Doc Gen calls when the editing is done. See Callback. |
SenderCallBackUserName, SenderCallBackPassword | Optional. Basic authentication for the callback. |
AttributeStoreKey | Optional. A key for metadata that is fetched and merged with your data. |
Source | Optional. The system name shown in Statistics. The default is the name of the MetaFile. |
Attachments | Optional. A list of attachments. See Attachments. |
Example of body parameters in Postman:
{
"username" : "User",
"DataAsBase64": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz4KPERhdGEgREVTQ1JJUFRJT049XRhPg==// TRUNCATED// ",
"Document": "CaseLetter1",
"MetaFile": "CompanyLetters"
}Sample response:
{
"DxmlUID": "c8dda6d7-b137-4a3f-ae1c-e46db95482a1",
"StartURL": "https://<Pages host>/WebEditor/0alIQV0R4KFP4I30r33qjiDFmKr57E%2BlU9e%2B8fpTgGXBRnjuuJ9QtzJbV9HoH59LBAUc6nOeCqXcbNfsThIOlM%2Frv%2B3MwUpm3f318Y2LbA0qw3GwCuhCNp2qgozLlUgUVPkBscSLfcBfMXyVi7OdLA%3D%3D",
"ValidTo": "2026-09-10T05:54:47.6835658Z"
}
DxmlUIDidentifies the session. Keep it, because every follow-up call uses it.StartURLopens the editor. By copying it into the browser you start a Web Editor session to edit the document.ValidTois when the session is deleted. The document is editable until then. The retention policy controls this date.JWTappears only when Require JWT Authentication is turned on for your company. Add it to the end of the start URL asStartURL?jwt=JWTto start the session.
A call can also answer 204, when the data should not produce a document, or 406, when the data cannot be produced because logic is missing in the MetaFile.
Attachments
Each attachment in Attachments has:
| Field | What it is |
|---|---|
Type | MFL, PDF or AXML. |
MetaFile, Document | The document in a MetaFile to attach. Use them for type MFL. |
FileAsBase64 | A file as a base64 string. Use it for type PDF or AXML. |
PageRanges | Optional. The pages of the file to use, each with a Start and an End page number. |
Pdf2AxmlOptions | Optional. How a PDF is turned into images: Duplex, Dpi (default 150), ColorDepth (BW or Color) and Masks. Each mask is a box with X, Y, CX and CY and a colour in R, G and B. |
Name, Order | Optional. A name for the attachment, and its place in the list. |
Attachments works on the DXML and data calls on this page and on PDF and other outputs. The HTML calls take no attachments.
To look up attachments that are published in your MetaFiles, call POST /{customerEnvironment}/attachments. Send Top, the largest number of hits you want. It is required. You can add Id for an exact match and Name, Description or Group for a partial match. Fields you leave out are not used. Each hit has Id, Name, Group, Description, MetaLogic, DocumentName, SaveTime and UserID.
{
"Top": 10,
"Group": "Letters"
}Callback
If you set SenderCallBackEndpoint, Doc Gen makes a GET request to it when the editing is finished. The request adds the DXML id and a status. For https://sample.endpoint.com it looks like this:
https://sample.endpoint.com/0D2FF9B5-BFE6-4999-9C66-945881806D18?Status=OKStatus is OK or Discarded. A session that is still a draft when maintenance deletes it gives Status=Deleted. If you set a user name and password, the request carries them as a Basic authorization header, so you can protect the endpoint.
When editing is finished you can use the DxmlUID to recreate the PDF from the Web Editor session with GET /{customerEnvironment}/pdf/dxml/{dxmlUID}. See PDF and other outputs.
Based on metadata you can create a PDF directly from Doxis Interact with this REST API call: https://api.webeditor-v4.metaforce.net/Development/pdf/create
Example of body parameters in Postman:
{
"username" : "User",
"DataAsBase64": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz4KPERhdGEgREVTQ1JJUFRJT049XRhPg==// TRUNCATED// ",
"Document": "CaseLetter2 - Online",
"MetaFile": "CompanyLetters"
}This function will return the actual PDF that can be stored or view as you like. The other output formats are on PDF and other outputs.
Follow a session
The status of a session is Draft, OK, Discarded or Deleted. All of these calls start with /{customerEnvironment}.
| Call | What it does |
|---|---|
GET /status/{dxmlUID} | Returns the status of one session as plain text. 404 if there is none. |
POST /status | Send a list of one to 50 DXML ids in the body and get each id with its status. |
GET /status | Lists sessions. Filter with status (repeat it for more than one), createdStart, createdEnd, modifiedStart and modifiedEnd. Without filters you get all sessions. |
GET /status/draft/{startUtcTime}/{endUtcTime} | The ids of the sessions in status Draft in that time window. |
GET /status/ok/{startUtcTime}/{endUtcTime} | The ids of the sessions in status OK in that time window. |
PUT /status/discard/{dxmlUID} | Discards a session. The callback is called with Discarded. |
Manage the DXML file
| Call | What it does |
|---|---|
GET /dxml/{dxmlUID} | Downloads the DXML file. 404 if there is none. |
DELETE /dxml/{dxmlUID} | Deletes the DXML from storage. 404 if there is none. |
PUT /dxml/{dxmlUID} | Sets a new retention date. Send the date and time as the body, for example "2026-12-31T00:00:00Z". |
GET /dxml/jwt/{startParameter} | Makes a new JWT for restarting a session. startParameter is the last part of the start URL, after /WebEditor/. Answers 204 when Require JWT Authentication is off. |
Look up what the MetaFile holds
| Call | What it returns |
|---|---|
GET /textkeywords/{metaFile} | All keywords that are defined in the texts of the MetaFile. |
POST /texts/{metaFile} | The texts of the MetaFile with their keywords, descriptions and folder paths. Send a filter in the body. |
GET /onlinedocuments/{metaFile} | The documents marked as Online Document in the MetaFile. |
GET /getinfo | Information about the document engine. |
GET /version | The version of the document engine. |