Mail intake

Mailboxes Paper checks, and the rules that file their attachments into cabinets.

MethodPathSummary
GET/api/mailMail accounts and rules
POST/api/mail/accountsAdd a mailbox to check
PATCH/api/mail/accounts/:idUpdate a mailbox
DELETE/api/mail/accounts/:idRemove a mailbox
POST/api/mail/accounts/:id/testSigns in and returns the folders
POST/api/mail/accounts/:id/checkCheck a mailbox now
POST/api/mail/rulesCreate a mail rule
PATCH/api/mail/rules/:idUpdate a mail rule
DELETE/api/mail/rules/:idDelete a mail rule

#Mail accounts and rules

GET/api/mail
Address
https://<your-org>.brambleit.cloud/paper/api/mail
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Response 200

FieldTypeDescription
accountsarray of any
rulesarray of object
rules[].tag_idsarray of any
rules[].enabledboolean
logarray of any
Example response
JSON
{
  "accounts": [],
  "rules": [
    {
      "…r": "…",
      "tag_ids": [],
      "enabled": true
    }
  ],
  "log": []
}

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail', {
  method: 'GET',
  credentials: 'include',
});
const data = await res.json();

#Add a mailbox to check

POST/api/mail/accounts

Public mail servers only; private network addresses are refused.

Address
https://<your-org>.brambleit.cloud/paper/api/mail/accounts
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Request body JSON

NameTypeDescription
portnumber
secureany
allow_self_signedany
enabledboolean
passwordstring

Response 201

Errors

StatusMessage
400Enter the …
400Enter a port between 1 and 65535
400Enter the password

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/accounts', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"port":12.5,"secure":"…","allow_self_signed":"…","enabled":true,"password":"…"}),
});
const data = await res.json();

#Update a mailbox

PATCH/api/mail/accounts/:id
Address
https://<your-org>.brambleit.cloud/paper/api/mail/accounts/:id
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Path parameters

NameTypeDescription
idrequiredinteger

Request body JSON

NameTypeDescription
portnumber
secureany
allow_self_signedany
enabledboolean
passwordstring

Response 200

Errors

StatusMessage
400Enter the …
400Enter a port between 1 and 65535
400Enter the password

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/accounts/42', {
  method: 'PATCH',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"port":12.5,"secure":"…","allow_self_signed":"…","enabled":true,"password":"…"}),
});
const data = await res.json();

#Remove a mailbox

DELETE/api/mail/accounts/:id
Address
https://<your-org>.brambleit.cloud/paper/api/mail/accounts/:id
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Path parameters

NameTypeDescription
idrequiredinteger

Response 200

FieldTypeDescription
okboolean
Example response
JSON
{
  "ok": true
}

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/accounts/42', {
  method: 'DELETE',
  credentials: 'include',
});
const data = await res.json();

#Signs in and returns the folders

POST/api/mail/accounts/:id/test
Address
https://<your-org>.brambleit.cloud/paper/api/mail/accounts/:id/test
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Path parameters

NameTypeDescription
idrequiredinteger

Response 200

FieldTypeDescription
okboolean
foldersboolean
Example response
JSON
{
  "ok": true,
  "folders": false
}

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/accounts/42/test', {
  method: 'POST',
  credentials: 'include',
});
const data = await res.json();

#Check a mailbox now

POST/api/mail/accounts/:id/check
Address
https://<your-org>.brambleit.cloud/paper/api/mail/accounts/:id/check
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Path parameters

NameTypeDescription
idrequiredinteger

Response 200

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/accounts/42/check', {
  method: 'POST',
  credentials: 'include',
});
const data = await res.json();

#Create a mail rule

POST/api/mail/rules
Address
https://<your-org>.brambleit.cloud/paper/api/mail/rules
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Request body JSON

NameTypeDescription
account_idinteger

Response 201

FieldTypeDescription
idinteger
Example response
JSON
{
  "id": 42
}

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/rules', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"account_id":7}),
});
const data = await res.json();

#Update a mail rule

PATCH/api/mail/rules/:id
Address
https://<your-org>.brambleit.cloud/paper/api/mail/rules/:id
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Path parameters

NameTypeDescription
idrequiredinteger

Request body JSON

NameTypeDescription
namestring
cabinet_idinteger
enabledboolean
sortnumber
max_age_daysnumber
title_fromstring
correspondent_modestring: "match" | "sender" | "set"
actionstring: "read" | "flag" | "move" | "delete" | "none"
tag_idsarray of any
correspondent_idinteger
doctype_idinteger
action_folderany

Response 200

FieldTypeDescription
okboolean
Example response
JSON
{
  "ok": true
}

Errors

StatusMessage
400Give the rule a name
400Choose the folder to move emails to

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/rules/42', {
  method: 'PATCH',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"name":"Example name","cabinet_id":7,"enabled":true,"sort":12.5,"max_age_days":12.5,"title_from":"Example title from","correspondent_mode":"match","action":"read","tag_ids":[],"correspondent_id":7,"doctype_id":7,"action_folder":"…"}),
});
const data = await res.json();

#Delete a mail rule

DELETE/api/mail/rules/:id
Address
https://<your-org>.brambleit.cloud/paper/api/mail/rules/:id
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: Paper.

Path parameters

NameTypeDescription
idrequiredinteger

Response 200

FieldTypeDescription
okboolean
Example response
JSON
{
  "ok": true
}

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/paper/api/mail/rules/42', {
  method: 'DELETE',
  credentials: 'include',
});
const data = await res.json();