# Shared links (anonymous access) (IRPCSharedLinksPublic)

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/

Opens and downloads files through shared links, without logging in.

- **gRPC service:** `MFiles.IRPCSharedLinksPublic`
- **Book and level:** [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md), standard
- **Methods:** 7
- **Proto file:** [`mfiles/IRPCSharedLinksPublic.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/IRPCSharedLinksPublic.proto)

<a id="overview"></a>

## Overview

The anonymous side of shared links: opens and downloads a file shared with
[CreateSharedLink](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinks/CreateSharedLink/index.md). No login and no session
are needed; every call names the vault by its GUID and the link by its access key. Use it to
build a download page for people outside the vault.

**Public read-only link** (`SHARED_LINK_TYPE_READ_ONLY`, or an external link open to anyone):

1. [GetSharedLinkInfo](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/GetSharedLinkInfo/index.md) for the file name,
   extension and size.
2. [DownloadSharedFile_Begin](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/DownloadSharedFile_Begin/index.md)
   for a download ID, the size and the MD5 checksum.
3. [DownloadSharedFile_ReadBlock](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/DownloadSharedFile_ReadBlock/index.md)
   in a loop until all bytes are read.

**Link shared with named visitors** (visitor links, and external links that are not open to
anyone): the visitor proves their email address first.

1. [AccessSharedLink](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/AccessSharedLink/index.md) with the visitor's
   email address returns an access session value. If the address is a recipient of the link,
   the server emails an access code to it.
2. Pass the address, the access code and the access session in `additional_data` of
   [GetSharedLinkInfo](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/GetSharedLinkInfo/index.md) and
   [DownloadSharedFile_Begin](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/DownloadSharedFile_Begin/index.md), as
   [NamedValue](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.NamedValue/index.md) entries named `RECIPIENT_EMAIL`,
   `RECIPIENT_ACCESSCODE` and `ACCESS_SESSION`. Without them, an external link that is not open
   to anyone fails with "Authentication required to access the shared link.".

Shared links must be enabled on the server and in the vault. An unknown, deleted or expired
access key fails with "The link is either expired or invalid.". The upload and WOPI methods
serve co-authoring and Office for the web in M-Files clients; applications rarely call them.

<a id="methods"></a>

## Methods

| Method | Summary | Facts |
|---|---|---|
| [AccessSharedLink](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/AccessSharedLink/index.md) | Starts a visitor's access to a link shared with named visitors: returns an access session value and, if the email address is a recipient of the link, emails an access code to it. | `write` `no session` |
| [DownloadSharedFile_Begin](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/DownloadSharedFile_Begin/index.md) | Starts downloading the file of a shared link, without logging in, and returns a download ID, the file size and its MD5 checksum. | `write` `no session` |
| [DownloadSharedFile_ReadBlock](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/DownloadSharedFile_ReadBlock/index.md) | Reads one block of a file download started with DownloadSharedFile_Begin. | `write` `no session` |
| [GetSharedLinkInfo](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/GetSharedLinkInfo/index.md) | Gets the name, extension and size of the file that a shared link points to, without logging in. | `write` `no session` |
| [GetWOPIFileInfo](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/GetWOPIFileInfo/index.md) | Gets information about the file of a link for Office for the web (WOPI) operations. Used by M-Files clients; applications rarely call it. | `write` `no session` |
| [UploadSharedFile](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/UploadSharedFile/index.md) | Uploads a block of new content for a file opened for editing in Office for the web. Used by M-Files clients; applications rarely call it. | `write` `no session` |
| [UploadSharedFileCommit](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSharedLinksPublic/UploadSharedFileCommit/index.md) | Completes an upload made with UploadSharedFile and stores the content in the checked-out file. Used by M-Files clients; applications rarely call it. | `write` `no session` |
