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
- Call
GET /Archive/GetCompanyMetaDataColumnsto 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, andfolders. - Upload a document with
POST /Archive. - Find documents with
POST /Archive/GetAllDocuments. - Fetch a file with
GET /Archive/{fileId}.
Upload a document
POST /Archive takes a JSON body:
| Field | What it is |
|---|---|
fileName | The name of the file, with its extension. |
fileContent | The file as a base64 string. |
folderId or folderPath | The Archive folder to store it in. The folder must exist, otherwise the call is answered with 400. |
search1 to search10 | Metadata for your own search columns. |
type | A number: 0 for an ordinary document (the default), 1 for a Smartform or 2 for a digitally signed file. The names are not accepted. |
id | Optional. The id of a document you have already stored. The file is then stored as a new version of it. |
callbackPayload | Optional. 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:
| Field | What it is |
|---|---|
storedDocumentId | The id of the stored file version. Use it with GET /Archive/{fileId}. |
rootDocumentId | The id of the first version of the document. |
version | The version number of the stored file. |
Find and fetch documents
POST /Archive/GetAllDocuments returns the newest documents first. All fields are optional:
| Field | What it does |
|---|---|
searchQuery | Text 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, createdTo | Limits the list by creation date. |
foldersIds | Limits 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/RollbackwithsourceFileVersionIdandtargetFileIdreturns a document to an earlier version. All versions newer than the one you pick are removed. The call answers400if 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);
}