Visena Dokumentasjon
Partner API

Ressurs

Document folder

Mappetrærne dokumenter arkiveres i — ett tre for hvert eiende firma, hver person og hvert prosjekt. Opprett, list, gi nytt navn til og flytt mapper, last ned dokumentene i en mappe som en zip-pakke, og slett en mappe og undertreet under den bak en bekreftet kaskade.

Endepunktreferansen under står på engelsk i begge språktrærne. Den gjengir API-kontrakten ordrett, og det finnes ingen generator å bygge den på nytt fra, så en oversatt kopi ville drevet fra API-et første gang et endepunkt endres.

Mapper ligger i hverandre. Hver mappe hører til nøyaktig én eier — et firma, en person eller et prosjekt — og ligger enten på eierens øverste nivå eller under en annen av eierens mapper. Listeendepunktet returnerer hele treet flatt, foreldre før barn, og hver node bærer både sin parentId og sin path satt sammen med skråstrek: Invoices/2026 er måten en mappe adresseres på i utdata, mens kall alltid adresserer den med den maskerte id-en.

En flytting flytter mappen med alt som ligger under den, og en sletting tar hele undertreet — ett kall hver, ikke ett kall per nivå. Dokumentene som er arkivert i mappene, og plasseringene som legger dem der, er dokumentert under Document; nytt navn på eller flytting av en mappe blir ført på feeden under Document changes.

Endepunkter

Seks endepunkter, i samme rekkefølge som de er dokumentert nedenfor.

Alle endepunktene på denne siden kan i tillegg svare med fellesfeilene — 401, 403, 404 (ukjent instans) og 500. De er dokumentert én gang, under Feil og feilsøking.

Create a document folder

POST /{instanceName}/api/v1/{locale}/document/folder

Creates a folder on the owning entity. Omit parentFolderId to create at top level. Duplicate sibling names are permitted, matching the platform. 201 with a Location header.

Forespørselskropp

application/jsonDocumentFolderCreateDto

Svar

Status Beskrivelse
201 Folder created.
DocumentFolderNodeDto · application/json
400 Blank name, unrecognised entityType, or the id is not a valid id.
404 No folder with the given parentFolderId.
422 The owning entity does not exist, or the parent folder belongs to another entity.

Eksempel

curl
curl -X POST "https://api.visena.example/acme/api/v1/en/document/folder" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "entityType": "Company",
    "entityId": "bQ4wR8",
    "name": "Contracts"
  }'

List an owning entity's document folders

GET /{instanceName}/api/v1/{locale}/document/folder

Returns the owner's folder tree as a flat list ordered so a parent always precedes its children, which is all a caller needs to rebuild the tree from parentId. A top-level folder reports parentId: null; the internal system folder is never included. An owner that has no folders yet answers an empty list — the read never creates one.

Parametere

Parameter Plassering Type Beskrivelse
entityType required query string, one of Company Person Project Owning entity type.
entityId required query string Masked id of the owning record.

Svar

Status Beskrivelse
200 The owner's folders, parents before children.
array of DocumentFolderNodeDto · application/json
400 Unrecognised entityType, or the id is not a valid id.
422 The referenced entityId does not exist for the given entityType.

Eksempel

curl
curl "https://api.visena.example/acme/api/v1/en/document/folder?entityType=Company&entityId=bQ4wR8" \
  -H "Authorization: Bearer $TOKEN"

Rename a document folder

PUT /{instanceName}/api/v1/{locale}/document/folder/{folderId}

Renames the folder. The owning entity's internal system folder cannot be renamed.

Parametere

Parameter Plassering Type Beskrivelse
folderId required path string Masked folder id.
entityType required query string, one of Company Person Project Owning entity type.
entityId required query string Masked id of the owning record.

Forespørselskropp

application/jsonDocumentFolderRenameDto

Svar

Status Beskrivelse
200 The renamed folder.
DocumentFolderNodeDto · application/json
400 Blank name, or the id is not a valid id.
404 No folder with that id.
422 The folder is the owner's internal system folder.

Eksempel

curl
curl -X PUT "https://api.visena.example/acme/api/v1/en/document/folder/fR5sK1" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Contracts 2026"
  }'

Move a document folder under a new parent

PUT /{instanceName}/api/v1/{locale}/document/folder/{folderId}/move

Re-parents the folder. A null destinationFolderId moves it to top level. Source and destination must belong to the same owning entity, and a folder cannot be moved into itself or into one of its own descendants — that is rejected with 409 rather than silently ignored.

