media API (develop:84871a)

Download OpenAPI specification:

License: None

Automatically generated swagger spec for the media stack.

DocumentService

Get a document by ID

Returns the document identified by the given ID.

query Parameters
id
string

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "ownerId": "string",
  • "showInPortal": true,
  • "type": "OTHER",
  • "version": 0,
  • "versions": [
    ]
}

Save a document

Creates a new document for the given owner from a media ID, with name, type, and showInPortal flag. Returns the created document.

Request Body schema: application/json
required
mediaId
required
string
name
required
string
ownerId
required
string <int64>
showInPortal
required
boolean
type
required
string (mediadocumentType)
Default: "OTHER"
Enum: "OTHER" "APPLICATION_FORM" "HANDOVER_PROTOCOL" "CONTRACT" "BUILDING_PLAN" "INVOICE" "HOUSE_REGULATION" "INSTRUCTION_MANUAL" "CREDIT_CHECK" "OWNERS_MEETING" "PAY_IN_SLIP" "ENERGY_CERTIFICATE" "WARRANTY_CERTIFICATE" "BANK_STATEMENT" "ADDITIONAL_COSTS_BILL" "SEPA_DIRECT_DEBIT_MANDATE" "AGREEMENT" "DEPOSIT_CONFIRMATION" "BUILDING_INSURANCE_POLICY" "KEY_LIST" "TERMINATION_DOC_TYPE" "RENT_ADJUSTMENT_DOC_TYPE" "REFERENCES_DOC_TYPE" "MAINTENANCE_CONTRACT_DOC_TYPE" "REGULATIONS" "REGULATIONS_FOR_USE_AND_MANAGEMENT" "ANNUAL_FINANCIAL_STATEMENT" "PURCHASE_CONTRACT_AND_LAND_REGISTER" "CONDOMINIUM_OWNERSHIP" "RENEWAL_FOND" "MORTGAGE" "ORDER" "OFFER" "IDENTITY" "EXTRACT_FROM_DEBT_COLLECTION_REGISTER" "BANK_ACCOUNT_DETAILS" "PURCHASE_CONTRACT" "LAND_REGISTER" "SITUATION_PLAN" "CONSTRUCTION_LAW_AGREEMENT" "EASEMENT_AGREEMENT" "CADASTRAL_ESTIMATE" "LETTER" "TRADE_REGISTER_EXCERPT" "PAYMENT_REMINDER" "PROTOCOL" "COURT_DOC_TYPE" "HONORARIUM" "BUDGET" "OFFICIAL_ESTIMATE" "BUILDING_DESCRIPTION" "PERMITS" "LEGAL_MATTERS" "TENANT_CHANGE_NOTIFICATION" "LOSS_RATIO" "SHARE_CERTIFICATE_DOCUMENT"

Responses

Request samples

Content type
application/json
{
  • "mediaId": "string",
  • "name": "string",
  • "ownerId": "string",
  • "showInPortal": true,
  • "type": "OTHER"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "ownerId": "string",
  • "showInPortal": true,
  • "type": "OTHER",
  • "version": 0,
  • "versions": [
    ]
}

List documents by IDs

Returns the documents matching the given document IDs.

Request Body schema: application/json
required
documentIds
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "documentIds": [
    ]
}

Response samples

Content type
application/json
{
  • "documents": [
    ]
}

Merge documents into one file

Merges the given media items into a single file with the provided mergeMediumName. Returns the merged media as bytes.

Request Body schema: application/json
required
required
Array of objects (documentmergingMedium)
mergeMediumName
required
string

Responses

Request samples

Content type
application/json
{
  • "media": [
    ],
  • "mergeMediumName": "string"
}

Response samples

Content type
application/json
{
  • "media": "string"
}

Update a document

Updates an existing document by ID with name, type, and showInPortal flag.

path Parameters
id
required
string
Request Body schema: application/json
required
name
string
showInPortal
boolean
type
string (mediadocumentType)
Default: "OTHER"
Enum: "OTHER" "APPLICATION_FORM" "HANDOVER_PROTOCOL" "CONTRACT" "BUILDING_PLAN" "INVOICE" "HOUSE_REGULATION" "INSTRUCTION_MANUAL" "CREDIT_CHECK" "OWNERS_MEETING" "PAY_IN_SLIP" "ENERGY_CERTIFICATE" "WARRANTY_CERTIFICATE" "BANK_STATEMENT" "ADDITIONAL_COSTS_BILL" "SEPA_DIRECT_DEBIT_MANDATE" "AGREEMENT" "DEPOSIT_CONFIRMATION" "BUILDING_INSURANCE_POLICY" "KEY_LIST" "TERMINATION_DOC_TYPE" "RENT_ADJUSTMENT_DOC_TYPE" "REFERENCES_DOC_TYPE" "MAINTENANCE_CONTRACT_DOC_TYPE" "REGULATIONS" "REGULATIONS_FOR_USE_AND_MANAGEMENT" "ANNUAL_FINANCIAL_STATEMENT" "PURCHASE_CONTRACT_AND_LAND_REGISTER" "CONDOMINIUM_OWNERSHIP" "RENEWAL_FOND" "MORTGAGE" "ORDER" "OFFER" "IDENTITY" "EXTRACT_FROM_DEBT_COLLECTION_REGISTER" "BANK_ACCOUNT_DETAILS" "PURCHASE_CONTRACT" "LAND_REGISTER" "SITUATION_PLAN" "CONSTRUCTION_LAW_AGREEMENT" "EASEMENT_AGREEMENT" "CADASTRAL_ESTIMATE" "LETTER" "TRADE_REGISTER_EXCERPT" "PAYMENT_REMINDER" "PROTOCOL" "COURT_DOC_TYPE" "HONORARIUM" "BUDGET" "OFFICIAL_ESTIMATE" "BUILDING_DESCRIPTION" "PERMITS" "LEGAL_MATTERS" "TENANT_CHANGE_NOTIFICATION" "LOSS_RATIO" "SHARE_CERTIFICATE_DOCUMENT"

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "showInPortal": true,
  • "type": "OTHER"
}

