---
title: "Link an external file (SharePoint, Google Drive, etc.) and return a file upload record"
method: POST
path: "/api/v1beta/me/files/link"
tags: ["files"]
---

# Link an external file (SharePoint, Google Drive, etc.) and return a file upload record

`POST /api/v1beta/me/files/link`

## Request

- The document declares no server URL.
- Auth: none declared

This endpoint creates a file upload record that references an external file,
allowing it to be used in chat messages or attached to assistants.
If chat_id is provided, the file is associated with that chat. If not provided,
the file is created as a standalone upload.

## Request body

- LinkFileRequest: Request to link an external file (SharePoint, Google Drive, etc.)
  - `chat_id` string, nullable: Optional chat ID to associate the file with. If not provided, creates standalone files.
  - `provider_metadata` SharepointProviderMetadata, required: Provider-specific metadata (e.g., drive_id, item_id for SharePoint)
    - `drive_id` string, required: The ID of the drive containing the file
    - `item_id` string, required: The ID of the file item
  - `source` string, required: The source/provider type: "sharepoint" (future: "google_drive", etc.)

## Response `200`

- FileUploadResponse: Response for file upload
  - `files` FileUploadItem[], required: The list of uploaded files with their IDs and filenames
    - `audio_synthesis` AudioSynthesisMetadata
      - `channels` integer, required
      - `encoding` string, required
      - `input_text` string, required
      - `model` string, required
      - `provider_id` string, required
      - `sample_rate` integer, required
      - `segments` string[], required
      - `voice` string, required
    - `audio_transcription` AudioTranscriptionMetadata: Optional audio transcription metadata for supported audio uploads.
      - `chunks` AudioTranscriptionChunk[], nullable: Per-chunk progress and state for future timeline alignment.
        - `attempts` integer: Number of attempts made for this chunk.
        - `byte_end` integer, nullable: Optional byte range end in the stored canonical audio object.
        - `byte_start` integer, nullable: Optional byte range start in the stored canonical audio object.
        - `end_ms` integer, nullable: Optional end offset in milliseconds for the chunk.
        - `error` string, nullable: Optional sanitized error for this chunk.
        - `index` integer: Stable zero-based chunk index.
        - `start_ms` integer, nullable: Optional start offset in milliseconds for the chunk.
        - `status` string: Per-chunk transcription status.
        - `transcript` string, nullable: Per-chunk transcript text.
      - `error` string, nullable: Optional error message if status indicates failure.
      - `progress` number, double, nullable: Optional aggregate progress value in `[0, 1]`.
      - `status` string: Current transcription state.
      - `transcript` string, nullable: Optional transcript text once transcription completes.
      - `transcript_segments` AudioTranscriptSegment[], nullable: Transcript segments derived from completed chunks for timeline-aware UI surfaces.
        - `chunk_index` integer: Zero-based chunk index for this segment.
        - `end_ms` integer: Segment end offset in milliseconds.
        - `start_ms` integer: Segment start offset in milliseconds.
        - `text` string: Transcribed text for this segment.
    - `download_url` string, required: Pre-signed URL for downloading the file directly from storage
    - `external_id_ews_id` string: External Exchange Web Services ID for deep linking to the original item.
    - `file_capability` FileCapability, required: The file capability that was evaluated for this file
      - `extensions` string[], required: File extensions this capability applies to (e.g., ["docx", "doc"]) Special value "*" indicates all extensions
      - `id` string, required: Stable identifier (e.g., 'word', 'pdf', 'image', 'other')
      - `mime_types` string[], required: MIME types this capability applies to (e.g., ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]) May contain wildcards like "image/*" or "*/*"
      - `operations` FileOperation[], required: Operations that can be performed on matching files
      - `upload_allowed` boolean: Whether this file type may be uploaded under the active deployment policy.
    - `file_contents_unavailable_missing_permissions` boolean, required: Indicates that file contents are unavailable for the current user due to missing permissions.
    - `filename` string, required: The original filename of the uploaded file
    - `id` string, required: The unique ID of the uploaded file
    - `is_sharepoint_file` boolean, required: Indicates the file is stored in Sharepoint
    - `outlook_provenance` OutlookFileProvenance: Outlook source references for reopening the original email.
      - `origins` OutlookFileOrigin[], required: All distinct origins, including multiple containing emails for identical bytes.
        - `document` OutlookMessageReference: The uploaded email's own identity; a thread export identifies only its anchor.
          - `documentId` string: Local catalog UUID, scoped to its originating sidecar installation.
          - `external_ids` OutlookExternalId[], required
            - `key` string, required
            - `value` string, required
          - `mailbox` OutlookMailboxReference
            - `emailAddress` string: SMTP address of the owning mailbox, including shared mailboxes.
            - `mailboxId` string: Local mailbox ID, never a Graph mailbox identifier.
            - `profileName` string
        - `topLevelParent` OutlookMessageReference: The outermost containing mailbox message, separate from the document's identity.
          - `documentId` string: Local catalog UUID, scoped to its originating sidecar installation.
          - `external_ids` OutlookExternalId[], required
            - `key` string, required
            - `value` string, required
          - `mailbox` OutlookMailboxReference
            - `emailAddress` string: SMTP address of the owning mailbox, including shared mailboxes.
            - `mailboxId` string: Local mailbox ID, never a Graph mailbox identifier.
            - `profileName` string
      - `version` integer, required: Contract version. Only version 1 is supported.
    - `preview_url` string, nullable: Proxied URL for inline preview without forcing download when available
  - `rejected_files` string[]: Filenames skipped by the configured operation policy.

## Other responses

- `400`: Invalid request or unsupported source
- `401`: No access token available for external provider
- `404`: File not found or integration not enabled
- `415`: The file is not permitted by the configured upload-operation policy
- `500`: Server error

## Changes

- **2026-10-28** `4597e796834c`: 1 info
  - added the optional property `files/items/audio_synthesis` to the response with the `200` status
- **2026-10-28** `0b3f046222fd`: 1 warning
  - removed the optional property `files/items/audio_synthesis` from the response with the `200` status
- **2026-10-28** `7b14e607c106`: 1 info
  - added the optional property `files/items/audio_synthesis` to the response with the `200` status
- **2026-10-01** `da255ff2b71a`: 3 info
  - added the non-success response with the status `415`
  - added the optional property `files/items/file_capability/upload_allowed` to the response with the `200` status
  - added the optional property `rejected_files` to the response with the `200` status
- **2026-09-22** `14aa9d12afa0`: 1 info
  - added the optional property `files/items/outlook_provenance` to the response with the `200` status

[Operation history](https://skmtc.dev/eratolab/apis/erato-labs-generated-api/changes/api/v1beta/me/files/link/post.md)

---

[API](https://skmtc.dev/eratolab/apis/erato-labs-generated-api.md) - [All operations](https://skmtc.dev/eratolab/apis/erato-labs-generated-api/llms.txt) - [OpenAPI document](https://skmtc.dev/eratolab/apis/erato-labs-generated-api/revisions/a34e0038f4c3?raw)
