Documents

A person's documents (contracts, right-to-work…) and company documents people must acknowledge. Files are stored encrypted in Bramble.

MethodPathSummary
GET/api/documentsList documents
GET/api/documents/expiringHR: documents expiring in the next 60 days or already expired
POST/api/documentsUpload a document
GET/api/documents/:id/fileDownload a document
PATCH/api/documents/:idUpdate a document's details
DELETE/api/documents/:idDelete a document
POST/api/documents/:id/ackAcknowledge a document
GET/api/documents/:id/acksHR: who has and hasn't acknowledged a company document

#List documents

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

Query parameters

NameTypeDescription
employeenumberA person's documents (leave out for company documents).

Response 200

Example request

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

#HR: documents expiring in the next 60 days or already expired

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

Response 200

FieldTypeDescription
documentsarray of object
documents[].employee_namestring
Example response
JSON
{
  "documents": [
    {
      "…d": "…",
      "employee_name": "Example employee name"
    }
  ]
}

Errors

StatusMessage
403HR admins only

Example request

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

#Upload a document

POST/api/documents

multipart/form-data with the file and the fields below.

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

Request body

multipart/form-data with the file, plus these fields:

NameTypeDescription
employee_idstringThe person (leave out for a company document).
categoryanyIts category.
titlestringIts title.
visible_to_employeestringLet the person see it.
requires_ackstringPeople must acknowledge they've read it.
expires_onstring (date)When it expires (e.g. a visa).

Response 201

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

Errors

StatusMessage
400Choose a file
403Only HR admins can add company documents
403You can't add documents for this person

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/hr/api/documents', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"employee_id":"string","category":"…","title":"Example title","visible_to_employee":"string","requires_ack":"string","expires_on":"2026-11-12"}),
});
const data = await res.json();

#Download a document

GET/api/documents/:id/file
Address
https://<your-org>.brambleit.cloud/hr/api/documents/:id/file
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: HR.

Path parameters

NameTypeDescription
idrequiredinteger

Query parameters

NameTypeDescription
downloadstring

Example request

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

#Update a document's details

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

Path parameters

NameTypeDescription
idrequiredinteger

Request body JSON

NameTypeDescription
titlestring
categoryany
visible_to_employeeany
requires_ackany
expires_onstring (date)

Response 200

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

Errors

StatusMessage
400Give it a title
403Only HR admins can change documents

Example request

JavaScript
// From a page served by Bramble (uses the signed-in session)
const res = await fetch('/hr/api/documents/42', {
  method: 'PATCH',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"title":"Example title","category":"…","visible_to_employee":"…","requires_ack":"…","expires_on":"2026-11-12"}),
});
const data = await res.json();

#Delete a document

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

Path parameters

NameTypeDescription
idrequiredinteger

Response 200

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

Errors

StatusMessage
403You can't delete this document

Example request

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

#Acknowledge a document

POST/api/documents/:id/ack
Address
https://<your-org>.brambleit.cloud/hr/api/documents/:id/ack
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: HR.

Path parameters

NameTypeDescription
idrequiredinteger

Response 200

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

Errors

StatusMessage
400You don't have an HR record yet
400This document doesn't need acknowledging
403This is not your document

Example request

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

#HR: who has and hasn't acknowledged a company document

GET/api/documents/:id/acks
Address
https://<your-org>.brambleit.cloud/hr/api/documents/:id/acks
Requires
Signed-in browser session (the sso_session / session_id cookies from Bramble sign-in).
Licence: HR.

Path parameters

NameTypeDescription
idrequiredinteger

Response 200

FieldTypeDescription
peoplearray of any
Example response
JSON
{
  "people": []
}

Errors

StatusMessage
403HR admins only

Example request

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