Archive API

The Archive API stores documents in Archive and finds them again. To see the same documents in the application, read Archive.

Every call needs a bearer token from a Standard API client, see Authentication, and a company that has the Archive licence. The calls work on your own company.

https://api.archive.metaforce.net/Archive

The path can also carry the environment, as /Archive/{environment}/.... The values are Development, Test, PreProduction and Production, written exactly like that: test is not recognised. You can send the same value in an x-centerpoint-environment header instead. When a call has both, the header wins over the path. Always name the environment if your company uses more than one, because a missing or unknown name is treated as Development.

Steps

  1. Call GET /Archive/GetCompanyMetaDataColumns to see the search columns your company has defined and the folders you can use. The response has two lists: colunms (spelled like this) with the search columns, and folders.
  2. Upload a document with POST /Archive.
  3. Find documents with POST /Archive/GetAllDocuments.
  4. Fetch a file with GET /Archive/{fileId}.

Upload a document

POST /Archive takes a JSON body:

FieldWhat it is
fileNameThe name of the file, with its extension.
fileContentThe file as a base64 string.
folderId or folderPathThe Archive folder to store it in. The folder must exist, otherwise the call is answered with 400.
search1 to search10Metadata for your own search columns.
typeA number: 0 for an ordinary document (the default), 1 for a Smartform or 2 for a digitally signed file. The names are not accepted.
idOptional. The id of a document you have already stored. The file is then stored as a new version of it.
callbackPayloadOptional. Text your system gets back when the document is stored. Doc Gen sends it, with the ids of the document, to the callbacks that are enabled for your company.
{
    "fileName": "employment-contract.pdf",
    "fileContent": "JVBERi0xLjQK...",
    "folderPath": "Demo contracts",
    "search1": "Ingrid Berg",
    "search2": "2026-0042",
    "type": 0
}

The response has:

FieldWhat it is
storedDocumentIdThe id of the stored file version. Use it with GET /Archive/{fileId}.
rootDocumentIdThe id of the first version of the document.
versionThe version number of the stored file.

Find and fetch documents

POST /Archive/GetAllDocuments returns the newest documents first. All fields are optional:

FieldWhat it does
searchQueryText to look for. A document matches when the text is part of any searchable search column, the file name, the Smartform id or the dialog id. Capital letters do not matter.
createdFrom, createdToLimits the list by creation date.
foldersIdsLimits the list to these folders.

Each document in the response has id, fileName, version, documentVersions, folderId, folderPath, search1 to search10, smartformId, dialogId, type and dates.

GET /Archive/{fileId} downloads the file. An unknown id is answered with 404.

Access groups on folders limit the people who use Archive in the application. They do not limit an API client: a call with an API client token reaches every folder of your company.

Versions and delete

  • POST /Archive/Rollback with sourceFileVersionId and targetFileId returns a document to an earlier version. All versions newer than the one you pick are removed. The call answers 400 if it fails.
  • DELETE /Archive/{fileId} removes a file.

📝 Note: Rollback and delete remove data. Check the ids first.

Example

const axios = require('axios').default;
const fs = require('fs');

async function upload(accessToken) {
  const response = await axios({
      method: 'POST',
      url: 'https://api.archive.metaforce.net/Archive/Test',
      headers: {
          'content-type': 'application/json',
          'Authorization': `Bearer ${accessToken}`
      },
      data: {
          fileName: 'employment-contract.pdf',
          fileContent: fs.readFileSync('employment-contract.pdf').toString('base64'),
          folderPath: 'Demo contracts',
          search1: 'Ingrid Berg'
      }
  });
  console.log(response.data.storedDocumentId);
}