Obchodné záznamy

Zmluvy a dokumenty s platnosťou. Multipart upload, PDF, anotácie.

Obchodné záznamy sú zmluvy, dohody a iné právne dokumenty s dátumom platnosti. Po nahratí ich AI automaticky rozdelí na strany (pages), ktoré môžeš anotovať. Záznamy sú versioned – PATCH vytvorí novú verziu metadat, súbor zostane priložený.

Endpointy

Upload POST /business-records prijíma multipart/form-data so súborom v časti file a metadata fieldmi (title, record_type_code sú povinné). Sample nižšie ukazuje očakávané polia ako JSON.

POST/api/v1/business-recordsbusiness_records:write

Nahrá súbor + metadata. Multipart/form-data so súborom v časti `file` a metadata fieldmi (`title`, `record_type_code` povinné). Max 5 MB. Po uploade beží AI extrakcia – status sa posúva uploading → processing → ready.

Request
curl -X POST "https://monivio.sk/api/v1/business-records" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Nájomná zmluva 2026",
  "record_type_code": "contract",
  "valid_from": "2026-01-01",
  "valid_to": "2026-12-31",
  "signed_date": "2025-12-15"
}'
Response 201json
{
  "data": {
    "id": "brc_5wpqzx9k3rt8nmlhvyc4bfsj",
    "version": 1,
    "title": "Nájomná zmluva 2026",
    "description": null,
    "type_code": "contract",
    "status": "ready",
    "counterparty_name": "Vlastník budovy s.r.o.",
    "contact_id": null,
    "valid_from": "2026-01-01T00:00:00.000Z",
    "valid_to": "2026-12-31T00:00:00.000Z",
    "signed_date": "2025-12-15T00:00:00.000Z",
    "internal_notes": null,
    "page_count": 4,
    "has_file": true,
    "created_at": "2025-12-15T13:42:00.000Z",
    "updated_at": "2025-12-15T13:42:00.000Z"
  }
}
GET/api/v1/business-recordsbusiness_records:read

Zoznam záznamov so stránkovaním a filtrami. Query: `search`, `type_code`, `contact_id`, `from`, `to`, `page`, `limit`, `sort_by`, `sort_order`.

Request
curl "https://monivio.sk/api/v1/business-records?type_code=contract&limit=10" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response 200json
{
  "data": [
    {
      "id": "brc_5wpqzx9k3rt8nmlhvyc4bfsj",
      "version": 1,
      "title": "Nájomná zmluva 2026",
      "description": null,
      "type_code": "contract",
      "status": "ready",
      "counterparty_name": "Vlastník budovy s.r.o.",
      "contact_id": null,
      "valid_from": "2026-01-01T00:00:00.000Z",
      "valid_to": "2026-12-31T00:00:00.000Z",
      "signed_date": "2025-12-15T00:00:00.000Z",
      "internal_notes": null,
      "page_count": 4,
      "has_file": true,
      "created_at": "2025-12-15T13:42:00.000Z",
      "updated_at": "2025-12-15T13:42:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 10,
    "total": 1,
    "total_pages": 1
  }
}
GET/api/v1/business-records/{id}business_records:read

Detail záznamu.

Request
curl "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response 200json
{
  "data": {
    "id": "brc_5wpqzx9k3rt8nmlhvyc4bfsj",
    "version": 1,
    "title": "Nájomná zmluva 2026",
    "description": null,
    "type_code": "contract",
    "status": "ready",
    "counterparty_name": "Vlastník budovy s.r.o.",
    "contact_id": null,
    "valid_from": "2026-01-01T00:00:00.000Z",
    "valid_to": "2026-12-31T00:00:00.000Z",
    "signed_date": "2025-12-15T00:00:00.000Z",
    "internal_notes": null,
    "page_count": 4,
    "has_file": true,
    "created_at": "2025-12-15T13:42:00.000Z",
    "updated_at": "2025-12-15T13:42:00.000Z"
  }
}
PATCH/api/v1/business-records/{id}business_records:write

Update metadat (vytvorí novú verziu). Súbor sa cez PATCH neaktualizuje – stačí poslať polia, ktoré chceš zmeniť.

Request
curl -X PATCH "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Nájomná zmluva 2026 (revízia)",
  "valid_to": "2027-12-31"
}'
Response 200json
{
  "data": {
    "id": "brc_5wpqzx9k3rt8nmlhvyc4bfsj",
    "version": 2,
    "title": "Nájomná zmluva 2026 (revízia)",
    "description": null,
    "type_code": "contract",
    "status": "ready",
    "counterparty_name": "Vlastník budovy s.r.o.",
    "contact_id": null,
    "valid_from": "2026-01-01T00:00:00.000Z",
    "valid_to": "2027-12-31T00:00:00.000Z",
    "signed_date": "2025-12-15T00:00:00.000Z",
    "internal_notes": null,
    "page_count": 4,
    "has_file": true,
    "created_at": "2025-12-15T13:42:00.000Z",
    "updated_at": "2026-05-07T08:42:11.000Z"
  }
}
DELETE/api/v1/business-records/{id}business_records:write

Vymaže záznam.

Request
curl -X DELETE "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
GET/api/v1/business-records/{id}/pagesbusiness_records:read

Strany dokumentu (po AI rozdelení).

