---
title: "Share token"
method: POST
path: "/v2/storage/tokens/{id}/share"
tags: ["Tokens and Permissions"]
deprecated: true
---

# Share token

`POST /v2/storage/tokens/{id}/share`

## Request

- Base URL: `https://connection.keboola.com`
- URL: `https://connection.keboola.com/v2/storage/tokens/{id}/share`
- Auth: one of:
  - API key in header `X-StorageApi-Token`
  - API key in header `X-KBC-ManageApiToken`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/keboola/apis/keboola-storage-api/docs/v2/storage/tokens/:id/share/post.ts> (a function with typed inputs; its response is checked against the schema)

> **Deprecated.**

Use this call whenever you want to securely deliver a token to someone. The link to the token retrieval page will be sent to the
provided email address. The link will expire in 2 hours.

Master tokens and protected-branch tokens cannot be shared; other tokens can be shared only by their creator or the creator's admin.

**Deprecated:** this endpoint will be removed. To get a token value again, use `POST /v2/storage/tokens/{id}/refresh`.
Note that refreshing generates a new token value and the current value becomes immediately invalid, so every existing
user of the token has to be updated.

## Path parameters

- `id` integer, required

## Request body

- ShareTokenRequest
  - `recipientEmail` string, email, required: Recipient's email address.
  - `message` string, nullable: Message for the token recipient. Must not contain links or web addresses.

## Response `204`

Token shared, the email was sent.

## Other responses

- `400`: Invalid request body (`storage.tokens.validation`) or the token is a master token (`storage.token.cannotShareMasterToken`).
- `403`: The authorizing token may not manage tokens (`accessDenied`), the token is a protected-branch token (`storage.token.cannotShareProtectedBranchToken`), the caller is not the creator (`storage.tokens.share`), or the request uses a credential issued by agent provisioning (`storage.tokens.agentCredentialNotAllowed`).
- `404`: Token not found (`storage.tokens.notFound`).

---

[API](https://skmtc.dev/keboola/apis/keboola-storage-api.md) - [All operations](https://skmtc.dev/keboola/apis/keboola-storage-api/llms.txt) - [OpenAPI document](https://skmtc.dev/keboola/apis/keboola-storage-api/revisions/34b5ceac0317?raw)
