public

Upload a local file to 21RISK from a client that can run shell commands, such as Claude Code. Pass the file name, its type and its exact size in bytes (wc -c < <file>). Save the returned uploadScript to a file and run sh <script> <path-to-file> before expiresAt. It sends the file in one request, or in parts when it is larger than partSize, so files up to 2 GB work. Then call confirmFileUpload with fileId: it checks the file and makes it available. Only a confirmed file id works where functions take one, for example fileId on createEngineeringReport. Prefer this over uploadAssetFromBase64, which carries the file inside the request and only suits small files.

post/api/rpc/createFileUpload

Request

  • Base URL: https://21risk.com
  • URL: https://21risk.com/api/rpc/createFileUpload
  • Auth: OAuth 2 (client credentials, token URL /api/v1/oauth/token)

Request body

tenantunknown required
filenamestring required

The file name, with its extension.

contentTypestring required

The file type, such as image/png or application/pdf.

sizeinteger required

The exact size of the file in bytes. The upload must match it.

scope'tenant' | 'user' required

Whose the file is: the tenant's (the default), or user for your own profile picture. A user's file must be an image, belongs to no tenant and shows wherever you appear.

Response

Successful response

fileIdstring required

The file id. Confirm the upload with confirmFileUpload, then pass it to functions that take a file id.

contentTypestring required
sizenumber required
partSizenumber required

Files larger than this go up in parts of this size.

partCountnumber required

How many parts the file goes up in; 1 for a single PUT.

uploadScriptstring required

A shell script that uploads the file, in one request or in parts. Save it to a file and run sh <script> <path-to-file>; it needs only curl, dd and sed.

uploadUrlstring required

For clients without the script: PUT the whole file here when it fits in one part.

partsUrlstring required

For clients without the script: the base of the multipart requests for larger files (POST to start, PUT /<n>?upload=<uploadId> per part, POST /complete?upload=<uploadId> with the parts).

expiresAtstring date-time required

Every request of the upload must be made before this time.

Changes

No recorded changes to this operation across all 1 revision of this API.