Response samples

Content type
application/json
{ }

Add a document version

Adds a new version to the document identified by ID, linking the given media ID. Returns the updated document.

path Parameters
id
required
string
Request Body schema: application/json
required
mediaId
string

Responses

Request samples

Content type
application/json
{
  • "mediaId": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "ownerId": "string",
  • "showInPortal": true,
  • "type": "OTHER",
  • "version": 0,
  • "versions": [
    ]
}

Remove a document version

Removes the specified version from the document identified by ID. Returns the updated document.

path Parameters
id
required
string
version
required
integer <int32>

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "ownerId": "string",
  • "showInPortal": true,
  • "type": "OTHER",
  • "version": 0,
  • "versions": [
    ]
}

StoreService

Upload media file (legacy Express)

Legacy sync Express multipart/form-data upload (not a gRPC method). Scans then stores and returns READY media immediately. Prefer CreateUpload for larger files (signed GCS PUT); both paths are always allowed.

The request body must be multipart/form-data with a single file field named file (plus optional form fields below). On success, returns the created media object as JSON (same fields as Media, status READY).

Form field Required Description
file yes Binary file (multer field name file)
public no Visibility; truthy when "true" or "1" (default: private)
accountId no Owner account ID; falls back to x-account-id, else -1
filename no Stored filename override (max 255 chars); defaults to the upload original name
maxDimension no Max image width/height in pixels before resize (images only)

MIME type is detected from file content when possible. Blocked types (e.g. executables) return 403. Infected files (ClamAV) return 409. Missing file or invalid multipart return 400.

Example:

curl --location 'https://staging.myprop.ch/web/media' \
  --form 'public="false"' \
  --form 'file=@"/path/to/Vertrag.pdf"' \
  --form 'accountId=30001'
Request Body schema: multipart/form-data
required

Docs-only request shape for Upload. The real HTTP body is multipart/form-data; the binary file part cannot be represented in protobuf and is documented on the RPC.

accountId
required
string <int64>

Form field. Owner account ID; falls back to x-account-id, else -1.

filename
string

Optional form field. Stored filename override (max 255 chars); defaults to the original upload name.

maxDimension
integer <int32>

Optional form field. Max image width/height in pixels before resize (images only).

public
required
boolean

Form field. Truthy when sent as "true" or "1". Defaults to private.

Responses

Response samples

Content type
application/json
{
  • "filename": "string",
  • "id": "string",
  • "mimeType": "string",
  • "ownerId": "string",
  • "size": 0,
  • "status": "MEDIA_STATUS_UNDEFINED",
  • "thumbnails": [
    ],
  • "uploadedAt": "string",
  • "url": "string",
  • "validUntil": "string"
}

Complete signed GCS upload

Start scan and promotion of quarantined file.Idempotent if already scanning or ready. Useful for local/dev without GCS notifications; also valid in production. Returns the current Media (may still be non-READY).

Request Body schema: application/json
required
id
required
string

Responses

Request samples

Content type
application/json
{
  • "id": "string"
}

Response samples

Content type
application/json
{
  • "media": {
    }
}

Create signed GCS upload

Creates a PENDING media row and returns a GCS V4 signed PUT URL (valid 15 minutes) to a quarantine bucket. After PUT, the object is scanned asynchronously (ClamAV); poll Get until status is READY, or call CompleteUpload to enqueue the scan (also used for local/dev without the GCS Pub/Sub bridge).

Prefer this path for larger files; the legacy Express Upload remains available for small/sync uploads. No server-enforced size split between the two paths.

url and thumbnails are empty until status is READY. Client mimeType is a hint only; the worker overwrites MIME from detected file content.

Request Body schema: application/json
required
accountId
required
string <int64>
filename
required
string

Stored filename (max 255 chars).

maxDimension
integer <int32>

Optional. Max image width/height in pixels before resize (images only).

mimeType
required
string

Client MIME hint only; overwritten from detected content after upload.

public
required
boolean
size
required
integer <int32>

Declared size in bytes.

Responses

Request samples

Content type
application/json
{
  • "accountId": "string",
  • "filename": "string",
  • "maxDimension": 0,
  • "mimeType": "string",
  • "public": true,
  • "size": 0
}

Response samples

Content type
application/json
{
  • "media": {
    },
  • "uploadUrl": "string",
  • "uploadUrlValidUntil": "string"
}

List media by IDs

Returns the media items matching the given IDs. Items may be PENDING, SCANNING, REJECTED, or EXPIRED with empty url and thumbnails; usable URLs are only present when status is READY. Clients should poll or wait for media.uploaded after CreateUpload.

Request Body schema: application/json
required
ids
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "ids": [
    ]
}

Response samples

Content type
application/json
{
  • "media": [
    ]
}

Set public flag on media

Sets the public flag on the media items with the given IDs according to the public value. Fails unless status is READY.

Request Body schema: application/json
required
ids
required
Array of strings
public
required
boolean

Responses

Request samples

Content type
application/json
{
  • "ids": [
    ],
  • "public": true
}

Response samples

Content type
application/json
{ }

Get media by ID

Returns the media item identified by the given ID, including filename, MIME type, size, URL, thumbnails, validity, and status. url and thumbnails are empty unless status is READY. After CreateUpload, poll until READY or wait for media.uploaded.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "media": {
    }
}

Delete media by ID

Deletes the media item identified by the given ID. May cancel a PENDING upload and remove the quarantine object.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }