BSV blockchainBSV blockchain

Initiate a file upload (inferred from BRC-26 status note)

POST/upload

Request an upload slot for a file. The server responds with a pre-signed upload URL (or equivalent mechanism) and the UHRP URL that will address the content once the upload is complete.

The client then issues a PUT request to the returned uploadURL with the raw file bytes.

Body application/json

fileSizeintegerrequired

Exact byte length of the file to be uploaded.

sha256stringrequired

SHA-256 hash of the file content (hex, 64 characters).

mimeTypestring

Optional MIME type of the file.

retentionDaysinteger

Requested number of days the advertisement token should remain valid. The server may cap this value.

Response

Upload slot allocated.

uhrpUrlstring

The UHRP URL that will address this content. Encoded as Base58Check with prefix ce00 over the SHA-256 hash.

uploadUrlstring<uri>

Pre-signed HTTPS URL. The client MUST issue a PUT request with the raw file bytes to this URL to complete the upload.

expiresAtinteger

UNIX timestamp (seconds) when the upload URL expires.

Bad request — invalid input.

errorstring

Human-readable error description.

codestring

Machine-readable error code (see specs/errors.md).

Missing or invalid BRC-103 authentication.

errorstring

Human-readable error description.

codestring

Machine-readable error code (see specs/errors.md).

Internal server error.

errorstring

Human-readable error description.

codestring

Machine-readable error code (see specs/errors.md).

Request
curl -X POST "https://{host}/upload" \
  -H "Content-Type: application/json" \
  -H "x-bsv-auth: <x-bsv-auth>" \
  -d '{
  "fileSize": 204800,
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "mimeType": "image/png",
  "retentionDays": 30
}'
Response
{
  "uhrpUrl": "uhrp://XYZ123abc...",
  "uploadUrl": "https://storage.example.com/put/abc123?sig=...",
  "expiresAt": 1714010000
}