## Complete a file upload `client.File.Complete(ctx, id, body) (*FileCompleteResponse, error)` **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](/using-the-api/scopes/):** `files:create` **[Rate limit category](/using-the-api/rate-limits/):** Write ### Parameters - `id string` Unique identifier of the file to complete. - `body FileCompleteParams` - `Md5 param.Field[string]` Optional MD5 hex digest of the uploaded file for checksum verification. ### Returns - `type FileCompleteResponse struct{…}` - `ID string` Unique identifier for the file. - `CompletedAt string` When the file upload was completed. - `CreatedAt string` When the file upload session was created. - `ExpiresAt string` When the upload session expires. Null once completed, cancelled, or expired. - `Filename string` Original filename. - `MimeType string` MIME type of the file. - `SizeBytes int64` File size in bytes. - `Status FileCompleteResponseStatus` Current upload status of the file. - `const FileCompleteResponseStatusPending FileCompleteResponseStatus = "PENDING"` - `const FileCompleteResponseStatusCompleted FileCompleteResponseStatus = "COMPLETED"` - `const FileCompleteResponseStatusCancelled FileCompleteResponseStatus = "CANCELLED"` - `const FileCompleteResponseStatusExpired FileCompleteResponseStatus = "EXPIRED"` ### Example ```go package main import ( "context" "fmt" "github.com/Lightfld/lightfield-go" "github.com/Lightfld/lightfield-go/option" ) func main() { client := githubcomlightfldlightfieldgo.NewClient( option.WithAPIKey("My API Key"), ) fileCompleteResponse, err := client.File.Complete( context.TODO(), "id", githubcomlightfldlightfieldgo.FileCompleteParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", fileCompleteResponse.ID) } ``` #### Response ```json { "id": "id", "completedAt": "completedAt", "createdAt": "createdAt", "expiresAt": "expiresAt", "filename": "filename", "mimeType": "mimeType", "sizeBytes": -9007199254740991, "status": "PENDING" } ```