Skip to main content
POST
/
file
/
upload-url
Get File Upload URL
curl --request POST \
  --url https://api.royalti.io/file/upload-url \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "fileMetaData": {
    "originalname": "<string>",
    "mimetype": "<string>",
    "uploadType": "royalty",
    "size": 123
  },
  "royaltySource": "<string>",
  "accountingPeriod": "2023-12-25",
  "salePeriod": "2023-12-25",
  "autoDetect": true,
  "fileSample": "<string>",
  "autoProcessIfConfident": false,
  "forceManualConfirmation": false,
  "isZip": false
}
'
{
  "success": true,
  "message": "File upload record created, please utilise the signedUrl to upload the file",
  "data": {
    "fileId": "file-uuid-123",
    "signedUrl": "https://storage.googleapis.com/royalti-uploads/...",
    "detectionSessionId": "session-uuid-456",
    "requiresConfirmation": true
  }
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

Auto-Detection Feature:
  • Set autoDetect: true to enable automatic source and period detection
  • Provide fileSample (base64-encoded) for pre-upload analysis
  • Use autoProcessIfConfident: true to skip manual confirmation when confidence is high
  • Set forceManualConfirmation: true to always require manual review
Request Payload:
  • fileMetaData: Required - contains uploadType, originalname, mimetype, size
  • royaltySource: Optional if autoDetect is enabled
  • accountingPeriod: Optional if autoDetect is enabled
  • salePeriod: Optional sales period
  • autoDetect: Enable automatic source/period detection (default: true)
  • fileSample: Base64-encoded file sample for analysis
  • autoProcessIfConfident: Auto-process if detection confidence is high
  • forceManualConfirmation: Force manual review regardless of confidence
  • isZip: Indicates ZIP file containing multiple files

Code Examples

const response = await fetch('https://api.royalti.io/file/upload-url', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "ref": "#/components/schemas/UploadUrlRequest"
  })
});

const data = await response.json();
console.log(data);

Authorizations

Authorization
string
header
required

JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"

Body

application/json
fileMetaData
object
required
royaltySource
string

Source of the royalty data (optional if autoDetect is true)

accountingPeriod
string<date>

The accounting period (YYYY-MM-DD) (optional if autoDetect is true)

salePeriod
string<date>

The sales period (YYYY-MM-DD)

autoDetect
boolean
default:true

Enable automatic detection of royalty source and period from file content

fileSample
string

Base64-encoded sample of file content for pre-upload analysis (optional)

autoProcessIfConfident
boolean
default:false

Automatically process file if detection confidence meets thresholds

forceManualConfirmation
boolean
default:false

Force manual confirmation even if auto-detection confidence is high

isZip
boolean
default:false

Indicates if the file is a ZIP archive containing multiple royalty files

Response

Pre-signed URL generated successfully

success
boolean
default:true
message
string
data
object