Parametere

Parameter Plassering Type Beskrivelse
folderId required path string Masked folder id.
entityType required query string, one of Company Person Project Owning entity type.
entityId required query string Masked id of the owning record.

Forespørselskropp

application/jsonDocumentFolderMoveDto

Svar

Status Beskrivelse
204 Folder moved.
400 An id is not a valid id.
404 No folder with that id, or no destination folder with that id.
409 The destination is the folder itself or one of its descendants.
422 The folder is the owner's internal system folder, or the destination belongs to another entity.

Eksempel

curl
curl -X PUT "https://api.visena.example/acme/api/v1/en/document/folder/fR5sK1/move" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "destinationFolderId": "fR5sK1"
  }'

Download a folder's documents as a zip bundle

GET /{instanceName}/api/v1/{locale}/document/folder/{folderId}/content

Streams the folder's documents as a single zip, reproducing the folder structure so an unpacked bundle mirrors the tree. The owning entity's internal system folder cannot be bundled, and a tree deeper than 32 levels or holding more than 5000 documents is refused with 413 before any bytes are streamed. recursive defaults to true (the whole subtree); pass false for the folder's own documents only. Which was served is stated in the Content-Disposition file name.

Authorization is per folder, by the declared owning entity: the folder must belong to entityType/entityId, and the bundle then contains every document placed in it. It is not filtered document by document, so a bundle is all-or-nothing rather than a partial result. Two documents resolving to the same entry name are both included under distinct names, and same-named sibling folders are kept apart — nothing is silently dropped or merged. Empty folders appear as directory entries.

Parametere

Parameter Plassering Type Beskrivelse
folderId required path string Masked folder id.
entityType required query string, one of Company Person Project Owning entity type.
entityId required query string Masked id of the owning record.
recursive query boolean
default true
Include the whole subtree (default) or only the folder's own documents.

Svar

Status Beskrivelse
200 The bundle, streamed.
file · application/zip
400 The id is not a valid id.
404 No folder with that id.

Eksempel

curl
curl "https://api.visena.example/acme/api/v1/en/document/folder/fR5sK1/content?recursive=true" \
  -H "Authorization: Bearer $TOKEN"

Delete a document folder and its subtree

DELETE /{instanceName}/api/v1/{locale}/document/folder/{folderId}

Deletes the folder, its sub-folders, and the documents placed in them.

This destroys documents, and its effect reaches outside the folder. A document whose primary placement is in the deleted subtree is deleted outright, which also removes every shortcut placement of it — including placements under other owning entities. Only a shortcut placement inside the subtree is removed on its own, leaving the document intact elsewhere.

Because of that, a delete whose extent is not placement-only answers 409 whose detail states how many documents would be destroyed and how many shortcut placements would go with them, and nothing is deleted. Re-send with acknowledgeCascade=true to proceed. A folder whose subtree holds nothing, or only shortcut placements, deletes straight away. The owning entity's internal system folder cannot be deleted.

Parametere

Parameter Plassering Type Beskrivelse
folderId required path string Masked folder id.
entityType required query string, one of Company Person Project Owning entity type.
entityId required query string Masked id of the owning record.
acknowledgeCascade query boolean
default false
Confirm a delete whose extent goes beyond the targeted placement; see the endpoint description.

Svar

Status Beskrivelse
204 Folder, subtree and contained documents deleted.
400 The id is not a valid id.
404 No folder with that id.
409 The delete would destroy documents; detail states the extent. Nothing was deleted.
422 The folder is the owner's internal system folder.

Eksempel

curl
curl -X DELETE "https://api.visena.example/acme/api/v1/en/document/folder/fR5sK1" \
  -H "Authorization: Bearer $TOKEN"

Objektstrukturer

Forespørsels- og svarkroppene som brukes over, i den rekkefølgen de først refereres.

DocumentFolderCreateDto

Felt Type Beskrivelse
entityType required string Owning entity type: Company, Person or Project.
entityId required string (masked id)
name required string Folder name. Must not be blank; duplicate sibling names are allowed.
parentFolderId string (masked id)

DocumentFolderNodeDto

Felt Type Beskrivelse
id string (masked id)
name string Folder name as displayed.
parentId string (masked id)
path string Slash-joined folder path including this folder's own name, e.g. Invoices/2026.
actedBy string (masked id)

DocumentFolderRenameDto

Felt Type Beskrivelse
name required string New folder name. Must not be blank.

DocumentFolderMoveDto

Felt Type Beskrivelse
destinationFolderId string (masked id)