Register a completed file upload after using the resumable upload flow.
Register a file after successfully uploading it to cloud storage using the resumable upload URL. This endpoint validates that the file exists in storage, verifies the file type and size, and creates the database record.
This endpoint is the final step in the resumable upload flow. For simpler uploads under 100MB, use the direct upload endpoint instead.
organization_id string required
The unique identifier of the organization.
filename string required
Original filename (1-255 characters).
gcs_path string required
Cloud storage path where the file was uploaded. This is returned from the generate upload URL endpoint.
file_size integer required
File size in bytes. Must be greater than 0.
mime_type string required
MIME type of the file.
Returns a File object with complete metadata. The file is now ready to be used in vector stores or AI conversations.
- Bash
- Python
- JavaScript
curl -X POST https://api.aitronos.com/v1/organizations/org_123/files \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filename": "large_video.mp4",
"gcs_path": "files/org_123/file_abc123xyz789/large_video.mp4",
"file_size": 524288000,
"mime_type": "video/mp4"
}'import os
import requests
api_key = os.environ["FREDDY_API_KEY"]
org_id = "org_123"
file_path = "/path/to/large_video.mp4"
# Step 1: Generate upload URL
upload_url_endpoint = f"https://api.aitronos.com/v1/organizations/{org_id}/files/upload-url"
headers = {"X-API-Key": api_key}
with open(file_path, 'rb') as f:
file_size = len(f.read())
upload_url_data = {
"filename": "large_video.mp4",
"file_size": file_size,
"mime_type": "video/mp4"
}
response = requests.post(upload_url_endpoint, headers=headers, json=upload_url_data)
session = response.json()
# Step 2: Upload file to GCS
with open(file_path, 'rb') as f:
upload_headers = {'Content-Type': 'video/mp4'}
requests.put(session['upload_url'], headers=upload_headers, data=f)
# Step 3: Register the completed upload
register_endpoint = f"https://api.aitronos.com/v1/organizations/{org_id}/files"
register_data = {
"filename": "large_video.mp4",
"gcs_path": session['gcs_path'],
"file_size": file_size,
"mime_type": "video/mp4"
}
response = requests.post(register_endpoint, headers=headers, json=register_data)
file_obj = response.json()
print(f"Upload complete! File ID: {file_obj['id']}")- Call generate upload URL to get an upload session
- Upload file to the returned URL using resumable upload protocol
- Call this endpoint to validate and register the completed upload
- Generate Upload URL - Start the resumable upload process
- Upload File - Simple upload for files under 100MB
- List Files
- File Object