## Import a file from Google Drive, OneDrive or SharePoint

`$ lightfield file create-from-storage`

**post** `/v1/files/import`

Copies a file from the caller’s connected Google Drive, OneDrive or SharePoint into a new file, without sending its bytes through the caller. Use it for files too large to download and re-upload, such as meeting recordings, up to 512 MB.

The file is checked before the call returns: a folder returns `409` with code `file_is_folder`, a Google Drive file whose owner has turned off downloading returns `409` with code `file_not_downloadable` (OneDrive and SharePoint report a blocked download only during the copy, which then ends as `CANCELLED`), a link that is not a Google Drive, OneDrive or SharePoint file returns `409` with code `file_not_downloadable`, and a caller who has not connected that storage returns `409` with code `drive_not_connected`. A file whose MIME type or size does not fit `purpose` returns `400`. Google Docs, Sheets and Slides cannot be imported.

The copy runs in the background. The response is the new file with status `PENDING`. Poll `GET /v1/files/{id}` until it is `COMPLETED`, then use its id like any uploaded file, for example as `mediaFileId` in `POST /v1/meetings/{id}/recordings`. A copy that fails ends as `CANCELLED` or `EXPIRED`; import the file again to retry. Imports read from the caller’s own storage connection, so a workspace API key or an automation run gets `403`.

Supports idempotency via the `Idempotency-Key` header: within 72 hours, a repeat with the same key returns the same file while it is `PENDING` or `COMPLETED`, and a repeat sent while the first call is still running returns `409`.

**[Required scope](/using-the-api/scopes/):** `files:create`

**[Rate limit category](/using-the-api/rate-limits/):** Write

### Parameters

- `--purpose: "meeting_recording" or "meeting_transcript"`

  What the file is for. `meeting_recording` for the audio or video of a meeting recording (MP4, WebM, QuickTime, MP3, M4A, WAV or OGG). `meeting_transcript` for a plain text or markdown transcript.

- `--url: string`

  Link to the file in Google Drive, OneDrive or SharePoint, as the storage shows it or shares it.

### Returns

- `file_create_from_storage_response: object { id, completedAt, createdAt, 10 more }`

  - `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.

  - `kind: "file" or "folder"`

    Whether the item is a file or a folder. Null when the response was built without that column.

    - `"file"`

    - `"folder"`

  - `mimeType: string`

    MIME type of the file.

  - `modifiedAt: string`

    When the storage last modified this item. Null for a non-storage file, and for a storage item whose modified time has not been stored.

  - `parentId: string`

    The storage folder this item sits in, or null for a top-level item or a non-storage file.

  - `sizeBytes: number`

    File size in bytes.

  - `source: "googleDrive" or "microsoftDrive"`

    Where the file came from. `googleDrive` for a linked Google Drive item, `microsoftDrive` for a linked OneDrive or SharePoint item. Null for every other file.

    - `"googleDrive"`

    - `"microsoftDrive"`

  - `status: "PENDING" or "COMPLETED" or "CANCELLED" or "EXPIRED"`

    Current upload status of the file.

    - `"PENDING"`

    - `"COMPLETED"`

    - `"CANCELLED"`

    - `"EXPIRED"`

  - `webUrl: string`

    A link that opens this item in Google Drive, OneDrive or SharePoint. Null for a non-storage file.

### Example

```cli
lightfield file create-from-storage \
  --api-key 'My API Key' \
  --purpose meeting_recording \
  --url url
```

#### Response

```json
{
  "id": "id",
  "completedAt": "completedAt",
  "createdAt": "createdAt",
  "expiresAt": "expiresAt",
  "filename": "filename",
  "kind": "file",
  "mimeType": "mimeType",
  "modifiedAt": "modifiedAt",
  "parentId": "parentId",
  "sizeBytes": -9007199254740991,
  "source": "googleDrive",
  "status": "PENDING",
  "webUrl": "webUrl"
}
```
