Skip to content

Complete a file upload

file.complete(strid, FileCompleteParams**kwargs) -> FileCompleteResponse
POST/v1/files/{id}/complete

Finalizes an upload after the file bytes have been uploaded.

If an optional md5 hex digest is provided, the server validates the checksum before marking the file as completed.

Required scope: files:create

Rate limit category: Write

ParametersExpand Collapse
id: str

Unique identifier of the file to complete.

md5: Optional[str]

Optional MD5 hex digest of the uploaded file for checksum verification.

ReturnsExpand Collapse
class FileCompleteResponse:
id: str

Unique identifier for the file.

completed_at: Optional[str]

When the file upload was completed.

created_at: str

When the file upload session was created.

expires_at: Optional[str]

When the upload session expires. Null once completed, cancelled, or expired.

filename: str

Original filename.

mime_type: str

MIME type of the file.

size_bytes: int

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
status: Literal["PENDING", "COMPLETED", "CANCELLED", "EXPIRED"]

Current upload status of the file.

One of the following:
"PENDING"
"COMPLETED"
"CANCELLED"
"EXPIRED"

Complete a file upload

from lightfield import Lightfield

client = Lightfield(
    api_key="My API Key",
)
file_complete_response = client.file.complete(
    id="id",
)
print(file_complete_response.id)
{
  "id": "id",
  "completedAt": "completedAt",
  "createdAt": "createdAt",
  "expiresAt": "expiresAt",
  "filename": "filename",
  "mimeType": "mimeType",
  "sizeBytes": -9007199254740991,
  "status": "PENDING"
}
Returns Examples
{
  "id": "id",
  "completedAt": "completedAt",
  "createdAt": "createdAt",
  "expiresAt": "expiresAt",
  "filename": "filename",
  "mimeType": "mimeType",
  "sizeBytes": -9007199254740991,
  "status": "PENDING"
}