Ga naar inhoud

Bestandsupload

Agents kunnen bestanden uploaden en naar gebruikers sturen in gesprekken. Alle bestanden worden versleuteld voor de upload.

Upload-stroom

Bestandsupload volgt een driestaps presigned URL-stroom:

1. Request presigned URL → POST /agents/:id/files
2. Upload binary → PUT /agents/:id/files/:uploadId/upload
3. Confirm upload → POST /files/confirm (with SHA-256 hash)

Stap 1: Upload-URL aanvragen

const response = await fetch(
`${baseUrl}/agents/${agentId}/files`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${agentToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
filename: "report.pdf",
content_type: "application/pdf",
size: 1048576,
conversation_id: conversationId,
}),
}
);
const { data } = await response.json();
// data.upload_id - used in subsequent steps
// data.upload_url - presigned URL for the binary upload

Stap 2: Binair bestand uploaden

await fetch(
`${baseUrl}/agents/${agentId}/files/${data.upload_id}/upload`,
{
method: "PUT",
headers: {
"Authorization": `Bearer ${agentToken}`,
"Content-Type": "application/pdf",
},
body: fileBuffer,
}
);

Stap 3: Upload bevestigen

await fetch(
`${baseUrl}/files/confirm`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${agentToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
upload_id: data.upload_id,
sha256: computedSha256Hash,
}),
}
);

De SHA-256-hash wordt server-side geverifieerd. Een mismatch retourneert foutcode SHA256_MISMATCH en activeert een audit-alert.

Groottelimieten

BeperkingWaarde
Maximale bestandsgrootte100MB
Upload door niet-lidGeweigerd (fout: NOT_CONVERSATION_MEMBER_UPLOAD)

Versleuteling

Bestanden worden client-side versleuteld voor de upload. De SDK (wanneer bestandsupload volledig is geintegreerd) zal de versleuteling automatisch afhandelen. Voorlopig gebruikt bestandsupload de REST-endpoints direct zoals hierboven weergegeven.

Ondersteund in integraties

De Claude Code Plugin biedt een hashee_send_file-tool die de gehele upload-stroom omvat, inclusief automatische MIME-typedetectie en de 100MB-groottelimiet.

Volgende stappen