Guides
Uploading files (API)
Files do not go through the API. The API registers the transaction and gives you pre-signed upload URLs; the files go straight to the intake area, are checked, and then reach the building file.
- Register
POST /documente/upload - Upload the files
PUTto eachuploadUrl - Confirm
POST …/done - Track
GET …/status
1. Register the transaction
Send the document type, the NIS of the building (or unit) and the list of files, each with its name and size. The list contains exactly one .json file with the metadata, plus the actual documents.
- The NIS must exist in the registry; otherwise you get
400on thenisfield. idempotency_key(optional): the same key does not create a second transaction on a retry.hash_sha256on each file (optional, recommended) for integrity checks.- Files over 150 MB are rejected right here.
The response (201) contains transactionId and, for each file, an uploadUrl valid for 1 hour.
{
"tip_document": "certificat_urbanism",
"nis": "ABCDEF-01",
"schema_version": "1.0",
"idempotency_key": "cu-123-2026",
"fisiere": [
{"nume": "metadate.json", "marime_bytes": 214},
{"nume": "certificat.pdf", "marime_bytes": 482113}
]
}The metadata
The JSON has two parts, in the same object. The envelope, the same for every type: tipDocument (required, the same code as tip_document; it selects the schema), NIS and versiuneSchema (the same as nis and schema_version at registration). Without tipDocument, the sheet is rejected. The envelope is removed before the schema check. Then the document data: the required fields depend on the document type. Read the schema from GET /documente/schema/<type>/, no token needed. A JSON that does not match the schema ends in rejected_schema, with the reason in errorMessage.
{
"tipDocument": "certificat_urbanism",
"NIS": "ABCDEF-01",
"versiuneSchema": "1.0",
"nis": "ABCDEF-01",
"tipDocumentVersiuneSchema": "1.0",
"docEmitent": "Primăria Municipiului Exemplu",
"docEmitentNumar": "123/2026",
"docEmitentDataEmitere": "2026-05-14"
}2. Upload the files
A plain PUT with the file content, to the URL you received. Without the Authorization header: the signature is in the URL. Files over 64 MB are uploaded in parts, see Large files.
curl -X PUT --data-binary @certificat.pdf "$UPLOAD_URL"
3. Confirm
Once all files are uploaded, confirm the transaction. The call is idempotent: repeating it has no effect. From here, checks run in the background.
curl -X POST "https://registrulcladirilor.graphit.ro/rndc/api/v1/documente/upload/$TX/done" \ -H "X-Api-Key: $API_KEY" -H "Authorization: Bearer $TOKEN"
4. Track
Poll the status every few seconds until in_dosar (success) or a rejection status. All statuses are described in Upload statuses.
curl "https://registrulcladirilor.graphit.ro/rndc/api/v1/documente/upload/$TX/status" \ -H "X-Api-Key: $API_KEY" -H "Authorization: Bearer $TOKEN"
Complete example
BASE=https://registrulcladirilor.graphit.ro/rndc/api/v1
TOKEN=$(curl -s -X POST "$BASE/auth/accessToken" -H "X-Api-Key: $API_KEY" -H "Content-Type: application/json" \
-d "{\"username\": \"$RNDC_USER\", \"password\": \"$RNDC_PASS\"}" | jq -r .accessToken)
REG=$(curl -s -X POST "$BASE/documente/upload" \
-H "X-Api-Key: $API_KEY" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"tip_document\": \"certificat_urbanism\", \"nis\": \"ABCDEF-01\",
\"schema_version\": \"1.0\", \"idempotency_key\": \"cu-123-2026\",
\"fisiere\": [
{\"nume\": \"metadate.json\", \"marime_bytes\": $(stat -c%s metadate.json)},
{\"nume\": \"certificat.pdf\", \"marime_bytes\": $(stat -c%s certificat.pdf)}]}")
TX=$(echo "$REG" | jq -r .transactionId)
for f in metadate.json certificat.pdf; do
curl -sf -X PUT --data-binary @$f "$(echo "$REG" | jq -r --arg f $f '.fisiere[] | select(.nume==$f) | .uploadUrl')"
done
curl -s -X POST "$BASE/documente/upload/$TX/done" -H "X-Api-Key: $API_KEY" -H "Authorization: Bearer $TOKEN" > /dev/null
curl -s "$BASE/documente/upload/$TX/status" -H "X-Api-Key: $API_KEY" -H "Authorization: Bearer $TOKEN" | jq '{status, errorMessage}'