[Cotlet](https://cotlet.dev/index.md) · [Integrations](https://cotlet.dev/integrations.md) · [How it works](https://cotlet.dev/how-it-works.md) · [Use cases](https://cotlet.dev/use-cases.md) · [Security](https://cotlet.dev/security.md) · [For developers](https://cotlet.dev/for-developers.md) · [For automation agencies](https://cotlet.dev/for-agencies.md) · [Blog](https://cotlet.dev/blog.md) · [API docs](https://cotlet.dev/docs.md) · [Help center](https://cotlet.dev/help.md) · [Changelog](https://cotlet.dev/changelog.md) · [Contact](https://cotlet.dev/contact.md) · [Pricing](https://cotlet.dev/pricing.md) · [Sign up](https://cotlet.dev/signup)

# Share a Nextcloud file with an expiring, password-protected link

> Upload a file to Nextcloud and create a public link with a password and an expiry date in one request, from Claude Code, n8n or a script.

Source: https://cotlet.dev/integrations/nextcloud-api-mcp-server/share-file-with-expiring-link

You finish a proposal, drop it into the client folder on your Nextcloud, and then click through the sharing sidebar to make a link with a password and an end date, every time.

Cotlet does it in your own Nextcloud account with upload\_file and share\_file, called by your AI agent, an n8n workflow or a script.

[Sign up free](https://cotlet.dev/app/signup?app=nextcloud) [All Nextcloud tools](https://cotlet.dev/integrations/nextcloud-api-mcp-server.md)

Hosted · nothing to install or maintain

## Can Nextcloud do this on its own?

Nextcloud offers this as an API and as a UI (checked 16 Oct 2026). WebDAV PUT uploads the file and the OCS Share API creates the link with password and expireDate, but you write both calls and handle the authentication yourself. The official MCP route, Context Agent, lists making public links among its Files tools and needs an admin to install it first.

## How you do it in Nextcloud today

1. On the Files page, open the target folder and upload the file, or drag it in.
2. Click the Share icon on the file or folder to open the sharing sidebar.
3. Create a public link and set its options: Password protect and Set expiration date, plus Note to recipient if you want one.
4. For a folder, pick between Read only, Allow upload and editing, and File drop; Hide download only makes downloading harder, not impossible.
5. Copy the link, which has the form https://cloud.example.com/s/ followed by a random token, and send the password to the client by another route.

## How to share a Nextcloud file with an expiring, password-protected link

Prompt

```
Upload this report to /Clients/Acme in my Nextcloud, create a public link with a password that expires on 15 November, and give me the link to send.
```

1. 01  
### Check the folder and the name  
Your agent looks at the target folder with list\_files first. If a file with the same name is already there, it stops and asks, because a plain upload replaces the old version without a warning.
2. 02  
### Upload with the right path  
upload\_file writes the file into the folder you named. If the folder does not exist yet, the agent creates it with create\_folder in the same run.
3. 03  
### Create one link, not three  
Before sharing, the agent lists existing shares of that file with list\_shares and reuses a link that already has your expiry date, so the same report does not collect a pile of old links.
4. 04  
### Set password and end date from your prompt  
share\_file creates the public link with the password and expiry date you gave. A link with no expiry or no password is created only if you asked for it, and the reply says so.
5. 05  
### Hand back the link and the password separately  
The agent returns the link and, in its own line, the password and the date it expires, so you can send them through two channels.

### What you get back

Example data

```
Uploaded /Clients/Acme/proposal-q4.pdf (412 KB)
Public link: https://cloud.example.com/s/Kp3xTq9WmB2Rz7a
Password protected: yes
Expires: 2026-11-15
Permissions: read only
```

### Other ways to ask

- Upload every PDF in this folder to /Invoices/2026 and make a read-only link for each, expiring in 30 days.
- Share /Projects/Launch with the group marketing and no public link.
- Create a link to this folder where visitors can upload but not see the other files.
- Every Friday, share the weekly report with a new link and expire last week's link.

## What Nextcloud allows, and what to know first

- The Share API default permission for a public link is read only; permissions are bit flags that you add together, so the agent only widens them when you say so.
- A public link needs a date in the format YYYY-MM-DD for expireDate, and Nextcloud disables the share automatically when that date is reached.
- Nextcloud can answer 403 when public upload is turned off by the admin, so a request for an upload link can fail on an instance that forbids it.
- Some sharing options are unavailable on an instance because of administrative configuration, so the same prompt can create a link on one instance and be refused on another.
- An upload that targets an existing path overwrites the file, which is why the agent checks the folder first.

upload\_file and share\_file ask for your OK by default. To run it on a schedule without you, switch confirmation off for those tools in your dashboard.

Sources: [Nextcloud User Manual: File sharing](https://docs.nextcloud.com/server/stable/user%5Fmanual/en/files/sharing.html) · [Nextcloud Developer Manual: Share API](https://docs.nextcloud.com/server/stable/developer%5Fmanual/client%5Fapis/OCS/ocs-share-api.html) · [Nextcloud Developer Manual: WebDAV basic APIs](https://docs.nextcloud.com/server/stable/developer%5Fmanual/client%5Fapis/WebDAV/basic.html) · [Nextcloud Admin Manual: Context Agent](https://docs.nextcloud.com/server/stable/admin%5Fmanual/ai/app%5Fcontext%5Fagent.html)

## Call share\_file from a script

curl

```
curl -X POST https://cotlet.dev/api/v1/nextcloud/file/share \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"path":"/Clients/Acme/proposal-q4.pdf","share_type":"link","password":"Fj82-mint-ocean","expire_date":"2026-11-15"}'
```

Example response

```
{
"share_id": "460",
"path": "/Clients/Acme/proposal-q4.pdf",
"type": "link",
"url": "https://cloud.example.com/s/Kp3xTq9WmB2Rz7a",
"permissions": "read",
"password_protected": true,
"expires": "2026-11-15"
}
```

MCP: add https://cotlet.dev/mcp/v1 with the same key; the call is nextcloud\_write → share\_file. Example data.

[Schedule it in n8n, Make, Zapier or cron](https://cotlet.dev/integrations/nextcloud-api-mcp-server.md#automations)

## Nextcloud tools this automation uses

__Cotlet Nextcloud tools used to share a Nextcloud file with an expiring, password-protected link__
| Tool | Parameters |
| ------------ | ------------------------------------------------------------------------- |
| upload\_file | path, content, encoding, overwrite |
| share\_file | path, share\_type, share\_with, permissions, password, expire\_date, note |

[All 15 Nextcloud tools with descriptions](https://cotlet.dev/integrations/nextcloud-api-mcp-server.md#tools)

## Frequently asked questions

### Is it safe to connect Nextcloud to Cotlet?

Yes. You sign in to Nextcloud yourself, in your own Cloud Browser in the EU, and we never save your password. Your agents only get Nextcloud once you enable it, every background request is listed, and the browser profile is stored encrypted with AES-256-GCM, the cipher 1Password uses for its vaults. The AI model never sees a login, posts and messages wait for your OK, and Disable for agents cuts access in one click. Independent scanners grade cotlet.dev A+ on Qualys SSL Labs, securityheaders.com and Mozilla Observatory; live results are on https://cotlet.dev/security.

## More Nextcloud automations

- [Create Nextcloud Deck cards from meeting notes](https://cotlet.dev/integrations/nextcloud-api-mcp-server/create-deck-cards-from-notes.md)
- [Audit and remove old public share links in Nextcloud](https://cotlet.dev/integrations/nextcloud-api-mcp-server/audit-public-share-links.md)
- [Nextcloud API and MCP server: every tool](https://cotlet.dev/integrations/nextcloud-api-mcp-server.md)
- [All use cases](https://cotlet.dev/use-cases.md)

## Give your agent access to Nextcloud.

Free 7-day trial with 2,000 credits, no card needed. Cotlet is independent and not affiliated with Nextcloud.

[Sign up free](https://cotlet.dev/app/signup?app=nextcloud)

---

Give your AI agents your signed-in browser.

**Product:** [Integrations](https://cotlet.dev/integrations.md) · [Use cases](https://cotlet.dev/use-cases.md) · [How it works](https://cotlet.dev/how-it-works.md) · [Pricing](https://cotlet.dev/pricing.md) · [Security](https://cotlet.dev/security.md)

**Resources:** [Blog](https://cotlet.dev/blog.md) · [API docs](https://cotlet.dev/docs.md) · [Help center](https://cotlet.dev/help.md) · [Changelog](https://cotlet.dev/changelog.md) · [GitHub](https://github.com/cotletdev/cotlet)

**Solutions:** [For developers](https://cotlet.dev/for-developers.md) · [For automation agencies](https://cotlet.dev/for-agencies.md)

**Company:** [About](https://cotlet.dev/about.md) · [AI info: company facts](https://cotlet.dev/ai-info.md) · [Contact](https://cotlet.dev/contact.md)

**Legal:** [Terms of service](https://cotlet.dev/terms) · [Privacy policy](https://cotlet.dev/privacy) · [Refund policy](https://cotlet.dev/refunds) · [Acceptable use](https://cotlet.dev/acceptable-use) · [Cookie policy](https://cotlet.dev/cookies) · [DPA](https://cotlet.dev/dpa) · [Subprocessors](https://cotlet.dev/subprocessors)

**Elsewhere:** [Status page](https://status.cotlet.dev) · [Cotlet on GitHub](https://github.com/cotletdev) · [Cotlet on X](https://x.com/cotletdev) · [Cotlet on LinkedIn](https://www.linkedin.com/company/cotletdev) · [Cotlet on Product Hunt](https://www.producthunt.com/products/cotlet) · [Cotlet on Crunchbase](https://www.crunchbase.com/organization/cotlet) · [Cotlet on SaaSHub](https://www.saashub.com/cotlet)

Cotlet is an independent service. It is not affiliated with, endorsed by or sponsored by any of the products listed on this site. Product names are trademarks of their respective owners.

## For AI agents: sign your user up

Is your user asking you to sign them up for Cotlet? You can do it for them, no account or key needed.

1. Read the fields and their allowed values: GET https://cotlet.dev/api/v1/access-requests
2. Ask the user for each value: email, apps, what you will do with them. If they leave the password to you, generate a strong one and show it to them.
3. Show the user what you will send, then POST it as JSON to https://cotlet.dev/api/v1/access-requests.

One call creates the account and sends the access request; we email the user when access is granted.