Request
curl "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve/pages" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response 200json
{
  "data": [
    {
      "id": "rpg_3kw9pmxn7rt2vyzqlhc8bfsj",
      "page_number": 1,
      "file_id": "fil_xKZqL9bM7nT4vR8sCdHfWgYjE2pUaQ",
      "width": 1240,
      "height": 1754,
      "thumbnail_path": "thumbnails/brc_5wpqzx/page-1.png",
      "created_at": "2025-12-15T13:42:18.000Z"
    },
    {
      "id": "rpg_8wpqzx9k3rt8nmlhvyc4bfsj",
      "page_number": 2,
      "file_id": "fil_xKZqL9bM7nT4vR8sCdHfWgYjE2pUaQ",
      "width": 1240,
      "height": 1754,
      "thumbnail_path": "thumbnails/brc_5wpqzx/page-2.png",
      "created_at": "2025-12-15T13:42:18.000Z"
    }
  ]
}
GET/api/v1/business-records/{id}/pdfbusiness_records:read

Stiahne pôvodný nahratý súbor. Vracia binárny obsah s `Content-Disposition: attachment`.

Request
curl "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve/pdf" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Anotácie

Anotácie sú zvýraznenia / poznámky pripnuté na konkrétnu stranu dokumentu. Sú versioned: PATCH vytvorí novú verziu so stabilným id. Schému objektu nájdeš nižšie.

idreadonly
string
CUID2 ID s prefixom ran_.
versionreadonly
number
Verzia.
page_idrequired
string
ID strany na ktorej sa anotácia nachádza.
contentrequired
string
Text anotácie (max 5000 znakov).
position_xrequired
number
X súradnica v strane (px).
position_yrequired
number
Y súradnica v strane (px).
width
number/ null
Šírka highlight-u (px).
height
number/ null
Výška highlight-u (px).
color
string (#hex)
Farba zvýraznenia (default #fde047 – žltá).
created_atreadonly
string (ISO 8601)
Vytvorenie.
GET/api/v1/business-records/{id}/annotationsbusiness_records:read

Všetky anotácie v dokumente.

Request
curl "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve/annotations" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response 200json
{
  "data": [
    {
      "id": "ran_xKZqL9bM7nT4vR8sCdHfWgYj",
      "version": 1,
      "page_id": "rpg_3kw9pmxn7rt2vyzqlhc8bfsj",
      "content": "Pozor: pokuta 5%",
      "position_x": 120,
      "position_y": 540,
      "width": 200,
      "height": 32,
      "color": "#fde047",
      "created_at": "2025-12-16T09:00:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 1,
    "total": 1,
    "total_pages": 1
  }
}
POST/api/v1/business-records/{id}/annotationsbusiness_records:write

Vytvorí novú anotáciu na konkrétnej strane dokumentu.

Request
curl -X POST "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve/annotations" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "page_id": "rpg_3kw9pmxn7rt2vyzqlhc8bfsj",
  "content": "Pozor: pokuta 5%",
  "position_x": 120,
  "position_y": 540,
  "width": 200,
  "height": 32,
  "color": "#fde047"
}'
Response 201json
{
  "data": {
    "id": "ran_xKZqL9bM7nT4vR8sCdHfWgYj",
    "version": 1,
    "page_id": "rpg_3kw9pmxn7rt2vyzqlhc8bfsj",
    "content": "Pozor: pokuta 5%",
    "position_x": 120,
    "position_y": 540,
    "width": 200,
    "height": 32,
    "color": "#fde047",
    "created_at": "2025-12-16T09:00:00.000Z"
  }
}
PATCH/api/v1/business-records/{id}/annotations/{annotationId}business_records:write

Vytvorí novú verziu anotácie (id zostáva, version+1).

Request
curl -X PATCH "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve/annotations/ann_2hf8pq3rxn4mlkzyt9abwvve" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "content": "Aktualizovaný komentár",
  "color": "#86efac"
}'
Response 200json
{
  "data": {
    "id": "ran_xKZqL9bM7nT4vR8sCdHfWgYj",
    "version": 2,
    "page_id": "rpg_3kw9pmxn7rt2vyzqlhc8bfsj",
    "content": "Aktualizovaný komentár",
    "position_x": 120,
    "position_y": 540,
    "width": 200,
    "height": 32,
    "color": "#86efac",
    "created_at": "2025-12-16T09:00:00.000Z"
  }
}
DELETE/api/v1/business-records/{id}/annotations/{annotationId}business_records:write

Vymaže anotáciu.

Request
curl -X DELETE "https://monivio.sk/api/v1/business-records/con_2hf8pq3rxn4mlkzyt9abwvve/annotations/ann_2hf8pq3rxn4mlkzyt9abwvve" \
  -H "Authorization: Bearer mk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Objekt BusinessRecord

idreadonly
string
CUID2 ID s prefixom brc_.
versionreadonly
number
Verzia metadat.
titlerequired
string
Názov dokumentu.
description
string/ null
Voliteľný popis.
type_coderequired
string
Kód typu (contract, agreement, lease, ...). Zoznam dostupných typov v Reference.
statusreadonly
string
uploading / processing / ready / failed. Po nahratí súboru ide cez AI extrakciu.
counterparty_name
string/ null
Názov protistrany.
contact_id
string/ null
ID kontaktu (ak je v DB).
valid_from
string (ISO 8601)/ null
Začiatok platnosti.
valid_to
string (ISO 8601)/ null
Koniec platnosti.
signed_date
string (ISO 8601)/ null
Dátum podpisu.
internal_notes
string/ null
Interné poznámky (max 5000 znakov).
page_countreadonly
number/ null
Počet strán po AI rozdelení.
has_filereadonly
boolean
Či má záznam priložený súbor.
created_atreadonly
string (ISO 8601)
Vytvorenie.
updated_atreadonly
string (ISO 8601)
Posledná zmena.